- 437817: RFE: Upgrade Module::CoreList to 2.14

This commit is contained in:
Marcela Mašláňová 2008-03-18 11:11:31 +00:00
parent 7d9e37014f
commit eba1424e26
2 changed files with 159 additions and 1 deletions

View File

@ -0,0 +1,150 @@
diff -up perl-5.10.0/lib/Module/CoreList.pm.crr perl-5.10.0/lib/Module/CoreList.pm
--- perl-5.10.0/lib/Module/CoreList.pm.crr 2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/Module/CoreList.pm 2008-03-17 16:15:07.000000000 +0100
@@ -1,7 +1,7 @@
package Module::CoreList;
use strict;
use vars qw/$VERSION %released %patchlevel %version %families/;
-$VERSION = '2.13';
+$VERSION = '2.14';
=head1 NAME
@@ -138,6 +138,11 @@ sub find_modules {
return sort keys %mods
}
+sub find_version {
+ my ($class, $v) = @_;
+ return $version{$v} if defined $version{$v};
+ return undef;
+}
# when things escaped
%released = (
@@ -176,7 +181,7 @@ sub find_modules {
%patchlevel = (
5.005 => [perl => 1647],
5.00503 => ['maint-5.005' => 3198],
- 5.00405 => ['maint-5.004' => 999],
+ 5.00405 => ['maint-5.004' => 3296],
5.006 => [perl => 5899],
5.006001 => ['maint-5.6' => 9654],
5.006002 => ['maint-5.6' => 21727],
diff -up perl-5.10.0/lib/Module/CoreList/t/corelist.t.crr perl-5.10.0/lib/Module/CoreList/t/corelist.t
diff -up perl-5.10.0/lib/Module/CoreList/t/pod.t.crr perl-5.10.0/lib/Module/CoreList/t/pod.t
--- perl-5.10.0/lib/Module/CoreList/t/pod.t.crr 2008-03-18 09:43:20.000000000 +0100
+++ perl-5.10.0/lib/Module/CoreList/t/pod.t 2006-02-01 14:38:29.000000000 +0100
@@ -0,0 +1,10 @@
+#!perl
+
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+
+plan tests => 2;
+
+pod_file_ok( 'lib/Module/CoreList.pm', 'module pod ok' );
+pod_file_ok( 'corelist', 'script pod ok' );
diff -up perl-5.10.0/lib/Module/CoreList/t/find_modules.t.crr perl-5.10.0/lib/Module/CoreList/t/find_modules.t
diff -up perl-5.10.0/lib/Module/CoreList/bin/corelist.crr perl-5.10.0/lib/Module/CoreList/bin/corelist
--- perl-5.10.0/lib/Module/CoreList/bin/corelist.crr 2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/Module/CoreList/bin/corelist 2008-03-17 16:14:59.000000000 +0100
@@ -11,14 +11,14 @@ See L<Module::CoreList> for one.
=head1 SYNOPSIS
corelist -v
- corelist [-a] <ModuleName> | /<ModuleRegex>/ [<ModuleVersion>] ...
+ corelist [-a|-d] <ModuleName> | /<ModuleRegex>/ [<ModuleVersion>] ...
corelist [-v <PerlVersion>] [ <ModuleName> | /<ModuleRegex>/ ] ...
=head1 OPTIONS
=over
-=item -a modulename
+=item -a
lists all versions of the given module (or the matching modules, in case you
used a module regexp) in the perls Module::CoreList knows about.
@@ -44,6 +44,11 @@ used a module regexp) in the perls Modul
5.009002 1.04
5.009003 1.06
+=item -d
+
+finds the first perl version where a module has been released by
+date, and not by version number (as is the default).
+
=item -? or -help
help! help! help! to see more help, try --man.
@@ -79,7 +84,7 @@ use warnings;
my %Opts;
-GetOptions(\%Opts, qw[ help|?! man! v|version:f a! ] );
+GetOptions(\%Opts, qw[ help|?! man! v|version:f a! d ] );
pod2usage(1) if $Opts{help};
pod2usage(-verbose=>2) if $Opts{man};
@@ -93,15 +98,16 @@ if(exists $Opts{v} ){
}
$Opts{v} = numify_version( $Opts{v} );
- if( !exists $Module::CoreList::version{$Opts{v}} ) {
+ my $version_hash = Module::CoreList->find_version($Opts{v});
+ if( !$version_hash ) {
print "\nModule::CoreList has no info on perl v$Opts{v}\n\n";
exit 1;
}
if ( !@ARGV ) {
print "\nThe following modules were in perl v$Opts{v} CORE\n";
- print "$_ ", $Module::CoreList::version{$Opts{v}}{$_} || " ","\n"
- for sort keys %{$Module::CoreList::version{$Opts{v}}};
+ print "$_ ", $version_hash->{$_} || " ","\n"
+ for sort keys %$version_hash;
print "\n";
exit 0;
}
@@ -149,12 +155,17 @@ sub module_version {
my($mod,$ver) = @_;
if ( $Opts{v} ) {
- return printf " %-24s %-10s\n",
- $mod,
- $Module::CoreList::version{$Opts{v}}{$mod} || 'undef';
+ my $version_hash = Module::CoreList->find_version($Opts{v});
+ if ($version_hash) {
+ print $mod, " ", $version_hash->{$mod} || 'undef', "\n";
+ return;
+ }
+ else { die "Shouldn't happen" }
}
- my $ret = Module::CoreList->first_release(@_);
+ my $ret = $Opts{d}
+ ? Module::CoreList->first_release_by_date(@_)
+ : Module::CoreList->first_release(@_);
my $msg = $mod;
$msg .= " $ver" if $ver;
@@ -184,13 +195,12 @@ sub module_version {
sub numify_version {
my $ver = shift;
- if ( index( $ver, q{.}, index( $ver, q{.} ) ) >= 0 ) {
- eval { require version };
- if ($@) {
- die "You need to install version.pm to use dotted version numbers\n";
- }
+ if ($ver =~ /\..+\./) {
+ eval { require version ; 1 }
+ or die "You need to install version.pm to use dotted version numbers\n";
$ver = version->new($ver)->numify;
}
+ $ver += 0;
return $ver;
}

View File

@ -16,7 +16,7 @@
Name: perl
Version: %{perl_version}
Release: 15%{?dist}
Release: 16%{?dist}
Epoch: %{perl_epoch}
Summary: The Perl programming language
Group: Development/Languages
@ -68,6 +68,9 @@ Patch11: 32891.patch
# Update Module::Load::Conditional to 0.24 for clean upgrade
Patch12: perl-5.10.0-Module-Load-Conditional-0.24.patch
# Upgrade Module::CoreList to 2.14
Patch13: perl-5.10.0-Module-CoreList2.14.patch
BuildRoot: %{_tmppath}/%{name}-%{perl_version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: tcsh, dos2unix, man, groff
BuildRequires: gdbm-devel, db4-devel, zlib-devel
@ -289,6 +292,7 @@ Requires: perl(IPC::Run) >= 0.79
Requires: perl(Module::Pluggable) >= 2.4
Requires: perl(Module::CoreList)
Requires: perl = %{perl_epoch}:%{perl_version}-%{release}
Provides: CPANPLUS-Dist-Build = %{version}
%description CPANPLUS
The CPANPLUS library is an API to the CPAN mirrors and a collection of
@ -784,6 +788,7 @@ upstream tarball from perl.org.
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
#
# Candidates for doc recoding (need case by case review):
@ -1590,6 +1595,9 @@ make test
# Old changelog entries are preserved in CVS.
%changelog
* Tue Mar 18 2008 Marcela Maslanova <mmaslano@redhat.com> 4:5.10.0-16
- 437817: RFE: Upgrade Module::CoreList to 2.14
* Wed Mar 12 2008 Marcela Maslanova <mmaslano@redhat.com> 4:5.10.0-15
- xsubpp now lives in perl-devel instead of perl.