Bug#690056: wnpp-alert; Use curl or wget, whichever is installed

Regid Ichira regid23 at nt1.in
Tue Oct 9 15:08:25 UTC 2012


package:  devscripts
Version:  2.12.4
Severity: normal
Tags:     patch
Files:    /usr/bin/wnpp-alert
          /usr/share/doc/devscripts/README.gz

  Many devscripts choose on the fly whether to use curl or wget,
depending on what is installed.  So far wnpp-alert was using solely
wget.  The following patches tries to rectify this.


--- a/usr/bin/wnpp-alert	2012-09-25 01:45:59.000000000 +0200
+++ b/usr/bin/wnpp-alert	2012-10-09 16:51:11.000000000 +0200
@@ -16,6 +16,8 @@
 PROGNAME=`basename $0`
 CACHEDIR=~/.devscripts_cache
 CACHEDDIFF="${CACHEDIR}/wnpp-diff"
+CURLORWGET=""
+GETCOMMAND=""
 
 usage () { echo \
 "Usage: $PROGNAME [--help|-h|--version|-v|--diff|-d] [package ...]
@@ -52,8 +54,14 @@ wnppdiff () {
 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
-    echo "$PROGNAME: need the wget package installed to run this" >&2
+if command -v curl >/dev/null 2>&1; then
+    CURLORWGET="curl"
+    GETCOMMAND="curl -qs -o"
+elif command -v wget >/dev/null 2>&1; then
+    CURLORWGET="wget"
+    GETCOMMAND="wget -q -O"
+else
+    echo "$PROGNAME: need either the curl or wget package installed to run this" >&2
     exit 1
 fi
 
@@ -84,16 +92,16 @@ fi
 # 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'
-wget -q -O $WNPPTMP http://www.debian.org/devel/wnpp/orphaned || \
-    { echo "wnpp-alert: wget http://www.debian.org/devel/wnpp/orphaned failed" >&2; exit 1; }
+$GETCOMMAND $WNPPTMP http://www.debian.org/devel/wnpp/orphaned || \
+    { echo "wnpp-alert: $CURLORWGET http://www.debian.org/devel/wnpp/orphaned failed" >&2; exit 1; }
 sed -ne 's/.*<li><a href="http:\/\/bugs.debian.org\/\([0-9]*\)">\([^:<]*\)[: ]*\([^<]*\)<\/a>.*/O \1 \2 -- \3/; T d; p; : d' $WNPPTMP > $WNPP
 
-wget -q -O $WNPPTMP http://www.debian.org/devel/wnpp/rfa_bypackage || \
-    { echo "wnpp-alert: wget http://www.debian.org/devel/wnpp/rfa_bypackage" >&2; exit 1; }
+$GETCOMMAND $WNPPTMP http://www.debian.org/devel/wnpp/rfa_bypackage || \
+    { echo "wnpp-alert: $CURLORWGET http://www.debian.org/devel/wnpp/rfa_bypackage" >&2; exit 1; }
 sed -ne 's/.*<li><a href="http:\/\/bugs.debian.org\/\([0-9]*\)">\([^:<]*\)[: ]*\([^<]*\)<\/a>.*/RFA \1 \2 -- \3/; T d; p; : d' $WNPPTMP >> $WNPP
 
-wget -q -O $WNPPTMP http://www.debian.org/devel/wnpp/help_requested || \
-    { echo "wnpp-alert: wget http://www.debian.org/devel/wnpp/help_requested" >&2; exit 1; }
+$GETCOMMAND $WNPPTMP http://www.debian.org/devel/wnpp/help_requested || \
+    { echo "wnpp-alert: $CURLORWGET http://www.debian.org/devel/wnpp/help_requested" >&2; exit 1; }
 sed -ne 's/.*<li><a href="http:\/\/bugs.debian.org\/\([0-9]*\)">\([^:<]*\)[: ]*\([^<]*\)<\/a>.*/RFH \1 \2 -- \3/; T d; p; : d' $WNPPTMP >> $WNPP
 
 cut -f3 -d' ' $WNPP | sort > $WNPP_PACKAGES


--- /usr/share/doc/devscripts/README.gz	2012-10-09 17:03:17.235201485 +0200
+++ README	2012-10-09 16:53:42.000000000 +0200
@@ -237,7 +237,7 @@ And now, in mostly alphabetical order, t
   Debian archive [gnupg, debian-keyring, debian-maintainers, wget]
 
 - wnpp-alert: list installed packages which are orphaned or up for adoption
-  [wget]
+  [curl | wget]
 
 - wnpp-check: check whether there is an open request for packaging or
   intention to package bug for a package [wget]



More information about the devscripts-devel mailing list