Subject: | Modules with multiple packages don't get indexed properly |
The dist file Version-Requirements-0.101020.tar.gz contains the module file
Version/Requirements.pm, which contains multiple package declarations. This would not be a
problem
except that the author is setting a VERSION for each package like so:
package Version::Requirements;
BEGIN {
Version::Requirements::VERSION = '0.101020';
}
# code...
package Version::Requirements::_Range::Exact;
$Version::Requirements::_Range::Exact;
BEGIN {
$Version::Requirements::_Range::Exact::VERSION = '0.101020';
}
# code...
package
$Version::Requirements::_Range::Range;
BEGIN {
$Version::Requirements::_Range::Range::VERSION = '0.101020';
}
# code...
Only the last one found ends up in the 02packages.details.txt file.
This means that the CPAN client using the local cpan indexes can't find
Version::Requirements, and so
the installation of several other modules fails.
However, this is easily fixed with the included patch. I've even included tests. I made the
patches with git, but they should apply with a patch -p1
In case the first one (containing the test-dist tarball) doesn't apply, I've also attached it.
Subject: | 0002-Added-test-for-multi-package-issue.patch |
From f25d2ac5a72363556f1e104c3434c0b93dccfc8c Mon Sep 17 00:00:00 2001
From: "Stephen R. Scaffidi" <sscaffid@akamai.com>
Date: Thu, 2 Jun 2011 16:59:40 -0400
Subject: [PATCH 2/3] Added test for multi-package issue
---
t/10index.t | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/t/10index.t b/t/10index.t
index 7301842..b6662c8 100644
--- a/t/10index.t
+++ b/t/10index.t
@@ -5,12 +5,13 @@ $^W = 0;
use strict;
use warnings;
use FindBin qw($Bin);
-use Test::More tests => 53;
+use Test::More tests => 60;
use_ok('CPAN::Site::Index');
test_inspect_archive_for_distro_with_strange_data();
test_inspect_archive_for_distro_with_packages_that_should_not_be_registered();
+test_inspect_archive_for_distro_with_module_with_multiple_packages();
exit;
@@ -55,6 +56,16 @@ sub test_inspect_archive_for_distro_with_packages_that_should_not_be_registered
_test_inspect_archive_for_distro( $distro_to_test, \%want_packages );
}
+sub test_inspect_archive_for_distro_with_module_with_multiple_packages {
+ my $distro_to_test = 'Distro-With-Multi-Package-Module.tar.gz';
+ my %want_packages = (
+ 'Module::MultiPackage' => '0.01',
+ 'Module::MultiPackage::SubPackageOne' => '0.011',
+ 'Module::MultiPackage::SubPackageTwo' => '0.012',
+ );
+ _test_inspect_archive_for_distro( $distro_to_test, \%want_packages );
+}
+
sub _test_inspect_archive_for_distro {
my $distro = shift;
my $want_packages = shift;
--
1.7.5.2
Subject: | 0001-Test-dist-for-multi-package-issue.patch |
From 25764b8ab3c5e6a3b53e5e855dbfcb632184683e Mon Sep 17 00:00:00 2001
From: "Stephen R. Scaffidi" <sscaffid@akamai.com>
Date: Thu, 2 Jun 2011 16:59:15 -0400
Subject: [PATCH 1/3] Test dist for multi-package issue
---
.../Distro-With-Multi-Package-Module.tar.gz | Bin 0 -> 458 bytes
1 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 t/test_data/Distro-With-Multi-Package-Module.tar.gz
diff --git a/t/test_data/Distro-With-Multi-Package-Module.tar.gz b/t/test_data/Distro-With-Multi-Package-Module.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..fc750238f7211cb9db947b1a4dc89d90cc2f96a6
GIT binary patch
literal 458
zcmV;*0X6;~iwFR~@#jqd1MQSePr^VDhB^0FOo9m~aJQvxQsO~{7!Cqaqvz5tbYp2r
zcN-4I|L#=FhXDeJVvO^o>1;YXyYKEhX<I6trS&JNqxx+gYgr%o!LvUW_1iSeV{u+N
z9>$n!+fc!`Wx5y{=N2pC0^r<sx$EHL0OKw*oeJ3Bu=h@KrTq-0C>8jlkqp1OPI-<+
z{3En?`5(*Su|2TA|LD7A7yjFhMgE_Hz5GA&S8$O3jtR`<j5G586ddCJd%jFJrjxz*
z!258T&8_}(hRM1A+-jo#mdkks*bkn2!9VxE3J;M~Fp{wVjJXma$OLpG;CgV`^Spbh
z1!$o(s2qn4W3?hk6Ya}H!K7%7DSnxLv<HMDi2cmhGR5pHl0k%pDoXP>1V4^pC?FGK
zY(9~R5EnJ(g&)1<d8^IVGOju|-5$Ic0B4&fc-~{@?!Mda!3ES<gYjC+cr}b-eihGx
za_7sJ5^(!ShM`DsMw!A9Y}_61ARm_Feu83f=2FjAMW2e+1QrSbUY9CWI@h+U_dt0M
zv$S=nI;>e!XD-$8mhsy?N)QA=5ClOG1VIo4K@bE%5ClOG1VQZP4fh@GApj@<0R8>m
A#Q*>R
literal 0
HcmV?d00001
--
1.7.5.2
Subject: | 0003-Fix-for-multi-package-issue.patch |
From 9fb4acfb0eaf7fa37fee6bf3fd70da44a416e7c6 Mon Sep 17 00:00:00 2001
From: "Stephen R. Scaffidi" <sscaffid@akamai.com>
Date: Thu, 2 Jun 2011 16:59:59 -0400
Subject: [PATCH 3/3] Fix for multi-package issue
---
lib/CPAN/Site/Index.pm | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/CPAN/Site/Index.pm b/lib/CPAN/Site/Index.pm
index 1abda68..3576ac0 100644
--- a/lib/CPAN/Site/Index.pm
+++ b/lib/CPAN/Site/Index.pm
@@ -250,11 +250,11 @@ sub collect_package_details($$)
trace "pkg $package version $VERSION";
}
}
- }
- $VERSION = $VERSION->numify if ref $VERSION;
- register $package, $VERSION, $dist
- if defined $package;
+ $VERSION = $VERSION->numify if ref $VERSION;
+ register $package, $VERSION, $dist
+ if defined $package;
+ }
}
sub update_global_cpan($$)
--
1.7.5.2
Subject: | Distro-With-Multi-Package-Module.tar.gz |
Message body not shown because it is not plain text.