Streamline connection codepath, fix $ENV{DBI_DSN} regression from d87929a4
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / common.bash
index 230d140..99a2da4 100755 (executable)
@@ -18,6 +18,8 @@ run_or_err() {
 
   LASTEXIT=0
   START_TIME=$SECONDS
+  # the tee is a handy debugging tool when stumpage is exceedingly strong
+  #LASTOUT=$( bash -c "$2" 2>&1 | tee /dev/stderr) || LASTEXIT=$?
   LASTOUT=$( bash -c "$2" 2>&1 ) || LASTEXIT=$?
   DELTA_TIME=$(( $SECONDS - $START_TIME ))
 
@@ -34,6 +36,16 @@ run_or_err() {
   fi
 }
 
+apt_install() {
+  # flatten
+  pkgs="$@"
+
+  # Need to do this at every step, the sources list may very well have changed
+  run_or_err "Updating APT available package list" "sudo apt-get update"
+
+  run_or_err "Installing Debian APT packages: $pkgs" "sudo apt-get install --allow-unauthenticated  --no-install-recommends -y $pkgs"
+}
+
 extract_prereqs() {
   # once --verbose is set, --no-verbose can't disable it
   # do this by hand
@@ -54,8 +66,8 @@ extract_prereqs() {
     exit 1
   fi
 
-  # throw away ascii art, convert to modnames
-  PQ=$(perl -p -e 's/^[^a-z]+//i; s/\-[^\-]+$/ /; s/\-/::/g' <<< "$OUT")
+  # throw away warnings, ascii art, convert to modnames
+  PQ=$(perl -p -e 's/^\!.*//; s/^[^a-z]+//i; s/\-[^\-]+$/ /; s/\-/::/g' <<< "$OUT")
 
   # throw away what was in $@
   for m in "$@" ; do
@@ -114,7 +126,15 @@ installdeps() {
   if [[ "$LASTEXIT" = "0" ]] ; then
     echo_err "done (took ${DELTA_TIME}s)"
   else
-    echo_err -n "failed (after ${DELTA_TIME}s Exit:$LASTEXIT Log:$(/usr/bin/nopaste -q -s Shadowcat -d "Parallel installfail" <<< "$LASTOUT")) retrying with sequential testing ... "
+    local errlog="after ${DELTA_TIME}s Exit:$LASTEXIT Log:$(/usr/bin/nopaste -q -s Shadowcat -d "Parallel installfail" <<< "$LASTOUT")"
+    echo_err -n "failed ($errlog) retrying with sequential testing ... "
+    POSTMORTEM="$POSTMORTEM$(
+      echo
+      echo "Depinstall under $HARNESS_OPTIONS parallel testing failed $errlog"
+      echo "============================================================="
+      echo "Attempted installation of: $@"
+      echo "============================================================="
+    )"
 
     HARNESS_OPTIONS=""
     LASTEXIT=0