Codebase list debian-goodies / 99f4801
Slight refactoring: Make dglob more readable Gbp-Dch: Ignore Axel Beckert 6 years ago
1 changed file(s) with 12 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
1919 # 02111-1307, USA.
2020 #
2121
22 ARGS=`getopt -o af0reinXv -n dglob -- "$@"`
22 ARGS=$(getopt -o af0reinXv -n dglob -- "$@")
2323 eval set -- "$ARGS"
2424
2525
3535
3636 while true; do
3737 case "$1" in
38 -n) shift; ARGS=`echo $@ | sed -e 's/--/ /'`; dglob_not $ARGS; exit 0;;
38 -n) shift; ARGS=$(echo $@ | sed -e 's/--/ /'); dglob_not $ARGS; exit 0;;
3939 -a) filter="cat" ; all="yes" ; shift ;;
4040 -0) SEP=0 ; shift ;;
4141 -r|-e|-i|-X|-v) grep_dctrl_options="$grep_dctrl_options $1"; shift ;;
4242 -f) expand="xargs dpkg --listfiles | perl -nl${SEP}e 'print if -f'"
4343 if [ "$all" = "yes" ] ; then
44 if [ -n "`which apt-file`" ] ; then
44 if [ -n "$(which apt-file)" ] ; then
4545 # if we have apt-file use it instead
4646 expand="while read pack; do apt-file show \$pack; done | perl -ple 's/^.*?: //'"
4747 else
5959
6060 # Does the package exist?
6161 if [ "$all" = "no" ] ; then
62 packages=`eval $filter /var/lib/dpkg/status | grep-dctrl -PnsPackage $grep_dctrl_options "$1"`
62 packages=$(eval $filter /var/lib/dpkg/status | \
63 grep-dctrl -PnsPackage $grep_dctrl_options "$1")
6364 if [ -z "$packages" ] ; then
6465 exit 1
6566 fi
66 eval $filter /var/lib/dpkg/status | grep-dctrl -PnsPackage $grep_dctrl_options "$1" | grep -v ^$ |
67 (eval $expand)
67 eval $filter /var/lib/dpkg/status | \
68 grep-dctrl -PnsPackage $grep_dctrl_options "$1" | \
69 grep -v ^$ | \
70 (eval $expand)
6871 else
6972 # Use grep-available as the status file does not include all available
7073 # packages
71 grep-aptavail -PnsPackage $grep_dctrl_options "$1" | grep -v ^$ |
72 (eval $expand)
74 grep-aptavail -PnsPackage $grep_dctrl_options "$1" | \
75 grep -v ^$ | \
76 (eval $expand)
7377 fi