/usr/bin/wnpp-alert is in devscripts 2.15.3+deb8u1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | #!/bin/bash
# wnpp-alert -- check for installed packages which have been orphaned
# or put up for adoption
# This script is in the PUBLIC DOMAIN.
# Authors:
# Arthur Korn <arthur@korn.ch>
# Arthur wrote:
# Get a list of packages with bugnumbers. I tried with LDAP, but this
# is _much_ faster.
# And I (Julian) tried it with Perl's LWP, but this is _much_ faster
# (startup time is huge). And even Perl with wget is slower by 50%....
set -e
PROGNAME="${0##*/}"
CACHEDIR=~/.devscripts_cache
CACHEDDIFF="${CACHEDIR}/wnpp-diff"
CURLORWGET=""
GETCOMMAND=""
usage () { echo \
"Usage: $PROGNAME [--help|-h|--version|-v|--diff|-d] [package ...]
List all installed (or listed) packages with Request for
Adoption (RFA), Request for Help (RHF), or Orphaned (O)
bugs against them, as determined from the WNPP website.
https://www.debian.org/devel/wnpp"
}
version () { echo \
"This is $PROGNAME, from the Debian devscripts package, version 2.15.3+deb8u1
This script is in the PUBLIC DOMAIN.
Authors: Arthur Korn <arthur@korn.ch>
Modifications: Julian Gilbey <jdg@debian.org>"
}
wnppdiff () {
if [ ! -f "$CACHEDDIFF" ]; then
# First use
comm -12 $WNPP_PACKAGES $INSTALLED | sed -e 's/+/\\+/g' | \
xargs -i egrep '^[A-Z]+ [0-9]+ {} ' $WNPP | \
tee $CACHEDDIFF
else
comm -12 $WNPP_PACKAGES $INSTALLED | sed -e 's/+/\\+/g' | \
xargs -i egrep '^[A-Z]+ [0-9]+ {} ' $WNPP > $WNPP_DIFF
sort -o $CACHEDDIFF $CACHEDDIFF
sort -o $WNPP_DIFF $WNPP_DIFF
comm -3 $CACHEDDIFF $WNPP_DIFF | \
sed -e 's/\t/\+/g' -e 's/^\([^+]\)/-\1/g'
mv $WNPP_DIFF $CACHEDDIFF
fi
}
if [ "x$1" = "x--help" -o "x$1" = "x-h" ]; then usage; exit 0; fi
if [ "x$1" = "x--version" -o "x$1" = "x-v" ]; then version; exit 0; fi
if command -v wget >/dev/null 2>&1; then
CURLORWGET="wget"
GETCOMMAND="wget -q -O"
elif command -v curl >/dev/null 2>&1; then
CURLORWGET="curl"
GETCOMMAND="curl -qfs -o"
else
echo "$PROGNAME: need either the wget or curl package installed to run this" >&2
exit 1
fi
# Let's abandon this directory from now on, these files are so small
# (see bug#309802)
if [ -d "$CACHEDIR" ]; then
rm -f "$CACHEDIR"/orphaned "$CACHEDIR"/rfa_bypackage
fi
INSTALLED=`mktemp -t wnppalert-installed.XXXXXX`
trap "rm -f '$INSTALLED'" 0 1 2 3 7 10 13 15
WNPP=`mktemp -t wnppalert-wnpp.XXXXXX`
WNPPTMP=`mktemp -t wnppalert-wnpp.XXXXXX`
trap "rm -f '$INSTALLED' '$WNPP' '$WNPPTMP'" 0 1 2 3 7 10 13 15
WNPP_PACKAGES=`mktemp -t wnppalert-wnpp_packages.XXXXXX`
trap "rm -f '$INSTALLED' '$WNPP' '$WNPPTMP' '$WNPP_PACKAGES'" \
0 1 2 3 7 10 13 15
if [ "x$1" = "x--diff" ] || [ "x$1" = "x-d" ]; then
shift
WNPP_DIFF=`mktemp -t wnppalert-wnpp_diff.XXXXXX`
trap "rm -f '$INSTALLED' '$WNPP' '$WNPPTMP' '$WNPP_PACKAGES' '$WNPP_DIFF'" \
0 1 2 3 7 10 13 15
fi
# Here's a really sly sed script. Rather than first grepping for
# matching lines and then processing them, this attempts to sed
# every line; those which succeed execute the 'p' command, those
# which don't skip over it to the label 'd'
$GETCOMMAND $WNPPTMP http://www.debian.org/devel/wnpp/orphaned || \
{ echo "$PROGNAME: $CURLORWGET http://www.debian.org/devel/wnpp/orphaned failed" >&2; exit 1; }
sed -ne 's/.*<li><a href="https\?:\/\/bugs.debian.org\/\([0-9]*\)">\([^:<]*\)[: ]*\([^<]*\)<\/a>.*/O \1 \2 -- \3/; T d; p; : d' $WNPPTMP > $WNPP
$GETCOMMAND $WNPPTMP http://www.debian.org/devel/wnpp/rfa_bypackage || \
{ echo "$PROGNAME: $CURLORWGET http://www.debian.org/devel/wnpp/rfa_bypackage" >&2; exit 1; }
sed -ne 's/.*<li><a href="https\?:\/\/bugs.debian.org\/\([0-9]*\)">\([^:<]*\)[: ]*\([^<]*\)<\/a>.*/RFA \1 \2 -- \3/; T d; p; : d' $WNPPTMP >> $WNPP
$GETCOMMAND $WNPPTMP http://www.debian.org/devel/wnpp/help_requested || \
{ echo "$PROGNAME: $CURLORWGET http://www.debian.org/devel/wnpp/help_requested" >&2; exit 1; }
sed -ne 's/.*<li><a href="https\?:\/\/bugs.debian.org\/\([0-9]*\)">\([^:<]*\)[: ]*\([^<]*\)<\/a>.*/RFH \1 \2 -- \3/; T d; p; : d' $WNPPTMP >> $WNPP
cut -f3 -d' ' $WNPP | sort > $WNPP_PACKAGES
# A list of installed files.
if [ $# -gt 0 ]; then
echo $* | tr ' ' '\n' | sort -u > $INSTALLED
else
dpkg-query -W -f '${Package} ${Status}\n${Source} ${Status}\n' | \
awk '/^[^ ].*install ok installed/{print $1}' | \
sort -u \
> $INSTALLED
fi
if [ -f "$WNPP_DIFF" ]; then
if [ -d "$CACHEDIR" ]; then
wnppdiff
exit 0
else
echo "$PROGNAME: Unable to create diff; displaying full output"
fi
fi
comm -12 $WNPP_PACKAGES $INSTALLED | sed -e 's/+/\\+/g' | \
xargs -i egrep '^[A-Z]+ [0-9]+ {} ' $WNPP
|