X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=maint%2Ftravis-ci_scripts%2Fcommon.bash;h=f9d8b4a682f9235967e84c1d7f9a644de18751e3;hb=78b82c85c23b98023e5ad86d70a85bd3102a4927;hp=0cb2e0eb77f8eea597b06967161635cff122acf9;hpb=5ac4a96d843a246b621d0e225cb693323f5d2227;p=dbsrgits%2FDBIx-Class.git diff --git a/maint/travis-ci_scripts/common.bash b/maint/travis-ci_scripts/common.bash index 0cb2e0e..f9d8b4a 100755 --- a/maint/travis-ci_scripts/common.bash +++ b/maint/travis-ci_scripts/common.bash @@ -199,15 +199,52 @@ _dep_inst_with_test() { for m in "$@"; do if ! perl -e ' +$ARGV[0] =~ s/-TRIAL\.//; + my $mod = ( - $ARGV[0] =~ m{ \/ .*? ([^\/]+) $ }x + # abuse backtrack + $ARGV[0] =~ m{ / .*? ( [^/]+ ) $ }x ? do { my @p = split (/\-/, $1); pop @p; join "::", @p } : $ARGV[0] ); -$mod = q{List::Util} if $mod eq q{Scalar::List::Utils}; +# map some install-names to a module/version combo +# serves both as a grandfathered title-less tarball, and +# as a minimum version check for upgraded core modules +my $eval_map = { + + # this is temporary, will need something more robust down the road + # (perhaps by then Module::CoreList will be dep-free) + "Module::Build" => { ver => "0.4214" }, + + "File::Spec" => { ver => "3.47" }, + "Cwd" => { ver => "3.47" }, + + "List::Util" => { ver => "1.42" }, + "Scalar::Util" => { ver => "1.42" }, + "Scalar::List::Utils" => { mod => "List::Util", ver => "1.42" }, +}; + +eval( + "require " + + . + + ( $eval_map->{$mod}{mod} || $mod ) -eval qq{require($mod)} or ( print $@ and exit 1) + . + + ($eval_map->{$mod}{ver} + ? "; $mod->VERSION(\$eval_map->{\$mod}{ver}) " + : "" + ) + + . + + "; 1" +) + or +( print $@ and exit 1) ' "$m" 2> /dev/null ; then echo -e "$m installation seems to have failed" @@ -221,10 +258,10 @@ eval qq{require($mod)} or ( print $@ and exit 1) # https://github.com/kentfredric/Dist-Zilla-Plugin-Prereqs-MatchInstalled-All/blob/master/maint-travis-ci/sterilize_env.pl # Only works on 5.12+ (where sitelib was finally properly fixed) purge_sitelib() { + echo_err "$(tstamp) Sterilizing the Perl installation (cleaning up sitelib)" if perl -M5.012 -e1 &>/dev/null ; then - echo_err "$(tstamp) Cleaning up Perl installation" perl -M5.012 -MConfig -MFile::Find -e ' my $sitedirs = { map { $Config{$_} => 1 } @@ -235,9 +272,48 @@ purge_sitelib() { ! $sitedirs->{$_} and ( -d _ ? rmdir : unlink ) } }, keys %$sitedirs ) ' - echo_err "Post-cleanup contents of sitelib:" - echo_err "$(tree $(perl -MConfig -e 'print $Config{sitelib_stem}'))" - echo_err + else + + cl_fn="/tmp/${TRAVIS_BUILD_ID}_Module_CoreList.pm"; + + [[ -s "$cl_fn" ]] || run_or_err \ + "Downloading latest Module::CoreList" \ + "curl -s --compress -o '$cl_fn' https://api.metacpan.org/source/Module::CoreList" + + perl -0777 -Ilib -MDBIx::Class::Optional::Dependencies -e ' + + # this is horrible, but really all we want is "has this ever been used" + # so a grep without a load is quite legit (and horrible) + my $mcl_source = <>; + + my @all_possible_never_been_core_modpaths = map + { (my $mp = $_ . ".pm" ) =~ s|::|/|g; $mp } + grep + { $mcl_source !~ / ^ \s+ \x27 $_ \x27 \s* \=\> /mx } + ( + qw( + Module::Build::Tiny + ), + keys %{ DBIx::Class::Optional::Dependencies->modreq_list_for([ + keys %{ DBIx::Class::Optional::Dependencies->req_group_list } + ])} + ) + ; + + # now that we have the list we can go ahead and destroy every single one + # of these modules without being concerned about breaking the base ability + # to install things + for my $mp ( sort { lc($a) cmp lc($b) } @all_possible_never_been_core_modpaths ) { + for my $incdir (@INC) { + -e "$incdir/$mp" + and + unlink "$incdir/$mp" + and + print "Nuking $incdir/$mp\n" + } + } + ' "$cl_fn" + fi }