|
|
f7e624 |
From d4b0f5dd2665dfe0124623379bfb6ce233cdd075 Mon Sep 17 00:00:00 2001
|
|
|
f7e624 |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
f7e624 |
Date: Mon, 6 May 2019 15:22:32 +0200
|
|
|
f7e624 |
Subject: [PATCH] Fix Perl version lookup with Module::CoreList
|
|
|
f7e624 |
MIME-Version: 1.0
|
|
|
f7e624 |
Content-Type: text/plain; charset=UTF-8
|
|
|
f7e624 |
Content-Transfer-Encoding: 8bit
|
|
|
f7e624 |
|
|
|
f7e624 |
If a distribution declares a dependency on '5.010' Perl,
|
|
|
f7e624 |
inc::Module::Install dies in
|
|
|
f7e624 |
Module::Install::Admin::ScanDeps::scan_dependencies() with:
|
|
|
f7e624 |
|
|
|
f7e624 |
Module::CoreList has no information on perl 5.010 at /usr/lib/perl5/ site_perl/5.10.1/Module/Install/Admin/ScanDeps.pm line 25.
|
|
|
f7e624 |
|
|
|
f7e624 |
This is because %Module::CoreList::version is indiced only with some
|
|
|
f7e624 |
arbitrary versions and normalized numeral versions only. E.g. it
|
|
|
f7e624 |
contains an entry for 5.005, 5.005000 and 5.010000 but no entry of 5.010.
|
|
|
f7e624 |
|
|
|
f7e624 |
This patch fixes the lookup by converting a version string into
|
|
|
f7e624 |
a numeral.
|
|
|
f7e624 |
|
|
|
f7e624 |
https://rt.cpan.org/Public/Bug/Display.html?id=71565
|
|
|
f7e624 |
https://github.com/Perl-Toolchain-Gang/Module-Install/pull/47
|
|
|
f7e624 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
f7e624 |
---
|
|
|
f7e624 |
lib/Module/Install/Admin/ScanDeps.pm | 1 +
|
|
|
f7e624 |
t/35_perl_version.t | 23 +++++++++++++++++++++++
|
|
|
f7e624 |
2 files changed, 24 insertions(+)
|
|
|
f7e624 |
create mode 100644 t/35_perl_version.t
|
|
|
f7e624 |
|
|
|
f7e624 |
diff --git a/lib/Module/Install/Admin/ScanDeps.pm b/lib/Module/Install/Admin/ScanDeps.pm
|
|
|
f7e624 |
index a75ba6e..9cee31e 100644
|
|
|
f7e624 |
--- a/lib/Module/Install/Admin/ScanDeps.pm
|
|
|
f7e624 |
+++ b/lib/Module/Install/Admin/ScanDeps.pm
|
|
|
f7e624 |
@@ -18,6 +18,7 @@ Please first specify a required perl version, like this:
|
|
|
f7e624 |
perl_version('5.005');
|
|
|
f7e624 |
END_MESSAGE
|
|
|
f7e624 |
$perl_version =~ s{^(\d+)\.(\d+)\.(\d+)}{$1 + $2/1_000 + $3/1_000_000}e;
|
|
|
f7e624 |
+ $perl_version = 0 + $perl_version;
|
|
|
f7e624 |
|
|
|
f7e624 |
require Module::ScanDeps;
|
|
|
f7e624 |
require Module::CoreList;
|
|
|
f7e624 |
diff --git a/t/35_perl_version.t b/t/35_perl_version.t
|
|
|
f7e624 |
new file mode 100644
|
|
|
f7e624 |
index 0000000..888b8c0
|
|
|
f7e624 |
--- /dev/null
|
|
|
f7e624 |
+++ b/t/35_perl_version.t
|
|
|
f7e624 |
@@ -0,0 +1,23 @@
|
|
|
f7e624 |
+use strict;
|
|
|
f7e624 |
+BEGIN {
|
|
|
f7e624 |
+ $| = 1;
|
|
|
f7e624 |
+ $^W = 1;
|
|
|
f7e624 |
+}
|
|
|
f7e624 |
+use Test::More;
|
|
|
f7e624 |
+
|
|
|
f7e624 |
+my @existing_versions = ( qw(5.005 5.01 5.010 5.0100 5.01000 5.010000 5.10.0
|
|
|
f7e624 |
+ 5.010.000) );
|
|
|
f7e624 |
+my @missing_versions = ( qw(5.005002 5.5.2) );
|
|
|
f7e624 |
+plan tests => 1 + @existing_versions + @missing_versions;
|
|
|
f7e624 |
+
|
|
|
f7e624 |
+require_ok( 'Module::Install::Admin::ScanDeps' );
|
|
|
f7e624 |
+my $m = Module::Install::Admin::ScanDeps->new;
|
|
|
f7e624 |
+
|
|
|
f7e624 |
+for my $version (@existing_versions) {
|
|
|
f7e624 |
+ eval { $m->scan_dependencies(q{Carp}, $version, q{0}) };
|
|
|
f7e624 |
+ ok(!$@, "scan_dependencies() can query core modules for $version Perl");
|
|
|
f7e624 |
+}
|
|
|
f7e624 |
+for my $version (@missing_versions) {
|
|
|
f7e624 |
+ eval { $m->scan_dependencies(q{Carp}, $version, q{0}) };
|
|
|
f7e624 |
+ ok($@, "scan_dependencies() cannot query core modules for $version Perl");
|
|
|
f7e624 |
+}
|
|
|
f7e624 |
--
|
|
|
f7e624 |
2.20.1
|
|
|
f7e624 |
|