Add ability to ban modules that dont function correctly

This commit is contained in:
Ryan Voots 2017-03-30 02:36:02 -04:00
parent ca6486af35
commit 8f2a140a7a
5 changed files with 26 additions and 2 deletions

2
banned.lst Normal file
View file

@ -0,0 +1,2 @@
Inline::Octave
mod_perl2

6
dumpstor.pl Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env perl
use Data::Dumper;
use Storable;
print Dumper(retrieve $ARGV[0]);

View file

@ -11,10 +11,12 @@ sub __parse_file {
}
sub requires {
print "including $_[0]\n";
push @mods, $_[0];
}
sub recommends {
print "including $_[0]\n";
push @mods, $_[0];
}

View file

@ -44,6 +44,18 @@ sub new_module {
$cache{$dist} = Module->new(name => $name);
}
{
my @banned = do {open (my $fh, "<banned.lst"); map {chomp; $Dist::mod_to_dist{$_} // $_} <$fh>};
use Data::Dumper;
print Dumper(\@banned);
sub _is_banned {
my $module = shift;
my $dist = $Dist::mod_to_dist{$module} // $module;
return _is_core($module) || ($dist ~~ @banned);
}
}
sub _is_core {
my $module = shift;
my ($name, $version) = split (/[\-~]/, $module);
@ -58,10 +70,12 @@ sub get_deps {
my $module = $self->name;
# skip perl, or core modules
return [] if _is_core($module);
return [] if _is_banned($module);
print "Getting deps for $module\n";
my @cmd = (qw|cpanm --quiet --mirror http://cpan.simcop2387.info/ --showdeps|, $module);
$SIG{TERM}="ignore";
my $out;
run \@cmd, '>&', \$out;

View file

@ -26,7 +26,7 @@ sub dep_order {
my @orders;
for my $dep ($module->depends->@*) {
print "\r", $dep->name, " ";
# print "\r", $dep->name, " ";
push @orders, dep_order($dep);
}