[libmodule-corelist-perl] 01/03: Added handle-debian-package patch
dod at debian.org
dod at debian.org
Tue Feb 3 12:56:35 UTC 2015
This is an automated email from the git hooks/post-receive script.
dod pushed a commit to branch master
in repository libmodule-corelist-perl.
commit 01effd00a134da0920f001241234eb979319ef06
Author: Dominique Dumont <dod at debian.org>
Date: Mon Feb 2 19:32:26 2015 +0100
Added handle-debian-package patch
---
debian/patches/handle-debian-package-name | 173 ++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 174 insertions(+)
diff --git a/debian/patches/handle-debian-package-name b/debian/patches/handle-debian-package-name
new file mode 100644
index 0000000..cc8794f
--- /dev/null
+++ b/debian/patches/handle-debian-package-name
@@ -0,0 +1,173 @@
+Description: handle debian package name as Perl module name
+ This debian specific patch enable user to enter Debian package name instead of Perl module name.
+Author: dod
+Applied-Upstream: NA
+--- a/lib/Module/CoreList.pm
++++ b/lib/Module/CoreList.pm
+@@ -24,7 +24,8 @@
+ sub first_release_raw {
+ my $module = shift;
+ $module = shift if eval { $module->isa(__PACKAGE__) }
+- and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
++ and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_-]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
++ $module = map_debian($module);
+ my $version = shift;
+
+ my @perls = $version
+@@ -72,7 +73,8 @@
+ sub is_deprecated {
+ my $module = shift;
+ $module = shift if eval { $module->isa(__PACKAGE__) }
+- and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
++ and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_-]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
++ $module = map_debian($module);
+ my $perl_version = shift;
+ $perl_version ||= $];
+ return unless $module && exists $deprecated{$perl_version}{$module};
+@@ -82,7 +84,8 @@
+ sub deprecated_in {
+ my $module = shift;
+ $module = shift if eval { $module->isa(__PACKAGE__) }
+- and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
++ and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_-]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
++ $module = map_debian($module);
+ return unless $module;
+ my @perls = grep { exists $deprecated{$_}{$module} } keys %deprecated;
+ return unless @perls;
+@@ -103,7 +106,9 @@
+ sub removed_raw {
+ my $mod = shift;
+ $mod = shift if eval { $mod->isa(__PACKAGE__) }
+- and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
++ and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_-]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
++ $mod = map_debian($mod);
++
+ return unless my @perls = sort { $a cmp $b } first_release_raw($mod);
+ my $last = pop @perls;
+ my @removed = grep { $_ > $last } sort { $a cmp $b } keys %version;
+@@ -12450,5 +12455,21 @@
+ }
+ }
+
++my %debian_map;
++
++foreach my $v (keys %version) {
++ foreach my $pm ( %{ $version{$v} } ) {
++ next unless defined $pm;
++ my $k = lc($pm);
++ $k =~ s/::/-/g;
++ $debian_map{"lib$k-perl"} = $pm;
++ }
++}
++
++sub map_debian {
++ my $mod = shift;
++ return $debian_map{$mod} // $mod ;
++}
++
+ 1;
+ __END__
+--- a/corelist
++++ b/corelist
+@@ -6,7 +6,7 @@
+
+ =head1 DESCRIPTION
+
+-See L<Module::CoreList> for one.
++See L<Module::CoreList> for one. Including the Debian specific part.
+
+ =head1 SYNOPSIS
+
+@@ -18,6 +18,9 @@
+ corelist --diff PerlVersion PerlVersion
+ corelist --upstream <ModuleName>
+
++ # only on Debian
++ corelist <debian-package-name-perl>
++
+ =head1 OPTIONS
+
+ =over
+@@ -381,7 +384,7 @@
+ }
+
+ sub display_a {
+- my $mod = shift;
++ my $mod = Module::CoreList::map_debian(shift);
+
+ for my $v (grep !/0[01]0$/, sort keys %Module::CoreList::version ) {
+ next unless exists $Module::CoreList::version{$v}{$mod};
+--- a/lib/Module/CoreList.pod
++++ b/lib/Module/CoreList.pod
+@@ -12,6 +12,9 @@
+ print Module::CoreList->first_release_by_date('File::Spec'); # prints 5.005
+ print Module::CoreList->first_release('File::Spec', 0.82); # prints 5.006001
+
++ # Only on Debian
++ print Module::CoreList->first_release('libfile-spec-perl'); # prints 5.00405
++
+ if (Module::CoreList::is_core('File::Spec')) {
+ print "File::Spec is a core module\n";
+ }
+@@ -41,6 +44,17 @@
+ Programmers may also query the contained hash structures to find relevant
+ information.
+
++=head1 Only on Debian
++
++corelist also works using Debian package name instead of Perl module
++name. For instance, using C<libmodule-build-perl> or C<Module::Build>
++will yield the same results.
++
++Note that the Debian specific part does not check whether the Debian
++package name actually exists. I.e. using C<libconfig-perl> will yield
++the same result as using C<Config> even though the C<libconfig-perl>
++Debian package does not exist.
++
+ =head1 FUNCTIONS API
+
+ These are the functions that are available, they may either be called as functions or class methods:
+--- /dev/null
++++ b/t/debian-package.t
+@@ -0,0 +1,41 @@
++#!perl -w
++use strict;
++use Module::CoreList;
++use Test::More tests => 12;
++
++BEGIN { require_ok('Module::CoreList'); }
++
++is(Module::CoreList->first_release_by_date('libfile-spec-perl'), 5.005,
++ "File::Spec was first bundled in 5.005");
++
++is(Module::CoreList->first_release('libfile-spec-perl'), 5.00405,
++ "File::Spec was released in perl with lowest version number 5.00405");
++
++is(Module::CoreList->first_release('libfile-spec-perl', 0.82), 5.006_001,
++ "File::Spec reached 0.82 with 5.006_001");
++
++is(Module::CoreList::first_release_by_date('libfile-spec-perl'), 5.005,
++ "File::Spec was first bundled in 5.005");
++
++is(Module::CoreList::first_release('libfile-spec-perl'), 5.00405,
++ "File::Spec was released in perl with lowest version number 5.00405");
++
++is(Module::CoreList::first_release('libfile-spec-perl', 0.82), 5.006_001,
++ "File::Spec reached 0.82 with 5.006_001");
++
++is(Module::CoreList::first_release('Module::Build'), 5.009004,
++ "Module::Build first release with 5.009004");
++
++is(Module::CoreList::first_release('libmodule-build-perl'), 5.009004,
++ "Module::Build reached 0.3603 with 5.009004");
++
++is(Module::CoreList::first_release('libmodule-build-perl', 0.4003), 5.017_003,
++ "Module::Build reached 0.4003 with 5.017_003");
++
++ok(! Module::CoreList::is_deprecated('libswitch-perl', 5.010000),
++ "libswitch-perl not deprecated in 5.010000 (function w/ perl version)"
++);
++
++is(Module::CoreList::deprecated_in('libswitch-perl'), 5.011000,
++ "libswitch-perl was deprecated in 5.011000 (deprecated_in)"
++);
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..6e2f256
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+handle-debian-package-name
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmodule-corelist-perl.git
More information about the Pkg-perl-cvs-commits
mailing list