Author: adam-guest
Date: 2008-02-27 13:56:49 +0000 (Wed, 27 Feb 2008)
New Revision: 1067

Modified:
   trunk/debian/changelog
   trunk/scripts/debuild.1
   trunk/scripts/debuild.pl
Log:
* debuild: Allow preserve-envvars to contain wildcard entries (of the
  form STEM*) (Closes: #405440)


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-02-27 00:14:30 UTC (rev 1066)
+++ trunk/debian/changelog      2008-02-27 13:56:49 UTC (rev 1067)
@@ -61,8 +61,10 @@
     + Allow package versions to be specified in the package list file
       as package_version (Closes: #467581)
   * mergechanges: Merge the Description: fields from each of the supplied
-     changes files. Thanks to Vincent Danjean for the patch
-     (Closes: #442972)
+    changes files. Thanks to Vincent Danjean for the patch
+    (Closes: #442972)
+  * debuild: Allow preserve-envvars to contain wildcard entries (of the
+    form STEM*) (Closes: #405440)
 
   [ Christoph Berg ]
   * dget:

Modified: trunk/scripts/debuild.1
===================================================================
--- trunk/scripts/debuild.1     2008-02-27 00:14:30 UTC (rev 1066)
+++ trunk/scripts/debuild.1     2008-02-27 13:56:49 UTC (rev 1067)
@@ -222,6 +222,10 @@
 .TP
 .BI \-\-preserve\-envvar= "var, " \-e var
 Do not clean the \fIvar\fR variable from the environment.
+.IP
+If \fIvar\fR ends in an asterisk ("*") then all variables with names 
+that match the portion of \fIvar\fR before the asterisk will be 
+preserved.
 .TP
 .BI \-\-set\-envvar= var = "value, " \-e var = value
 Set the environment variable \fIvar\fR to \fIvalue\fR and do not

Modified: trunk/scripts/debuild.pl
===================================================================
--- trunk/scripts/debuild.pl    2008-02-27 00:14:30 UTC (rev 1066)
+++ trunk/scripts/debuild.pl    2008-02-27 13:56:49 UTC (rev 1067)
@@ -311,6 +311,15 @@
     if ($config_vars{'DEBUILD_PRESERVE_ENVVARS'} ne '') {
        my @preserve_vars = split /\s*,\s*/,
            $config_vars{'DEBUILD_PRESERVE_ENVVARS'};
+       foreach my $index (0 .. $#preserve_vars) {
+           my $var = $preserve_vars[$index];
+           if ($var =~ /\*$/) {
+               $var =~ s/([^.])\*$/$1.\*/;
+               my @vars = grep /^$var$/, keys %ENV;
+               push @preserve_vars, @vars;
+               delete $preserve_vars[$index];
+           }
+       }               
        @[EMAIL PROTECTED] = (1) x scalar @preserve_vars;
     }
     $run_lintian = $config_vars{'DEBUILD_LINTIAN'} eq 'no' ? 0 : 1;
@@ -436,10 +445,10 @@
                fatal "-e requires an argument,\nrun $progname --help for usage 
information";
            }
            $savearg .= " $opt";
-           if ($opt =~ /^\w+$/) { $arg = '--preserve-envvar'; }
+           if ($opt =~ /^\w+\*?$/) { $arg = '--preserve-envvar'; }
            else { $arg = '--set-envvar'; }
        }
-       elsif ($arg =~ /^-e(\w+)$/) {
+       elsif ($arg =~ /^-e(\w+\*?)$/) {
            $arg = '--preserve-envvar';
            $opt = $1;
        }
@@ -456,6 +465,10 @@
        if ($arg eq '--preserve-envvar') {
            if ($opt =~ /^\w+$/) {
                $save_vars{$opt}=1;
+           } elsif ($opt =~ /^\w+\*$/) {
+               $opt =~ s/([^.])\*$/$1.\*/;
+               my @vars = grep /^$opt$/, keys %ENV;
+               @[EMAIL PROTECTED] = (1) x scalar @vars;
            } else {
                push @warnings,
                    "Ignoring unrecognised/malformed option: $savearg";



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to