Fix silly thinko in travis_prepare_env's extract_prereqs()
[dbsrgits/DBIx-Class.git] / maint / travis-ci_prepare_env
index e765094..561790f 100755 (executable)
@@ -15,8 +15,9 @@ tstamp() { echo -n "[$(date '+%H:%M:%S')]" ; }
 run_or_err() {
   echo_err -n "$(tstamp) $1 ... "
 
-  LASTOUT=$( bash -c "$2" 2>&1)
-  LASTEXIT=$?
+  LASTEXIT=0
+  LASTOUT=$( bash -c "$2" 2>&1 ) || LASTEXIT=$?
+
   if [[ "$LASTEXIT" != "0" ]] ; then
     echo_err -e "FAILED !!!\nCommand executed:\n$2\nSTDOUT+STDERR:\n$LASTOUT"
     return $LASTEXIT
@@ -66,17 +67,27 @@ export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CP
 export PERL_CPANM_OPT="$( echo $PERL_CPANM_OPT | sed 's/--skip-satisfied//' )"
 
 if [[ -n "$BREWVER" ]] ; then
-  # if this is not master and not a smoke/ branch - cancel all testing
-  if [[ "$TRAVIS_BRANCH" =~ "topic/" ]]; then
+  # .travis.yml already restricts branches to master, topic/* and smoke/*
+  # do some extra short-circuiting here
+
+  # when smoking master do not attempt bleadperl (not release-critical)
+  if [[ "$TRAVIS_BRANCH" = "master" ]] && [[ "$BREWVER" = "blead" ]]; then
+    export SHORT_CIRCUIT_SMOKE=1
+  # on topic/ branches test only with travis perls
+  elif [[ "$TRAVIS_BRANCH" =~ "topic/" ]]; then
     export SHORT_CIRCUIT_SMOKE=1
+  fi
+
+  if [[ -n "$SHORT_CIRCUIT_SMOKE" ]]; then
     echo_err "$(tstamp) non-smoke branch and custom perl compilation requested - bailing out"
     sleep 20  # give the console time to attach, otherwise it hangs
     return  # this is like an `exit 0` in sourcing
   fi
 
   run_or_err "Compiling/installing Perl $BREWVER (without testing, may take up to 5 minutes)" \
-    "perlbrew install --as $BREWVER --notest $BREWOPTS -j $NUMTHREADS perl-$BREWVER"
+    "perlbrew install --as $BREWVER --notest --verbose $BREWOPTS -j $NUMTHREADS $BREWVER"
 
+  sync
   perlbrew use $BREWVER
 fi
 
@@ -95,20 +106,20 @@ run_or_err "Configuring CPAN.pm" "perl -e '$CPAN_CFG_SCRIPT'"
 
 extract_prereqs() {
   # hack-hack-hack
+  LASTEXIT=0
   COMBINED_OUT="$( { stdout="$(cpanm --quiet --scandeps --format tree "$@")" ; } 2>&1; echo "!!!STDERRSTDOUTSEPARATOR!!!$stdout")" \
     || LASTEXIT=$?
 
   OUT=${COMBINED_OUT#*!!!STDERRSTDOUTSEPARATOR!!!}
   ERR=$(grep -v " is up to date." <<< "${COMBINED_OUT%!!!STDERRSTDOUTSEPARATOR!!!*}")
 
-  [[ -n "$LASTEXIT" ]] || LASTEXIT=0
   if [[ "$LASTEXIT" != "0" ]] || [[ -n "$ERR" ]] ; then
     echo_err "$(echo -e "Error occured (exit code $LASTEXIT) retrieving dependencies of $@:\n$ERR\n$OUT")"
     exit 1
   fi
 
   # throw away non-children (what was in $@), throw away ascii art, convert to modnames
-  perl -p -e 's/^\s*[^\\].+//; s/^[^A-Za-z]+//; s/\-[^\-]+$/ /; s/\-/::/g' <<< "$OUT"
+  perl -p -e 's/^[a-z].+//i; s/^[^a-z]+//i; s/\-[^\-]+$/ /; s/\-/::/g' <<< "$OUT"
 }
 
 parallel_installdeps_notest() {