ubuntu-dev-tools/reverse-build-depends

71 lines
1.5 KiB
Plaintext
Raw Normal View History

2008-01-13 23:22:08 +01:00
#!/bin/bash
#
2008-01-17 19:43:26 +01:00
# Copyright (C) 2007 Siegfried-A. Gevatter <rainct@ubuntu.com>
2008-01-13 23:22:08 +01:00
# Based upon a short script by an unknown author
#
# ##################################################################
#
# 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; either version 2
# of the License, or (at your option) any later version.
#
# 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.
#
# See file /usr/share/common-licenses/GPL for more details.
#
# ##################################################################
2008-01-13 23:22:08 +01:00
#
# This script is used to find the reverse build dependencies
# that a package has.
usage() {
2008-01-13 23:32:03 +01:00
echo "Usage: $0 [-c|-s] <package name>"
echo "Options:"
echo " -c: Print only the number of reverse dependencies."
echo " -s: Print all reverse dependencies in a single line."
2008-01-13 23:22:08 +01:00
}
if [ "$1" = '-c' ]
then
count=1
shift
fi
2008-01-13 23:32:03 +01:00
if [ "$1" = '-s' ]
then
single_line=1
shift
fi
2008-01-13 23:22:08 +01:00
if [ $# -ne 1 ];
then
usage
exit 1
fi
if [ "$1" = '-h' ] || [ "$1" = '--help' ]
then
usage
exit 0
fi
result=$(
grep-dctrl -sPackage -F Build-Depends,Build-Depends-Indep $1 \
2008-01-13 23:22:08 +01:00
/var/lib/apt/lists/*Sources | cut -d ' ' -f 2)
2008-01-13 23:32:03 +01:00
if [ -z $count ] && [ -z $single_line ]
2008-01-13 23:22:08 +01:00
then
2008-01-13 23:32:03 +01:00
echo "$result"
2008-01-13 23:22:08 +01:00
else
2008-01-13 23:32:03 +01:00
if [ -z $count ]
then
echo $result
else
echo "$result" | wc -l
fi
2008-01-13 23:22:08 +01:00
fi