[dh-make-perl] 01/02: DhMakePerl::Utils: when checking for core modules, look at current perl.
gregor herrmann
gregoa at debian.org
Fri May 20 15:08:40 UTC 2016
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to branch master
in repository dh-make-perl.
commit 2ae7c932c8767fd4cd8f608c41e1b1f5a573d49b
Author: gregor herrmann <gregoa at debian.org>
Date: Fri May 20 16:56:58 2016 +0200
DhMakePerl::Utils: when checking for core modules, look at current perl.
Various helpers which check if a module is in Perl core or starting from
which version only looked at the first Perl version. This ignored cases
where a package was removed from core at some point.
Change those methods to return if a module is not currently in Perl core.
Thanks: Peter Valdemar Mørch for the bug report.
Closes: #788198
---
lib/DhMakePerl/Utils.pm | 10 ++++++++--
t/corelist.t | 6 ++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/lib/DhMakePerl/Utils.pm b/lib/DhMakePerl/Utils.pm
index 144b615..35b8c56 100644
--- a/lib/DhMakePerl/Utils.pm
+++ b/lib/DhMakePerl/Utils.pm
@@ -120,13 +120,16 @@ sub find_cpan_distribution {
Returns the version of the C<perl> package containing the given I<module> (at
least version I<version>).
-Returns C<undef> if I<module> is not a core module.
+Returns C<undef> if I<module> is not a core module (anymore) in the current
+C<perl> release.
=cut
sub is_core_module {
my ( $module, $ver ) = @_;
+ return unless Module::CoreList->is_core($module, $ver); # currently in core?
+
my $v = Module::CoreList->first_release($module, $ver); # 5.009002
return unless defined $v;
@@ -205,7 +208,8 @@ sub core_module_perls {
=item find_core_perl_dependency( $module[, $version] )
return a dependency on perl containing the required module version. If the
-module is not available in any perl released by Debian, return undef.
+module is not available in any perl released by Debian, , or if it is not in
+the current perl anymore, return undef.
=cut
@@ -229,6 +233,8 @@ sub find_core_perl_dependency {
return Debian::Dependency->new( 'perl', nice_perl_ver($version) );
}
+ return undef unless is_core_module($module, $version); # currently in core?
+
my $perl_dep;
my @perl_releases = core_module_perls( $module, $version );
diff --git a/t/corelist.t b/t/corelist.t
index 1e63bb0..584e429 100755
--- a/t/corelist.t
+++ b/t/corelist.t
@@ -11,8 +11,10 @@ use File::Find::Rule;
# Check to see if our module list contains some obvious candidates.
-foreach my $module ( qw(Fatal File::Copy FindBin CGI IO::Handle Safe) ) {
+foreach my $module ( qw(Fatal File::Copy FindBin IO::Handle Safe) ) {
ok(is_core_module($module), "$module should be a core module");
}
-ok( !is_core_module('Foo::Bar'), 'Foo::Bar is not a core module' );
+foreach my $module ( qw(CGI Foo::Bar) ) {
+ ok( !is_core_module($module), "$module is not a core module" );
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/dh-make-perl.git
More information about the Pkg-perl-cvs-commits
mailing list