3 if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
5 # we need a mirror that both has the standard index and a backpan version rolled
6 # into one, due to MDV testing
7 CPAN_MIRROR="http://cpan.metacpan.org/"
9 PERL_CPANM_OPT="$PERL_CPANM_OPT --mirror $CPAN_MIRROR"
11 export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1 PERLBREW_CPAN_MIRROR="$CPAN_MIRROR" HARNESS_TIMER=1 MAKEFLAGS="-j$NUMTHREADS"
13 # try CPAN's latest offering if requested
14 if [[ "$DEVREL_DEPS" == "true" ]] ; then
16 PERL_CPANM_OPT="$PERL_CPANM_OPT --dev"
20 # Fixup CPANM_OPT to behave more like a traditional cpan client
21 export PERL_CPANM_OPT="--verify --verbose --no-interactive --no-man-pages $( echo $PERL_CPANM_OPT | sed 's/--skip-satisfied//' )"
23 if [[ -n "$BREWVER" ]] ; then
24 # since perl 5.14 a perl can safely be built concurrently with -j$large
25 # (according to brute force testing and my power bill)
26 if [[ "$BREWVER" == "blead" ]] || perl -Mversion -e "exit !!(version->new(q($BREWVER)) < 5.014)" ; then
27 perlbrew_jopt="$NUMTHREADS"
30 run_or_err "Compiling/installing Perl $BREWVER (without testing, using ${perlbrew_jopt:-1} threads, may take up to 5 minutes)" \
31 "perlbrew install --as $BREWVER --notest --noman --verbose $BREWOPTS -j${perlbrew_jopt:-1} $BREWVER"
33 # can not do 'perlbrew uss' in the run_or_err subshell above, or a $()
34 # furthermore `perlbrew use` returns 0 regardless of whether the perl is
35 # found (won't be there unless compilation suceeded, wich *ALSO* returns 0)
38 if [[ "$( perlbrew use | grep -oP '(?<=Currently using ).+' )" != "$BREWVER" ]] ; then
39 echo_err "Unable to switch to $BREWVER - compilation failed...?"
44 # no brewver - this means a travis perl, which means we want to clean up
45 # the presently installed libs
47 # https://github.com/kentfredric/Dist-Zilla-Plugin-Prereqs-MatchInstalled-All/blob/master/maint-travis-ci/sterilize_env.pl
48 elif [[ "$CLEANTEST" == "true" ]] && [[ "$POISON_ENV" != "true" ]] ; then
50 echo_err "$(tstamp) Cleaning precompiled Travis-Perl"
51 perl -MConfig -MFile::Find -e '
53 map { $Config{$_} => 1 }
54 grep { $_ =~ /site(lib|arch)exp$/ }
57 find({ bydepth => 1, no_chdir => 1, follow_fast => 1, wanted => sub {
58 ! $sitedirs->{$_} and ( -d _ ? rmdir : unlink )
59 } }, keys %$sitedirs )
62 echo_err "Post-cleanup contents of sitelib of the pre-compiled Travis-Perl $TRAVIS_PERL_VERSION:"
63 echo_err "$(tree $(perl -MConfig -e 'print $Config{sitelib_stem}'))"
67 # configure CPAN.pm - older versions go into an endless loop
68 # when trying to autoconf themselves
71 require CPAN::FirstTime;
72 *CPAN::FirstTime::conf_sites = sub {};
74 \$CPAN::Config->{urllist} = [qw{ $CPAN_MIRROR }];
75 \$CPAN::Config->{halt_on_failure} = 1;
78 run_or_err "Configuring CPAN.pm" "perl -e '$CPAN_CFG_SCRIPT'"