The following commit has been merged in the master branch:
commit 12c75eb567675b6498b333a416929431c55a558a
Author: Raphael Hertzog <[email protected]>
Date: Mon May 18 22:10:05 2009 +0200
Fix changelog parsing code to differentiate the empty string from 0
In many places, the code tested for a false version instead of
an empty version string. Fixing all those enabled dpkg-buildpackage -v0 to
work as expected.
diff --git a/debian/changelog b/debian/changelog
index f95524d..33952bb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -85,6 +85,8 @@ dpkg (1.15.1) UNRELEASED; urgency=low
saying that it's not advised. Closes: #304404
* Let dpkg-buildpackage error out with subprocerr() when dpkg-checkbuilddeps
is interrupted/killed by a signal. Closes: #498734
+ * Fix dpkg-buildpackage/dpkg-genchanges to properly interpret option -v0.
+ Closes: #475916
[ Guillem Jover ]
* Fix typo in dpkg output (‘unexecpted’ → ‘unexpected’). Closes: #519082
diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm
index ee2a9fc..e44ab0a 100644
--- a/scripts/Dpkg/Changelog.pm
+++ b/scripts/Dpkg/Changelog.pm
@@ -225,23 +225,25 @@ sub data {
sub __sanity_check_range {
my ( $data, $from, $to, $since, $until, $start, $end ) = @_;
- if (($$start || $$end) && ($$from || $$since || $$to || $$until)) {
+ if (($$start || $$end) &&
+ (length($$from) || length($$since) || length($$to) || length($$until)))
+ {
warning(_g( "you can't combine 'count' or 'offset' with any other range
option" ));
$$from = $$since = $$to = $$until = '';
}
- if ($$from && $$since) {
+ if (length($$from) && length($$since)) {
warning(_g( "you can only specify one of 'from' and 'since', using
'since'" ));
$$from = '';
}
- if ($$to && $$until) {
+ if (length($$to) && length($$until)) {
warning(_g( "you can only specify one of 'to' and 'until', using
'until'" ));
$$to = '';
}
- if ($$since && ($data->[0]{Version} eq $$since)) {
+ if (length($$since) && ($data->[0]{Version} eq $$since)) {
warning(_g( "'since' option specifies most recent version, ignoring" ));
$$since = '';
}
- if ($$until && ($data->[$#{$data}]{Version} eq $$until)) {
+ if (length($$until) && ($data->[$#{$data}]{Version} eq $$until)) {
warning(_g( "'until' option specifies oldest version, ignoring" ));
$$until = '';
}
@@ -261,12 +263,13 @@ sub _data_range {
return [ @$data ] if $config->{all};
- my $since = $config->{since} || '';
- my $until = $config->{until} || '';
- my $from = $config->{from} || '';
- my $to = $config->{to} || '';
- my $count = $config->{count} || 0;
- my $offset = $config->{offset} || 0;
+ my ($since, $until, $from, $to, $count, $offset) = ('', '', '', '', 0, 0);
+ $since = $config->{since} if defined($config->{since});
+ $until = $config->{until} if defined($config->{until});
+ $from = $config->{from} if defined($config->{from});
+ $to = $config->{to} if defined($config->{to});
+ $count = $config->{count} if defined($config->{count});
+ $offset = $config->{offset} if defined($config->{offset});
return if $offset and not $count;
if ($offset > 0) {
@@ -285,7 +288,9 @@ sub _data_range {
\$start, \$end );
- unless ($from or $to or $since or $until or $start or $end) {
+ unless (length($from) or length($to) or length($since) or length($until)
+ or $start or $end)
+ {
return [ @$data ] if $config->{default_all} and not $count;
return [ $data->[0] ];
}
@@ -295,7 +300,7 @@ sub _data_range {
my @result;
my $include = 1;
- $include = 0 if $to or $until;
+ $include = 0 if length($to) or length($until);
foreach (@$data) {
my $v = $_->{Version};
$include = 1 if $v eq $to;
@@ -321,12 +326,13 @@ sub _abort_early {
return if $config->{all};
- my $since = $config->{since} || '';
- my $until = $config->{until} || '';
- my $from = $config->{from} || '';
- my $to = $config->{to} || '';
- my $count = $config->{count} || 0;
- my $offset = $config->{offset} || 0;
+ my ($since, $until, $from, $to, $count, $offset) = ('', '', '', '', 0, 0);
+ $since = $config->{since} if defined($config->{since});
+ $until = $config->{until} if defined($config->{until});
+ $from = $config->{from} if defined($config->{from});
+ $to = $config->{to} if defined($config->{to});
+ $count = $config->{count} if defined($config->{count});
+ $offset = $config->{offset} if defined($config->{offset});
return if $offset and not $count;
return if $offset < 0 or $count < 0;
@@ -336,7 +342,9 @@ sub _abort_early {
my $start = my $end = $offset;
$end += $count-1 if $count > 0;
- unless ($from or $to or $since or $until or $start or $end) {
+ unless (length($from) or length($to) or length($since) or length($until)
+ or $start or $end)
+ {
return if not $count;
return 1 if @$data;
}
@@ -344,7 +352,7 @@ sub _abort_early {
return 1 if ($start or $end)
and $start < @$data and $end < @$data;
- return unless $since or $from;
+ return unless length($since) or length($from);
foreach (@$data) {
my $v = $_->{Version};
diff --git a/scripts/changelog/debian.pl b/scripts/changelog/debian.pl
index caa0e74..cedcb7b 100755
--- a/scripts/changelog/debian.pl
+++ b/scripts/changelog/debian.pl
@@ -103,8 +103,10 @@ my $changes = Dpkg::Changelog::Debian->init();
$file ||= $default_file;
$label ||= $file;
-unless ($since or $until or $from or $to or
- $offset or $count or $all) {
+unless (defined($since) or defined($until) or defined($from) or
+ defined($to) or defined($offset) or defined($count) or
+ defined($all))
+{
$count = 1;
}
my @all = $all ? ( all => $all ) : ();
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index e5638a4..ba751b3 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -410,10 +410,10 @@ if ($binaryonly) { push @change_opts, $binaryonly }
if ($sourceonly) { push @change_opts, $sourceonly }
if ($sourcestyle) { push @change_opts, $sourcestyle }
-if ($maint) { push @change_opts, "-m$maint" }
-if ($changedby) { push @change_opts, "-e$changedby" }
-if ($since) { push @change_opts, "-v$since" }
-if ($desc) { push @change_opts, "-C$desc" }
+if (defined($maint)) { push @change_opts, "-m$maint" }
+if (defined($changedby)) { push @change_opts, "-e$changedby" }
+if (defined($since)) { push @change_opts, "-v$since" }
+if (defined($desc)) { push @change_opts, "-C$desc" }
my $chg = "../$pva.changes";
print STDERR " dpkg-genchanges @change_opts >$chg\n";
diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index 77f0434..f3af7a4 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -191,7 +191,7 @@ while (@ARGV) {
# Retrieve info from the current changelog entry
my %options = (file => $changelogfile);
$options{"changelogformat"} = $changelogformat if $changelogformat;
-$options{"since"} = $since if $since;
+$options{"since"} = $since if defined($since);
my $changelog = parse_changelog(%options);
# Change options to retrieve info of the former changelog entry
delete $options{"since"};
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]