diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 09:36:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 09:36:25 +0000 |
commit | 6077d258b500b20e1e705f5cda567400240c7804 (patch) | |
tree | a5d41c050bd69f91476994b0d30c0a8f1e7957b5 /scripts/whodepends.sh | |
parent | Initial commit. (diff) | |
download | devscripts-upstream.tar.xz devscripts-upstream.zip |
Adding upstream version 2.21.3+deb11u1.upstream/2.21.3+deb11u1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/whodepends.sh')
-rwxr-xr-x | scripts/whodepends.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/whodepends.sh b/scripts/whodepends.sh new file mode 100755 index 0000000..7d54283 --- /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=`basename $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 |