[devscripts] 03/07: grep-excuses: --debug option

James McCoy jamessan at debian.org
Mon Feb 16 04:09:12 UTC 2015


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit 274cce0caa751eb90af1bb63058f7094e9330c12
Author: Ian Jackson <ijackson at chiark.greenend.org.uk>
Date:   Sat Feb 7 13:20:45 2015 +0000

    grep-excuses: --debug option
    
    For now this just shows the URL we fetch.
    
    Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 scripts/grep-excuses.1  | 3 +++
 scripts/grep-excuses.pl | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/scripts/grep-excuses.1 b/scripts/grep-excuses.1
index 38767e9..b911a9f 100644
--- a/scripts/grep-excuses.1
+++ b/scripts/grep-excuses.1
@@ -25,6 +25,9 @@ Show a brief usage message.
 .TP
 .B \-\-version
 Show version and copyright information.
+.TP
+.B \-\-debug
+Print debugging output to stderr (including url(s) fetched).
 .SH "CONFIGURATION VARIABLES"
 The two configuration files \fI/etc/devscripts.conf\fR and
 \fI~/.devscripts\fR are sourced in that order to set configuration
diff --git a/scripts/grep-excuses.pl b/scripts/grep-excuses.pl
index d1dd756..069d23f 100755
--- a/scripts/grep-excuses.pl
+++ b/scripts/grep-excuses.pl
@@ -24,6 +24,8 @@ use File::Basename;
 
 # Needed for --wipnity option
 
+open DEBUG, ">/dev/null" or die $!;
+
 my $term_size_broken;
 
 sub have_term_size {
@@ -67,6 +69,7 @@ Options:
                       name must be given when using this option.
   --help              Show this help
   --version           Give version information
+  --debug             Print debugging output to stderr
 
 Default settings modified by devscripts configuration files:
 $modified_conf_msg
@@ -150,6 +153,10 @@ while (@ARGV and $ARGV[0] =~ /^-/) {
 	    die "$progname: too many arguments!  Try $progname --help for help.\n";
 	} else { wipnity($string); exit 0; }
     }
+    if ($ARGV[0] eq '--debug') {
+	open DEBUG, ">&STDERR" or die $!;
+	shift; next;
+    }
     if ($ARGV[0] eq '--help') { usage(); exit 0; }
     if ($ARGV[0] eq '--version') { print $version; exit 0; }
     if ($ARGV[0] =~ /^--no-?conf$/) {
@@ -176,6 +183,8 @@ if (system("command -v wget >/dev/null 2>&1") != 0) {
     die "$progname: this program requires the wget package to be installed\n";
 }
 
+print DEBUG "Fetching $url\n";
+
 open EXCUSES, "wget -q -O - $url | zcat |" or
     die "$progname: wget | zcat failed: $!\n";
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list