Package: dh-make-perl Version: 0.92 Severity: normal Tags: patch Dear Maintainer,
Upstream developers sometimes upload Perl modules to CPAN, forgetting to update the version in the META, Build or Makefile. In these situations, dh-make-perl ignores the CPAN version and trusts the META.yml version, without making the packager aware of the discrepancy. Examples of upstream modules where this has happened are Cache::Memcached::libmemcached and Catalyst::View::CSV. The attached patch causes dh-make-perl to quit if the module version does not match the CPAN version, and requires the user to explicity specify the version with --version. This reduces the likelihood of the packager uploading a package with a version number which does not correspond to the actual upstream version. Thanks. Christopher Hoskin
>From 71938776dbb0b3ab7d6f35c009ee675655449639 Mon Sep 17 00:00:00 2001 From: Christopher Hoskin <christopher.hos...@gmail.com> Date: Fri, 16 Dec 2016 11:12:47 +0000 Subject: [PATCH] Require user intervention to resolve version ambiguity --- lib/DhMakePerl/Command/Packaging.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/DhMakePerl/Command/Packaging.pm b/lib/DhMakePerl/Command/Packaging.pm index 2b07ac4..d759b66 100644 --- a/lib/DhMakePerl/Command/Packaging.pm +++ b/lib/DhMakePerl/Command/Packaging.pm @@ -356,8 +356,14 @@ sub extract_name_ver { $ver = $self->version; } - $ver = $self->cfg->version - if $self->cfg->version; + if ($self->cfg->version) { + #Version specified on command line trumps other versions + $ver = $self->cfg->version + } elsif ( $self->mod_cpan_version ) { + if ($self->mod_cpan_version != $ver) { + die "Version ambiguity, cpan has ".$self->mod_cpan_version.", module has ".$ver.". Please specify version with --version.\n"; + } + } # final sanitazing of name and version $name =~ s/::/-/g if defined $name; -- 2.10.2