Commit | Line | Data |
b58ecb01 |
1 | #!/bin/bash |
2 | |
3 | source maint/travis-ci_scripts/common.bash |
4 | if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi |
5 | |
b2435630 |
6 | CPAN_MIRROR=$(echo "$PERL_CPANM_OPT" | grep -oP -- '--mirror\s+\S+' | head -n 1 | cut -d ' ' -f 2) |
7 | if ! [[ "$CPAN_MIRROR" =~ "http://" ]] ; then |
b58ecb01 |
8 | echo_err "Unable to extract primary cpan mirror from PERL_CPANM_OPT - something is wrong" |
9 | echo_err "PERL_CPANM_OPT: $PERL_CPANM_OPT" |
b2435630 |
10 | CPAN_MIRROR="http://cpan.develooper.com/" |
11 | echo_err "Using $CPAN_MIRROR for the time being" |
b58ecb01 |
12 | fi |
13 | |
b2435630 |
14 | export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1 PERLBREW_CPAN_MIRROR="$CPAN_MIRROR" |
b58ecb01 |
15 | |
16 | # Fixup CPANM_OPT to behave more like a traditional cpan client |
b2435630 |
17 | export PERL_CPANM_OPT="--verbose --no-interactive $( echo $PERL_CPANM_OPT | sed 's/--skip-satisfied//' )" |
b58ecb01 |
18 | |
19 | if [[ -n "$BREWVER" ]] ; then |
20 | run_or_err "Compiling/installing Perl $BREWVER (without testing, may take up to 5 minutes)" \ |
03d379e5 |
21 | "perlbrew install --as $BREWVER --notest --verbose $BREWOPTS -j 2 $BREWVER" |
b58ecb01 |
22 | |
d2b1fee9 |
23 | # can not do 'perlbrew uss' in the run_or_err subshell above, or a $() |
24 | # furthermore `perlbrew use` returns 0 regardless of whether the perl is |
25 | # found (won't be there unless compilation suceeded, wich *ALSO* returns 0) |
26 | perlbrew use $BREWVER |
27 | |
28 | if [[ "$( perlbrew use | grep -oP '(?<=Currently using ).+' )" != "$BREWVER" ]] ; then |
29 | echo_err "Unable to switch to $BREWVER - compilation failed...?" |
30 | echo_err "$LASTOUT" |
31 | exit 1 |
32 | fi |
33 | |
b58ecb01 |
34 | fi |
35 | |
36 | # configure CPAN.pm - older versions go into an endless loop |
37 | # when trying to autoconf themselves |
38 | CPAN_CFG_SCRIPT=" |
39 | require CPAN; |
40 | require CPAN::FirstTime; |
41 | *CPAN::FirstTime::conf_sites = sub {}; |
42 | CPAN::Config->load; |
b2435630 |
43 | \$CPAN::Config->{urllist} = [qw{ $CPAN_MIRROR }]; |
b58ecb01 |
44 | \$CPAN::Config->{halt_on_failure} = 1; |
45 | CPAN::Config->commit; |
46 | " |
47 | run_or_err "Configuring CPAN.pm" "perl -e '$CPAN_CFG_SCRIPT'" |