summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2012-10-18 03:55:32 +0200
committerGuillem Jover <guillem@debian.org>2012-10-19 06:00:43 +0200
commit24495ccdaab2b3c12f441e70a5d54de7d8c27150 (patch)
treebbbdc5658bbbc8d7b1ef699de5425ce7fdeefb7a /scripts
parent874775f6262fcb58988ac90e4913cb4b773b5e39 (diff)
downloaddpkg-24495ccdaab2b3c12f441e70a5d54de7d8c27150.tar.gz
Dpkg::Substvars: Always fix up the source version in set_version_substvars
The caller can explicitly pass both versions, but the source version might still need to be fixed up, for example in case of legacy binNMUs (when not using the Binary-Only changelog field), whenever the binary version has been forced through dpkg-gencontrol, then just comparing if they are equal will not trigger the fix up, which will produce bogus source versions, affecting the Source field on binary packages. Instead, always fix up the source version, regardless of the versions matching or not. Regression introduced in commit 094d3a7e61e6fc1f5634d880957d18ed70954a60. Closes: #690823
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Dpkg/Substvars.pm5
-rw-r--r--scripts/t/750_Dpkg_Substvars.t6
2 files changed, 8 insertions, 3 deletions
diff --git a/scripts/Dpkg/Substvars.pm b/scripts/Dpkg/Substvars.pm
index a97a31af5..d01f66320 100644
--- a/scripts/Dpkg/Substvars.pm
+++ b/scripts/Dpkg/Substvars.pm
@@ -195,8 +195,9 @@ sub set_version_substvars {
# Handle old function signature taking only one argument.
$binaryversion ||= $sourceversion;
- # Fallback to manually compute the binary version if they are the same.
- $sourceversion =~ s/\+b[0-9]+$// if $sourceversion eq $binaryversion;
+ # For backwards compatibility on binNMUs that do not use the Binary-Only
+ # field on the changelog, always fix up the source version.
+ $sourceversion =~ s/\+b[0-9]+$//;
$self->{'vars'}{'binary:Version'} = $binaryversion;
$self->{'vars'}{'source:Version'} = $sourceversion;
diff --git a/scripts/t/750_Dpkg_Substvars.t b/scripts/t/750_Dpkg_Substvars.t
index 52d6a05de..04f933444 100644
--- a/scripts/t/750_Dpkg_Substvars.t
+++ b/scripts/t/750_Dpkg_Substvars.t
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-use Test::More tests => 29;
+use Test::More tests => 32;
use strict;
use warnings;
@@ -60,6 +60,10 @@ $s->set_version_substvars("1:2.3.4~5-6.7.8~nmu9", "1:2.3.4~5-6.7.8~nmu9+bin0");
is($s->get("binary:Version"), "1:2.3.4~5-6.7.8~nmu9+bin0", "binary:Version");
is($s->get("source:Version"), "1:2.3.4~5-6.7.8~nmu9", "source:Version");
is($s->get("source:Upstream-Version"), "1:2.3.4~5", "source:Upstream-Version");
+$s->set_version_substvars("2.3.4~5-6.7.8~nmu9+b1", "1:2.3.4~5-6.7.8~nmu9+b1");
+is($s->get("binary:Version"), "1:2.3.4~5-6.7.8~nmu9+b1", "binary:Version");
+is($s->get("source:Version"), "2.3.4~5-6.7.8~nmu9", "source:Version");
+is($s->get("source:Upstream-Version"), "2.3.4~5", "source:Upstream-Version");
$s->set_version_substvars("1:2.3.4~5-6.7.8~nmu9+b0");
is($s->get("binary:Version"), "1:2.3.4~5-6.7.8~nmu9+b0", "binary:Version");
is($s->get("source:Version"), "1:2.3.4~5-6.7.8~nmu9", "source:Version");