Fix travis prereq extractor (not sure how this ever worked...)
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / common.bash
index c660905..d50aebb 100755 (executable)
@@ -58,7 +58,7 @@ extract_prereqs() {
     || LASTEXIT=$?
 
   OUT=${COMBINED_OUT#*!!!STDERRSTDOUTSEPARATOR!!!}
-  ERR=$(grep -v " is up to date." <<< "${COMBINED_OUT%!!!STDERRSTDOUTSEPARATOR!!!*}")
+  ERR=${COMBINED_OUT%!!!STDERRSTDOUTSEPARATOR!!!*}
 
   if [[ "$LASTEXIT" != "0" ]] ; then
     echo_err "Error occured (exit code $LASTEXIT) retrieving dependencies of $@:"
@@ -67,8 +67,14 @@ extract_prereqs() {
     exit 1
   fi
 
-  # throw away warnings, ascii art, convert to modnames
-  PQ=$(perl -p -e 's/^\!.*//; s/^[^a-z]+//i; s/\-[^\-]+$/ /; s/\-/::/g' <<< "$OUT")
+  # throw away warnings, up-to-date diag, ascii art, convert to modnames
+  PQ=$(perl -p -e '
+    s/^.*?is up to date.*$//;
+    s/^\!.*//;
+    s/^[^a-z]+//i;
+    s/\-[^\-]+$/ /; # strip version part
+    s/\-/::/g
+  ' <<< "$OUT")
 
   # throw away what was in $@
   for m in "$@" ; do
@@ -85,10 +91,14 @@ parallel_installdeps_notest() {
   # one module spec per line
   MODLIST="$(printf '%s\n' "$@")"
 
-  # The reason we do things so "non-interactively" is that xargs -P will have the
-  # latest cpanm instance overwrite the buildlog. There seems to be no way to
-  # specify a custom buildlog, hence we just collect the verbose output
-  # and display it in case of "worker" failure
+  # We want to trap the output of each process and serially append them to
+  # each other as opposed to just dumping a jumbled up mass-log that would
+  # need careful unpicking by a human
+  #
+  # While cpanm does maintain individual buildlogs in more recent versions,
+  # we are not terribly interested in trying to figure out which log is which
+  # dist. The verbose-output + trap STDIO technique is vastly superior in this
+  # particular case
   #
   # Explanation of inline args:
   #
@@ -167,11 +177,15 @@ _dep_inst_with_test() {
     for m in "$@"; do
       if ! perl -e '
 
-eval ( q{require } . (
+my $mod = (
   $ARGV[0] =~ m{ \/ .*? ([^\/]+) $ }x
     ? do { my @p = split (/\-/, $1); pop @p; join "::", @p }
     : $ARGV[0]
-) ) or ( print $@ and exit 1)
+);
+
+$mod = q{List::Util} if $mod eq q{Scalar::List::Utils};
+
+eval qq{require($mod)} or ( print $@ and exit 1)
 
       ' "$m" 2> /dev/null ; then
         echo -e "$m installation seems to have failed"