Bug#690059: wnpp-check; On the fly choose curl or wget, whichever is installed

Regid Ichira regid23 at nt1.in
Tue Oct 9 15:21:55 UTC 2012


package:  devscripts
Version:  2.12.4
Severity: normal
Tags:     patch
Files:    /usr/bin/wnpp-check
          /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-check was using solely
wget.  The following patches tries to rectify this.


--- /usr/bin/wnpp-check	2012-09-25 01:45:59.000000000 +0200
+++ wnpp-check	2012-10-09 17:12:50.000000000 +0200
@@ -10,6 +10,8 @@
 
 PROGNAME=`basename $0`
 PACKAGES="$@"
+CURLORWGET=""
+GETCOMMAND=""
 
 usage () { echo \
 "Usage: $PROGNAME <package name> [...]
@@ -33,8 +35,14 @@ if [ "x$1" = "x--help" -o "x$1" = "x-h"
 if [ "x$1" = "x--version" -o "x$1" = "x-v" ]; then version; exit 0; fi
 if [ "x$1" = "x" ]; then usage; exit 1; 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
 
@@ -50,12 +58,12 @@ trap "rm -f '$WNPP' '$WNPPTMP' '$WNPP_PA
 # 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/being_packaged || \
-    { echo "wnpp-check: wget http://www.debian.org/devel/wnpp/being_packaged failed" >&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>.*/ITP \1 \2 -- \3/; T d; p; : d' $WNPPTMP > $WNPP
 
-wget -q -O $WNPPTMP http://www.debian.org/devel/wnpp/requested || \
-    { echo "wnpp-check: wget http://www.debian.org/devel/wnpp/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>.*/RFP \1 \2 -- \3/; T d; p; : d' $WNPPTMP >> $WNPP
 
 awk -F' ' '{print $3" ("$1" - #"$2")"}' $WNPP | sort > $WNPP_PACKAGES


--- /usr/share/doc/devscripts/README.gz	2012-10-09 17:19:43.957978654 +0200
+++ README	2012-10-09 17:14:01.000000000 +0200
@@ -240,7 +240,7 @@ And now, in mostly alphabetical order, t
   [wget]
 
 - wnpp-check: check whether there is an open request for packaging or
-  intention to package bug for a package [wget]
+  intention to package bug for a package [curl | wget]
 
 - wrap-and-sort: wrap long lines and sort items in packaging files
   [python-debian]



More information about the devscripts-devel mailing list