8edb443c12
Source the PKGBUILD using the correct path (relative to our base directory) instead of using cd(1) to switch to the ABS base directory first and to the package directory afterwards. This is very useful when trying to track errors, also: $ ~/src/devtools/finddeps libdaq ./community/snort (depends) PKGBUILD: line 17: ruby: command not found PKGBUILD: line 19: [: =: unary operator expected Versus: $ ~/src/devtools/finddeps libdaq ./community/snort (depends) ./community/ruby-pkgconfig/PKGBUILD: line 17: ruby: command not found ./community/lmms/PKGBUILD: line 19: [: =: unary operator expected Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
38 lines
917 B
Bash
38 lines
917 B
Bash
#!/bin/bash
|
|
#
|
|
# finddeps - find packages that depend on a given depname
|
|
#
|
|
|
|
match=$1
|
|
|
|
if [[ -z $match ]]; then
|
|
echo 'usage: finddeps <depname>'
|
|
echo ''
|
|
echo 'Find packages that depend on a given depname.'
|
|
echo 'Run this script from the top-level directory of your ABS tree.'
|
|
echo ''
|
|
exit 0
|
|
fi
|
|
|
|
for d in "$(find . -type d)"; do
|
|
if [[ -f "$d/PKGBUILD" ]]; then
|
|
unset pkgname depends makedepends
|
|
. "$d/PKGBUILD"
|
|
for dep in "${depends[@]}"; do
|
|
# lose the version comparator, if any
|
|
depname=${dep%%[<>=]*}
|
|
[[ $depname = $match ]] && echo "$d (depends)"
|
|
done
|
|
for dep in "${makedepends[@]}"; do
|
|
# lose the version comparator, if any
|
|
depname=${dep%%[<>=]*}
|
|
[[ $depname = $match ]] && echo "$d (makedepends)"
|
|
done
|
|
for dep in "${optdepends[@]/:*}"; do
|
|
# lose the version comaparator, if any
|
|
depname=${dep%%[<>=]*}
|
|
[[ $depname = $match ]] && echo "$d (optdepends)"
|
|
done
|
|
fi
|
|
done
|