summaryrefslogtreecommitdiffstats
path: root/scripts/whodepends.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:32:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:32:59 +0000
commit4d57e0a8dab2139a631a21aab862487481548702 (patch)
treef7cea0b9939e2ecb7a301de6c83bada29452046d /scripts/whodepends.sh
parentInitial commit. (diff)
downloaddevscripts-4d57e0a8dab2139a631a21aab862487481548702.tar.xz
devscripts-4d57e0a8dab2139a631a21aab862487481548702.zip
Adding upstream version 2.23.7.upstream/2.23.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/whodepends.sh')
-rwxr-xr-xscripts/whodepends.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/whodepends.sh b/scripts/whodepends.sh
new file mode 100755
index 0000000..e0b6441
--- /dev/null
+++ b/scripts/whodepends.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+# whodepends - show maintainers a package depends upon
+# by Moshe Zadka <moshez@debian.org> and
+# modified by Joshua Kwan <joshk@triplehelix.org>
+# This script is in the public domain.
+
+set -e
+
+PROGNAME=${0##*/}
+
+usage() {
+ cat <<EOF
+Usage: $PROGNAME [package] [package] ... [options]
+ Check which maintainers a particular package depends on.
+ $PROGNAME options:
+ --source, -s Show source packages instead of binary ones.
+ --help, -h Show this help screen.
+ --version Show version and copyright information.
+EOF
+}
+
+version() {
+ cat <<EOF
+This is $PROGNAME, from the Debian devscripts package, version ###VERSION###
+This code is by Moshe Zadka <moshez@debian.org>, and is in the public domain.
+EOF
+}
+
+if [ -z "$1" ]; then
+ usage
+ exit 1
+fi
+
+while [ -n "$1" ]; do
+ case "$1" in
+ -s | --source) source=true ;;
+ -h | --help) usage; exit 0 ;;
+ --version) version; exit 0 ;;
+ *)
+ echo "Dependent maintainers for $1:"
+ for package in $(apt-cache showpkg $1 | sed -n '/Reverse Depends:/,/Dependencies/p' | grep '^ '|sed 's/,.*//'); do
+ if [ $source ]; then
+ apt-cache showsrc $package |
+ awk '/^Maintainer:/ {maint=$0} /^Package:/ {pkg=$0} END {print maint, pkg}' |
+ sed 's/Maintainer: //;s/Package: //'
+ else
+ apt-cache show $package |
+ awk '/^Maintainer:/ {maint=$0} END {print maint, "'$package'"}' |
+ sed 's/Maintainer: //'
+ fi
+ done | sort -u | awk -F'>' '{ pack[$1]=pack[$1] $2 } END {for (val in pack) print val ">", "(" pack[val] ")"}' | sed 's/( /(/'
+ echo
+ ;;
+ esac
+ shift
+done