+2008-06-09 Guillem Jover <guillem@debian.org>
+
+ * 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 <guillem@debian.org>
* scripts/Dpkg/Source/Package.pm ($diff_ignore_default_regexp): Add
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
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;
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;
}