Author: adsb
Date: 2009-04-15 21:19:54 +0000 (Wed, 15 Apr 2009)
New Revision: 1858

Modified:
   trunk/conf.default.in
   trunk/debian/changelog
   trunk/debian/postinst
   trunk/scripts/rmadison.pl
Log:
rmadison: Allow a default URL to be specified in the configuration file.
Thanks, Roland Mas.  (Closes: #524198)

Modified: trunk/conf.default.in
===================================================================
--- trunk/conf.default.in       2009-04-15 21:06:21 UTC (rev 1857)
+++ trunk/conf.default.in       2009-04-15 21:19:54 UTC (rev 1858)
@@ -519,6 +519,9 @@
 # can use it with -u without having to specify the full URL
 # 
 # RMADISON_URL_MAP_EXAMPLE=http://example.com/madison.cgi
+#
+# Default URL to use if none is specified on the command line.
+# RMADISON_DEFAULT_URL=debian
 
 ##### svnpath
 # 

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2009-04-15 21:06:21 UTC (rev 1857)
+++ trunk/debian/changelog      2009-04-15 21:19:54 UTC (rev 1858)
@@ -1,6 +1,8 @@
 devscripts (2.10.49) UNRELEASED; urgency=low
 
   * debchange: Use == for numeric comparison, not eq.
+  * rmadison: Allow a default URL to be specified in the configuration file.
+    Thanks, Roland Mas.  (Closes: #524198)
 
  -- Adam D. Barratt <[email protected]>  Sun, 12 Apr 2009 16:20:10 +0100
 

Modified: trunk/debian/postinst
===================================================================
--- trunk/debian/postinst       2009-04-15 21:06:21 UTC (rev 1857)
+++ trunk/debian/postinst       2009-04-15 21:19:54 UTC (rev 1858)
@@ -667,6 +667,16 @@
 
 EOF
        fi
+
+       if dpkg --compare-versions "$2" lt 2.10.49
+       then
+           cat >> /etc/devscripts.conf << EOF
+#### rmadison option added in 2.10.49
+#
+# Default URL to use if none is specified on the command line.
+# RMADISON_DEFAULT_URL=debian
+EOF
+       fi
     fi
 fi
 

Modified: trunk/scripts/rmadison.pl
===================================================================
--- trunk/scripts/rmadison.pl   2009-04-15 21:06:21 UTC (rev 1857)
+++ trunk/scripts/rmadison.pl   2009-04-15 21:19:54 UTC (rev 1858)
@@ -75,6 +75,7 @@
     'debug' => "http://debug.debian.net/cgi-bin/madison.cgi";,
     'ubuntu' => "http://people.ubuntu.com/~ubuntu-archive/madison.cgi";,
 );
+my $default_url = "debian";
 
 if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
     shift;
@@ -95,9 +96,12 @@
     my $shell_out = `/bin/bash -c '$shell_cmd'`;
     @config_vars = split /\n/, $shell_out, -1;
 
-   foreach my $envvar (@config_vars) {
-       $envvar =~ /^RMADISON_URL_MAP_([^=]*)=(.*)$/ or next;
-       $url_map{lc($1)}=$2;
+    foreach my $envvar (@config_vars) {
+       if ($envvar =~ /^RMADISON_URL_MAP_([^=]*)=(.*)$/) {
+           $url_map{lc($1)}=$2;
+       } elsif ($envvar =~ /^RMADISON_DEFAULT_URL=(.*)$/) {
+           $default_url=$1;
+       }
     }
 }
 
@@ -161,7 +165,7 @@
 push @args, "S" if $params->{'source-and-binary'};
 push @args, "t" if $params->{'time'};
 
-my $url = $params->{'url'} ? $params->{'url'} : "debian";
+my $url = $params->{'url'} ? $params->{'url'} : $default_url;
 my @url = split /,/, $url;
 
 foreach my $url (@url) {
@@ -276,6 +280,10 @@
 Multiple shorthand entries may be specified by using multiple
 B<RMADISON_URL_MAP_*> variables.
 
+=item B<RMADISON_DEFAULT_URL>=I<URL>
+
+Set the default URL to use unless overridden by a command line option.
+
 =back
 
 =head1 NOTES



-- 
To unsubscribe, send mail to [email protected].

Reply via email to