Change CPAN mirror again - metacpan is a complete backpan-backed mirror
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / 20_install.bash
index 6cc1a49..c8bd62a 100755 (executable)
@@ -7,22 +7,45 @@ CPAN_MIRROR=$(echo "$PERL_CPANM_OPT" | grep -oP -- '--mirror\s+\S+' | head -n 1
 if ! [[ "$CPAN_MIRROR" =~ "http://" ]] ; then
   echo_err "Unable to extract primary cpan mirror from PERL_CPANM_OPT - something is wrong"
   echo_err "PERL_CPANM_OPT: $PERL_CPANM_OPT"
-  CPAN_MIRROR="http://cpan.develooper.com/"
+  CPAN_MIRROR="http://cpan.metacpan.org/"
+  PERL_CPANM_OPT="$PERL_CPANM_OPT --mirror $CPAN_MIRROR"
   echo_err "Using $CPAN_MIRROR for the time being"
 fi
 
 export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1 PERLBREW_CPAN_MIRROR="$CPAN_MIRROR"
 
+# try CPAN's latest offering if requested
+if [[ "$DEVREL_DEPS" == "true" ]] ; then
+
+  if [[ "$CLEANTEST" == "true" ]] ; then
+    echo_err "DEVREL_DEPS combined with CLEANTEST makes no sense - it is only possible with cpanm"
+    exit 1
+  fi
+
+  PERL_CPANM_OPT="$PERL_CPANM_OPT --dev"
+
+  # FIXME work around https://github.com/miyagawa/cpanminus/issues/308
+  TEST_BUILDER_BETA_CPAN_TARBALL="M/MS/MSCHWERN/Test-Simple-1.005000_006.tar.gz"
+fi
+
 # Fixup CPANM_OPT to behave more like a traditional cpan client
-export PERL_CPANM_OPT="--verbose --no-interactive $( echo $PERL_CPANM_OPT | sed 's/--skip-satisfied//' )"
+export PERL_CPANM_OPT="--verbose --no-interactive --no-man-pages $( echo $PERL_CPANM_OPT | sed 's/--skip-satisfied//' )"
 
 if [[ -n "$BREWVER" ]] ; then
   run_or_err "Compiling/installing Perl $BREWVER (without testing, may take up to 5 minutes)" \
-    "perlbrew install --as $BREWVER --notest --verbose $BREWOPTS -j 2  $BREWVER"
+    "perlbrew install --as $BREWVER --notest --noman --verbose $BREWOPTS -j 2  $BREWVER"
+
+  # can not do 'perlbrew uss' in the run_or_err subshell above, or a $()
+  # furthermore `perlbrew use` returns 0 regardless of whether the perl is
+  # found (won't be there unless compilation suceeded, wich *ALSO* returns 0)
+  perlbrew use $BREWVER
+
+  if [[ "$( perlbrew use | grep -oP '(?<=Currently using ).+' )" != "$BREWVER" ]] ; then
+    echo_err "Unable to switch to $BREWVER - compilation failed...?"
+    echo_err "$LASTOUT"
+    exit 1
+  fi
 
-  # can not do 'perlbrew uss' in the run_or_err subshell above
-  perlbrew use $BREWVER || \
-    ( echo_err -e "Unable to switch to $BREWVER - compillation failed?\n$LASTOUT"; exit 1 )
 fi
 
 # configure CPAN.pm - older versions go into an endless loop