5 echo_err() { echo "$@" 1>&2 ; }
7 if [[ "$TRAVIS" != "true" ]] ; then
8 echo_err "Running this script makes no sense outside of travis-ci"
12 tstamp() { echo -n "[$(date '+%H:%M:%S')]" ; }
15 echo_err -n "$(tstamp) $1 ... "
19 LASTOUT=$( bash -c "$2" 2>&1 ) || LASTEXIT=$?
20 DELTA_TIME=$(( $SECONDS - $START_TIME ))
22 if [[ "$LASTEXIT" != "0" ]] ; then
23 echo_err -e "FAILED !!! (after ${DELTA_TIME}s)\nCommand executed:\n$2\nSTDOUT+STDERR:\n$LASTOUT"
26 echo_err "done (took ${DELTA_TIME}s)"
33 COMBINED_OUT="$( { stdout="$(cpanm --quiet --scandeps --format tree "$@")" ; } 2>&1; echo "!!!STDERRSTDOUTSEPARATOR!!!$stdout")" \
36 OUT=${COMBINED_OUT#*!!!STDERRSTDOUTSEPARATOR!!!}
37 ERR=$(grep -v " is up to date." <<< "${COMBINED_OUT%!!!STDERRSTDOUTSEPARATOR!!!*}")
39 if [[ "$LASTEXIT" != "0" ]] || [[ -n "$ERR" ]] ; then
40 echo_err "$(echo -e "Error occured (exit code $LASTEXIT) retrieving dependencies of $@:\n$ERR\n$OUT")"
44 # throw away non-children (what was in $@), throw away ascii art, convert to modnames
45 perl -p -e 's/^[a-z].+//i; s/^[^a-z]+//i; s/\-[^\-]+$/ /; s/\-/::/g' <<< "$OUT"
48 parallel_installdeps_notest() {
49 if [[ -z "$@" ]] ; then return; fi
51 # flatten list into one string
54 # The reason we do things so "non-interactively" is that xargs -P will have the
55 # latest cpanm instance overwrite the buildlog. There seems to be no way to
56 # specify a custom buildlog, hence we just collect the verbose output
57 # and display it in case of failure
58 run_or_err "Installing (without testing) $MODLIST" \
59 "echo $MODLIST | xargs -n 1 -P $NUMTHREADS cpanm --verbose --no-interactive --notest --no-man-pages"
63 CPAN_is_sane() { perl -MCPAN\ 1.94_56 -e 1 &>/dev/null ; }