(travis) Remove workarounds for fixed issues
[dbsrgits/DBIx-Class-Schema-Loader.git] / maint / travis-ci_scripts / 20_install.bash
CommitLineData
b7254ae2 1#!/bin/bash
2
b7254ae2 3if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
4
a61771df 5# we need a mirror that both has the standard index and a backpan version rolled
6# into one, due to MDV testing
7CPAN_MIRROR="http://cpan.metacpan.org/"
8
9PERL_CPANM_OPT="$PERL_CPANM_OPT --mirror $CPAN_MIRROR"
b7254ae2 10
11export 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"
12
13# try CPAN's latest offering if requested
14if [[ "$DEVREL_DEPS" == "true" ]] ; then
15
16 PERL_CPANM_OPT="$PERL_CPANM_OPT --dev"
17
b7254ae2 18fi
19
20# Fixup CPANM_OPT to behave more like a traditional cpan client
7829f5ce 21export PERL_CPANM_OPT="--verify --verbose --no-interactive --no-man-pages $( echo $PERL_CPANM_OPT | sed 's/--skip-satisfied//' )"
b7254ae2 22
23if [[ -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"
28 fi
29
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"
32
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)
36 perlbrew use $BREWVER
37
38 if [[ "$( perlbrew use | grep -oP '(?<=Currently using ).+' )" != "$BREWVER" ]] ; then
39 echo_err "Unable to switch to $BREWVER - compilation failed...?"
40 echo_err "$LASTOUT"
41 exit 1
42 fi
43
44# no brewver - this means a travis perl, which means we want to clean up
45# the presently installed libs
46# Idea stolen from
47# https://github.com/kentfredric/Dist-Zilla-Plugin-Prereqs-MatchInstalled-All/blob/master/maint-travis-ci/sterilize_env.pl
48elif [[ "$CLEANTEST" == "true" ]] && [[ "$POISON_ENV" != "true" ]] ; then
49
50 echo_err "$(tstamp) Cleaning precompiled Travis-Perl"
51 perl -MConfig -MFile::Find -e '
52 my $sitedirs = {
53 map { $Config{$_} => 1 }
54 grep { $_ =~ /site(lib|arch)exp$/ }
55 keys %Config
56 };
57 find({ bydepth => 1, no_chdir => 1, follow_fast => 1, wanted => sub {
58 ! $sitedirs->{$_} and ( -d _ ? rmdir : unlink )
59 } }, keys %$sitedirs )
60 '
61
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}'))"
64 echo_err
65fi
66
67# configure CPAN.pm - older versions go into an endless loop
68# when trying to autoconf themselves
69CPAN_CFG_SCRIPT="
70 require CPAN;
71 require CPAN::FirstTime;
72 *CPAN::FirstTime::conf_sites = sub {};
73 CPAN::Config->load;
74 \$CPAN::Config->{urllist} = [qw{ $CPAN_MIRROR }];
75 \$CPAN::Config->{halt_on_failure} = 1;
76 CPAN::Config->commit;
77"
78run_or_err "Configuring CPAN.pm" "perl -e '$CPAN_CFG_SCRIPT'"