Reorganize travis stuff a little - no functional changes
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / 20_install.bash
CommitLineData
b58ecb01 1#!/bin/bash
2
3source maint/travis-ci_scripts/common.bash
4if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
5
6TRAVIS_CPAN_MIRROR=$(echo "$PERL_CPANM_OPT" | grep -oP -- '--mirror\s+\S+' | head -n 1 | cut -d ' ' -f 2)
7if ! [[ "$TRAVIS_CPAN_MIRROR" =~ "http://" ]] ; then
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"
10 exit 1
11fi
12
13export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1 PERLBREW_CPAN_MIRROR="$TRAVIS_CPAN_MIRROR"
14
15# Fixup CPANM_OPT to behave more like a traditional cpan client
71dd2ecc 16export PERL_CPANM_OPT="$( echo $PERL_CPANM_OPT | sed 's/--skip-satisfied//' ) --verbose --no-interactive"
b58ecb01 17
18if [[ -n "$BREWVER" ]] ; then
19 run_or_err "Compiling/installing Perl $BREWVER (without testing, may take up to 5 minutes)" \
20 "perlbrew install --as $BREWVER --notest --verbose $BREWOPTS -j $NUMTHREADS $BREWVER"
21
22 # can not do 'perlbrew uss' in the run_or_err subshell above
23 perlbrew use $BREWVER || \
24 ( echo_err -e "Unable to switch to $BREWVER - compillation failed?\n$LASTOUT"; exit 1 )
25fi
26
27# configure CPAN.pm - older versions go into an endless loop
28# when trying to autoconf themselves
29CPAN_CFG_SCRIPT="
30 require CPAN;
31 require CPAN::FirstTime;
32 *CPAN::FirstTime::conf_sites = sub {};
33 CPAN::Config->load;
34 \$CPAN::Config->{urllist} = [qw{ $TRAVIS_CPAN_MIRROR }];
35 \$CPAN::Config->{halt_on_failure} = 1;
36 CPAN::Config->commit;
37"
38run_or_err "Configuring CPAN.pm" "perl -e '$CPAN_CFG_SCRIPT'"