Author: adam-guest
Date: 2008-06-25 19:31:11 +0000 (Wed, 25 Jun 2008)
New Revision: 1529

Modified:
   trunk/debian/changelog
   trunk/scripts/debuild.pl
Log:
debuild: Update the dpkg-buildpackage emulation to use whitespace as the
separator in DEB_BUILD_OPTIONS as per Debian Policy 3.8.0 and to print a
warning if an unrecognised option is encountered; based on the
corresponding patch to Dpkg::BuildOptions

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-06-25 17:11:48 UTC (rev 1528)
+++ trunk/debian/changelog      2008-06-25 19:31:11 UTC (rev 1529)
@@ -18,6 +18,10 @@
     environment (Closes: #487592)
   * debchange, nmudiff: Replace calls to date -R with strftime(). Thanks
     Stephen Gran (Closes: #486594)
+  * debuild: Update the dpkg-buildpackage emulation to use whitespace as the
+    separator in DEB_BUILD_OPTIONS as per Debian Policy 3.8.0 and to print a
+    warning if an unrecognised option is encountered; based on the
+    corresponding patch to Dpkg::BuildOptions
   * licensecheck:
     + Add .cxx and .hxx to the default list of file extensions to check
       (Closes: #487384)

Modified: trunk/scripts/debuild.pl
===================================================================
--- trunk/scripts/debuild.pl    2008-06-25 17:11:48 UTC (rev 1528)
+++ trunk/scripts/debuild.pl    2008-06-25 19:31:11 UTC (rev 1529)
@@ -1371,22 +1371,22 @@
 
     my %opts;
 
-    foreach (split(/[\s,]+/, $env)) {
-        # FIXME: This is pending resolution of Debian bug #430649
-        /^([a-z][a-z0-9_-]*)(=(\w*))?$/;
+    foreach (split(/\s+/, $env)) {
+       unless (/^([a-z][a-z0-9_-]*)(=(\S*))?$/) {
+           warn("$progname: invalid flag in DEB_BUILD_OPTIONS: $_\n");
+           next;
+       }
 
         my ($k, $v) = ($1, $3 || '');
 
         # Sanity checks
-        if (!$k) {
-            next;
-        } elsif ($k =~ /^(noopt|nostrip|nocheck)$/ && length($v)) {
-            $v = '';
-        } elsif ($k eq 'parallel' && $v !~ /^-?\d+$/) {
-            next;
-        }
+       if ($k =~ /^(noopt|nostrip|nocheck)$/ && length($v)) {
+           $v = '';
+       } elsif ($k eq 'parallel' && $v !~ /^-?\d+$/) {
+           next;
+       }
 
-        $opts{$k} = $v;
+       $opts{$k} = $v;
     }
 
     return \%opts;
@@ -1396,17 +1396,15 @@
     my ($opts, $overwrite) = @_;
     $overwrite = 1 if not defined($overwrite);
 
-    my $env = $overwrite ? '' : $ENV{DEB_BUILD_OPTIONS}||'';
-    if ($env) { $env .= ',' }
+    my $new = {};
+    $new = parsebuildopts() unless $overwrite;
 
     while (my ($k, $v) = each %$opts) {
-        if ($v) {
-            $env .= "$k=$v,";
-        } else {
-            $env .= "$k,";
-        }
+       $new->{$k} = $v;
     }
 
-    $ENV{DEB_BUILD_OPTIONS} = $env if $env;
+    my $env = join(" ", map { $new->{$_} ? $_ . "=" . $new->{$_} : $_ } keys 
%$new);
+
+    $ENV{DEB_BUILD_OPTIONS} = $env;
     return $env;
 }



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

Reply via email to