Skip to content
finddeps.in 956 B
Newer Older
#!/bin/bash
#
# finddeps - find packages that depend on a given depname
#
m4_include(lib/common.sh)

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 ''
find . -type d | while read d; do
	if [[ -f "$d/PKGBUILD" ]]; then
		unset pkgname depends makedepends optdepends
		. "$d/PKGBUILD"
		for dep in "${depends[@]}"; do
Jan Steffens's avatar
Jan Steffens committed
			# lose the version comparator, if any
			depname=${dep%%[<>=]*}
			[[ $depname = $match ]] && echo "$d (depends)"
		done
		for dep in "${makedepends[@]}"; do
Jan Steffens's avatar
Jan Steffens committed
			# lose the version comparator, if any
			depname=${dep%%[<>=]*}
			[[ $depname = $match ]] && echo "$d (makedepends)"
		done
Ray Rashif's avatar
Ray Rashif committed
		for dep in "${optdepends[@]/:*}"; do
			# lose the version comaparator, if any
			depname=${dep%%[<>=]*}
			[[ $depname = $match ]] && echo "$d (optdepends)"
Ray Rashif's avatar
Ray Rashif committed
		done