The following commit has been merged in the master branch:
commit 2d7f7493c581f413a0586ba5a790f2306bcd655d
Author: Raphaël Hertzog <[email protected]>
Date: Mon Jun 28 08:45:01 2010 +0200
Dpkg::Changelog: fixed to cope properly with an entry of version "0"
The change of the boolean evaluation of Dpkg::Version introduced in
5b9f353b2940de751df47036608afbe71992d622 broke Dpkg::Changelog's ability
to correctly export an entry with a version of "0".
Add a non-regression test for this.
diff --git a/debian/changelog b/debian/changelog
index 0bf4d10..ff780b7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,8 @@ dpkg (1.15.8) UNRELEASED; urgency=low
upstream source code. Closes: #579012
* dpkg-source now captures the output of patch and prints it on error so
that the user can better diagnose what went wrong. Closes: #575304
+ * Fix Dpkg::Changelog to cope properly with an entry of version "0".
+ Add non-regression test for this. Closes: #587382
[ Guillem Jover ]
* Require gettext 0.18:
diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm
index e0d1693..d94761f 100644
--- a/scripts/Dpkg/Changelog.pm
+++ b/scripts/Dpkg/Changelog.pm
@@ -524,7 +524,8 @@ sub dpkg {
my $f = Dpkg::Control::Changelog->new();
$f->{Urgency} = $entry->get_urgency() || "unknown";
$f->{Source} = $entry->get_source() || "unknown";
- $f->{Version} = $entry->get_version() || "unknown";
+ $f->{Version} = $entry->get_version();
+ $f->{Version} = "unknown" unless defined $f->{Version};
$f->{Distribution} = join(" ", $entry->get_distributions());
$f->{Maintainer} = $entry->get_maintainer() || '';
$f->{Date} = $entry->get_timestamp() || '';
@@ -589,7 +590,8 @@ sub rfc822 {
my $f = Dpkg::Control::Changelog->new();
$f->{Urgency} = $entry->get_urgency() || "unknown";
$f->{Source} = $entry->get_source() || "unknown";
- $f->{Version} = $entry->get_version() || "unknown";
+ $f->{Version} = $entry->get_version();
+ $f->{Version} = "unknown" unless defined $f->{Version};
$f->{Distribution} = join(" ", $entry->get_distributions());
$f->{Maintainer} = $entry->get_maintainer() || "";
$f->{Date} = $entry->get_timestamp() || "";
diff --git a/scripts/t/600_Dpkg_Changelog.t b/scripts/t/600_Dpkg_Changelog.t
index 5d3d531..81130a7 100644
--- a/scripts/t/600_Dpkg_Changelog.t
+++ b/scripts/t/600_Dpkg_Changelog.t
@@ -25,6 +25,7 @@ BEGIN {
+ $no_err_examples * 2
+ 26 # countme
+ 13 # fields
+ + 1 # regressions
+ 22;
require Test::More;
@@ -294,6 +295,10 @@ Xb-Userfield2: foobar
", "change items 2");
is($items[5], " * Update S-V.\n", "change items 3");
}
+ if ($file eq "$datadir/regressions") {
+ my $f = $changes->dpkg();
+ is("$f->{Version}", "0", "version 0 correctly parsed");
+ }
SKIP: {
skip("avoid spurious warning with only one entry", 2)
diff --git a/scripts/t/600_Dpkg_Changelog/regressions
b/scripts/t/600_Dpkg_Changelog/regressions
index d010180..4c8ad30 100644
--- a/scripts/t/600_Dpkg_Changelog/regressions
+++ b/scripts/t/600_Dpkg_Changelog/regressions
@@ -1,6 +1,7 @@
-re-gressions++1.2.3 (1.5-1) ALLOWED.chars-567+890; urgency=low
+re-gressions++1.2.3 (0) ALLOWED.chars-567+890; urgency=low
* Test allowed chars in package name and distribution name.
(Closes: #361171)
+ * Test how version 0 is exported through methods.
-- Frank Lichtenheld <[email protected]> Thu, 01 Jan 1970 00:00:00 +0000
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]