From 34e25d4b75f2e7f31e7ef507906986fe8ae5636a Mon Sep 17 00:00:00 2001 From: Justin Davis Date: Fri, 1 Jun 2012 13:15:37 -0400 Subject: Use our own list instead of Module::CoreList. --- preps/perl.d/perl-dist | 61 +++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/preps/perl.d/perl-dist b/preps/perl.d/perl-dist index c465b03..4dd0d84 100755 --- a/preps/perl.d/perl-dist +++ b/preps/perl.d/perl-dist @@ -12,11 +12,13 @@ if(exists $ENV{'GENPKGDBG'}){ *DBG = sub { print STDERR "$PROG: DBG: ", @_ }; } +# Visible through entire file. +my %CoreMods = loadcore(); + package Convert; *DBG = *main::DBG; -use Module::CoreList; use LWP::UserAgent qw(); use YAML::XS qw(); use version qw(); @@ -186,7 +188,7 @@ sub _reqs2deps # Filter out deps on 'perl' and any core modules that we can. while(my ($name, $ver) = each(%$prereqs)) { DBG("requires $name $ver\n"); - my $cver = $Module::CoreList::version{$]}{$name}; + my $cver = $CoreMods{$name}; if($name eq 'perl') { $pkgdeps{'perl'} = _perldepver($ver); @@ -297,7 +299,7 @@ sub _distsofmods @mods = _nocore(@mods); my $var = _vardir(); - open my $fh, '<', "$var/cpanmods" + open my $fh, '<', "$var/cpan.mods" or die "$PROG: failed to open $var/cpanmods: $!"; my %mods = map { ($_ => 1) } @mods; @@ -328,30 +330,11 @@ sub _distsofmods sub _nocore { - my(@mods) = @_; - - my $cmpath = _vardir() . '/perlcore.mods'; - unless(-f $cmpath){ - print STDERR <<"END_ERR"; -$PROG: error: $cmpath is missing. -****************************************************************************** - This file should have been installed along with genpkg. Copy the file from - genpkg's source or generate it with the misc/perlcore script in genpkg's - source. Make sure to use the same version as the perl you are using. -****************************************************************************** -END_ERR - exit 1; - } - open my $if, '<', $cmpath or die "$PROG: open $cmpath: $!"; - - my %mods = map { ($_ => 1) } @mods; - while(<$if>){ - my($m) = split; - delete $mods{$m}; + my @mods; + for my $m (@_){ + push @mods, $m unless(exists $CoreMods{$m}); } - - close $if; - return keys %mods; + return @mods; } sub _vardir @@ -612,4 +595,30 @@ sub _readmedesc return undef; } +sub loadcore +{ + my $cmpath = _vardir() . '/perlcore.mods'; + unless(-f $cmpath){ + print STDERR <<"END_ERR"; +$PROG: error: $cmpath is missing. +****************************************************************************** + This file should have been installed along with genpkg. Copy the file from + genpkg's source or generate it with the misc/perlcore script in genpkg's + source. Make sure to use the same version as the perl you are using. +****************************************************************************** +END_ERR + exit 1; + } + + my %cm; + open my $if, '<', $cmpath or die "$PROG: open $cmpath: $!"; + while(<$if>){ + my($m, $v) = split; + $cm{$m} = $v; + } + close $if; + return %cm; + +} + exit main(@ARGV); -- cgit v1.2.3-24-g4f1b