manjaro-tools/bin/finddeps.in

47 lines
1.3 KiB
Text
Raw Normal View History

2014-10-04 00:46:40 +02:00
#!/bin/bash
2014-10-04 15:41:22 +02:00
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
2014-10-04 00:46:40 +02:00
#
2014-10-04 15:41:22 +02:00
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
2014-10-04 01:43:42 +02:00
2014-10-08 00:12:14 +02:00
if [[ -r @libdir@/messages.sh ]];then
source @libdir@/messages.sh
2014-10-07 21:28:59 +02:00
fi
2014-10-04 00:46:40 +02:00
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 1
fi
find . -type d | while read d; do
if [[ -f "$d/PKGBUILD" ]]; then
unset pkgname depends makedepends optdepends
. "$d/PKGBUILD"
for dep in "${depends[@]}"; do
# lose the version comparator, if any
depname=${dep%%[<>=]*}
2014-10-07 21:28:59 +02:00
[[ $depname = $match ]] && msg "$d (depends)"
2014-10-04 00:46:40 +02:00
done
for dep in "${makedepends[@]}"; do
# lose the version comparator, if any
depname=${dep%%[<>=]*}
2014-10-07 21:28:59 +02:00
[[ $depname = $match ]] && msg "$d (makedepends)"
2014-10-04 00:46:40 +02:00
done
for dep in "${optdepends[@]/:*}"; do
# lose the version comaparator, if any
depname=${dep%%[<>=]*}
2014-10-07 21:28:59 +02:00
[[ $depname = $match ]] && msg "$d (optdepends)"
2014-10-04 00:46:40 +02:00
done
fi
done