From d532aba2676514d91bdad04b895b6474cf0f5d0c Mon Sep 17 00:00:00 2001 From: Ryan Voots Date: Thu, 30 Mar 2017 01:21:14 -0400 Subject: [PATCH] Prepping to add job restarting to the system --- lib/Dist.pm | 1 - lib/Module.pm | 54 +++++----------------------------------------- lib/TestCpanInc.pm | 4 ++-- 3 files changed, 7 insertions(+), 52 deletions(-) diff --git a/lib/Dist.pm b/lib/Dist.pm index 93ecc8a..0167a78 100755 --- a/lib/Dist.pm +++ b/lib/Dist.pm @@ -16,6 +16,5 @@ while (my $l = <$fh>) { $mod_to_dist{$module} = $dist; } -print Dumper(\%dist_to_mod); 1; diff --git a/lib/Module.pm b/lib/Module.pm index 210aa0b..0847f10 100755 --- a/lib/Module.pm +++ b/lib/Module.pm @@ -27,9 +27,10 @@ if (-e 'modcache.stor') { } } -END { +sub __save_cache { store \%cache, 'modcache.stor'; }; +END {__save_cache}; sub new_module { my $class = shift; @@ -52,21 +53,6 @@ sub _is_core { return $ret; } -sub get_dist { - my $self=shift; - my $module = $self->name; - - # skip perl, or core modules - return 'perl' if _is_core($module); - - my @cmd = (qw|cpanm --quiet --mirror http://cpan.simcop2387.info/ --info|, $module); - my $out; - run \@cmd, '>&', \$out; - - chomp $out; - return $out; -} - sub get_deps { my $self=shift; my $module = $self->name; @@ -79,7 +65,9 @@ sub get_deps { my $out; run \@cmd, '>&', \$out; - return [map {Module->new_module($_)} grep {!_is_core($_)} split($/, $out)]; + my $deps = [map {Module->new_module($_)} grep {!_is_core($_)} split($/, $out)]; + __save_cache; + return $deps; } sub print_deps { @@ -92,36 +80,4 @@ sub print_deps { } } -package cpanfile; -# HACK since cpan files are valid perl, i'm just using do/require - -our @mods; - -sub __parse_file { - my $file = shift; - - require $file; -} - -sub requires { - push @mods, $_[0]; -} - -sub recommends { - push @mods, $_[0]; -} - -sub conflicts {} # IGNORE These - -# we expect all types -sub on { - my ($env, $code) = @_; - $code->(); -} - -sub feature { - my ($feat, $desc, $code) = @_; - $code->(); -} - 1; diff --git a/lib/TestCpanInc.pm b/lib/TestCpanInc.pm index b83d090..d208a5d 100644 --- a/lib/TestCpanInc.pm +++ b/lib/TestCpanInc.pm @@ -48,12 +48,12 @@ sub test_module { if (!$ret2) { print ">>>>Module $module failed to build without UNSAFE INC\n"; - open(my $fh, ">", "logs/${$}_${module}_incfailure.log"); + open(my $fh, ">", "logs/${module}_incfailure.log"); print $fh $noincout; } else { print "<<<", "logs/${$}_${module}_genfailure.log"); + open(my $fh, ">", "logs/${module}_genfailure.log"); print $fh $incout; } }