Prelim options, and readme
This commit is contained in:
parent
dc0448db3a
commit
e01ff7f9c0
2 changed files with 57 additions and 9 deletions
13
README.md
Normal file
13
README.md
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
This is a simple hacky script that uses perlbrew and cpanm to test modules against ```perl $ENV{PERL_USE_UNSAFE_INC}``` to see if they fail. It does this by re-implementing the dependency search for the modules.
|
||||||
|
|
||||||
|
This script is inteded to be used to test if your current project or module needs '.' in @INC. I've built it towards that goal for perlbot and it's eval so I can file bugs with all relavent modules.
|
||||||
|
|
||||||
|
To test, i recommend installing blead via perlbrew. ```perlbrew install blead```
|
||||||
|
|
||||||
|
it will litter some files:
|
||||||
|
modcache.stor
|
||||||
|
logs/*.log
|
||||||
|
|
||||||
|
these can be removed after you're done, but keeping the .stor file means that it won't re-fetch dependency lists off cpan.
|
||||||
|
|
||||||
|
The logs are failure logs, *_incfailure.log are ones that failed due to @INC, and *_genfailure.log are ones that failed due to some other kind of problem (missing library, etc.)
|
|
@ -74,12 +74,33 @@ sub print_deps {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package main;
|
||||||
use strict;
|
use strict;
|
||||||
use autodie;
|
use autodie;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use List::Util qw/uniq/;
|
use List::Util qw/uniq/;
|
||||||
use IPC::Run qw/run/;
|
use IPC::Run qw/run/;
|
||||||
|
use Getopt::Long;
|
||||||
|
|
||||||
|
our $opt_perlbrew_env='blead';
|
||||||
|
our $opt_module;
|
||||||
|
our $opt_cpanfile;
|
||||||
|
our $opt_help;
|
||||||
|
|
||||||
|
GetOptions ("module=s" => \$opt_module,
|
||||||
|
"cpanfile=s" => \$opt_cpanfile, # string
|
||||||
|
"perlbrew_env=s" => \$opt_perlbrew_env,
|
||||||
|
"help" => \$opt_help); # flagV
|
||||||
|
|
||||||
|
if ((!$opt_module && !$opt_cpanfile) || ($opt_module && $opt_cpanfile) || $opt_help) {
|
||||||
|
usage(); exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub usage {
|
||||||
|
print "Call with either --cpanfile xor --module to specify what to test.\n",
|
||||||
|
"Use --perlbrew_env to specify which perl install to use, defaults to blead\n";
|
||||||
|
}
|
||||||
|
|
||||||
sub dep_order {
|
sub dep_order {
|
||||||
my $module = shift;
|
my $module = shift;
|
||||||
|
@ -100,7 +121,7 @@ sub run_cpanm {
|
||||||
my ($module, $incstatus) = @_;
|
my ($module, $incstatus) = @_;
|
||||||
|
|
||||||
$ENV{PERL_USE_UNSAFE_INC} = !!$incstatus;
|
$ENV{PERL_USE_UNSAFE_INC} = !!$incstatus;
|
||||||
my @cmd = (qw/perlbrew exec --with perlbot-inctest cpanm --reinstall --verbose/, $module);
|
my @cmd = (qw/perlbrew exec --with/, $opt_perlbrew_env, qw/cpanm --reinstall --verbose/, $module);
|
||||||
|
|
||||||
my $out;
|
my $out;
|
||||||
run \@cmd, '>&', \$out;
|
run \@cmd, '>&', \$out;
|
||||||
|
@ -130,15 +151,29 @@ sub test_module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub main {
|
||||||
$|++;
|
$|++;
|
||||||
print "Init\n";
|
|
||||||
|
|
||||||
my $foo = Module->new_module('Moose');
|
my @mods_to_test = ($opt_module);
|
||||||
|
|
||||||
print "Building dep list\n";
|
if ($opt_cpanfile) {
|
||||||
my @modules = map {$_->name} uniq dep_order($foo);
|
# TODO read cpanfile, via do/require
|
||||||
|
}
|
||||||
|
|
||||||
|
my @modules;
|
||||||
|
|
||||||
|
print "Building dep list sorry, this'll take a while\n";
|
||||||
|
for my $mtt (@mods_to_test) {
|
||||||
|
my $mod = Module->new_module($mtt);
|
||||||
|
push @modules, map {$_->name} uniq dep_order($mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
@modules = uniq(@modules);
|
||||||
|
|
||||||
for my $mod (@modules) {
|
for my $mod (@modules) {
|
||||||
print "Testing $mod\n";
|
print "Testing $mod\n";
|
||||||
test_module($mod);
|
test_module($mod);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
Loading…
Add table
Reference in a new issue