The following commit has been merged in the master branch:
commit 9866c4bafdf147ad764f31e2747f5c1012802b1d
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date:   Mon Jun 9 19:42:28 2008 +0200

    dpkg-buildpackage: use space as separator in DEB_BUILD_OPTIONS
    
    * scripts/Dpkg/BuildOptions.pm (parse, set): Use space as the
    official separator in DEB_BUILD_OPTIONS. Check for validity of
    flags and print a warning if a bad option is detected. Rewrote
    the logic of set() to avoid adding options twice in non-overwrite
    mode.

diff --git a/ChangeLog b/ChangeLog
index 7dbade8..6a692a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2008-06-09  Guillem Jover  <[EMAIL PROTECTED]>
 
+       * scripts/Dpkg/BuildOptions.pm (parse, set): Use space as the
+       official separator in DEB_BUILD_OPTIONS. Check for validity of
+       flags and print a warning if a bad option is detected. Rewrote
+       the logic of set() to avoid adding options twice in non-overwrite
+       mode.
+
+2008-06-09  Guillem Jover  <[EMAIL PROTECTED]>
+
        * scripts/Dpkg/Source/Package.pm ($diff_ignore_default_regexp): Add
        '.hgignore'.
        (@tar_ignore_default_pattern): Likewise.
diff --git a/debian/changelog b/debian/changelog
index cc6233e..aeb3a53 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -33,6 +33,9 @@ dpkg (1.15.0) UNRELEASED; urgency=low
     Thanks to Daniel Hahler for the patch. Closes: #457135
   * dpkg-gencontrol can now again read the control file from its standard
     input with "-c-". Closes: #465340
+  * Modified Dpkg::BuildOptions to recognize and use spaces as separator
+    in DEB_BUILD_OPTIONS (in order to conform with the Debian policy
+    ruling estasblished in #430649).
 
   [ Pierre Habouzit ]
   * Add a --query option to update-alternatives. Closes: #336091, #441904
diff --git a/scripts/Dpkg/BuildOptions.pm b/scripts/Dpkg/BuildOptions.pm
index 1068248..cdb9c65 100644
--- a/scripts/Dpkg/BuildOptions.pm
+++ b/scripts/Dpkg/BuildOptions.pm
@@ -12,16 +12,16 @@ sub parse {
 
     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*))?$/) {
+            warning(_g("invalid flag in DEB_BUILD_OPTIONS: %s"), $_);
+            next;
+        }
 
        my ($k, $v) = ($1, $3 || '');
 
        # Sanity checks
-       if (!$k) {
-           next;
-       } elsif ($k =~ /^(noopt|nostrip|nocheck)$/ && length($v)) {
+       if ($k =~ /^(noopt|nostrip|nocheck)$/ && length($v)) {
            $v = '';
        } elsif ($k eq 'parallel' && $v !~ /^-?\d+$/) {
            next;
@@ -37,18 +37,15 @@ sub set {
     my ($opts, $overwrite) = @_;
     $overwrite = 1 if not defined($overwrite);
 
-    my $env = $overwrite ? '' : $ENV{DEB_BUILD_OPTIONS}||'';
-    if ($env) { $env .= ',' }
-
+    my $new = {};
+    $new = parse() 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;
 }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to