X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=maint%2Ftravis-ci_scripts%2Fcommon.bash;h=def7586c8d85a9716a568aadb411e41520e35ff2;hb=77a86bbf1a3c00e44fb76c8a3855270bc800d14b;hp=cfa4ffe32f144bf8bb2ac0e212bc5a09e5488318;hpb=f207111d67e64351cbae6f9c8c092735c681df1d;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/maint/travis-ci_scripts/common.bash b/maint/travis-ci_scripts/common.bash index cfa4ffe..def7586 100755 --- a/maint/travis-ci_scripts/common.bash +++ b/maint/travis-ci_scripts/common.bash @@ -95,6 +95,73 @@ parallel_installdeps_notest() { " } +installdeps() { + if [[ -z "$@" ]] ; then return; fi + + echo_err "$(tstamp) Processing dependencies: $@" + + local -x HARNESS_OPTIONS + + HARNESS_OPTIONS="j$NUMTHREADS" + + echo_err -n "Attempting install of $# modules under parallel ($HARNESS_OPTIONS) testing ... " + + LASTEXIT=0 + START_TIME=$SECONDS + LASTOUT=$( cpan_inst "$@" ) || LASTEXIT=$? + DELTA_TIME=$(( $SECONDS - $START_TIME )) + + if [[ "$LASTEXIT" = "0" ]] ; then + echo_err "done (took ${DELTA_TIME}s)" + else + 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 + START_TIME=$SECONDS + LASTOUT=$( cpan_inst "$@" ) || LASTEXIT=$? + DELTA_TIME=$(( $SECONDS - $START_TIME )) + + if [[ "$LASTEXIT" = "0" ]] ; then + echo_err "done (took ${DELTA_TIME}s)" + else + echo_err "FAILED !!! (after ${DELTA_TIME}s)" + echo_err "STDOUT+STDERR:" + echo_err "$LASTOUT" + exit 1 + fi + fi + + INSTALLDEPS_OUT="${INSTALLDEPS_OUT}${LASTOUT}" +} + +cpan_inst() { + /usr/bin/timeout --kill-after=9.5m --signal=TERM 9m cpan "$@" 2>&1 + + # older perls do not have a CPAN which can exit with error on failed install + for m in "$@"; do + if ! perl -e ' + +eval ( q{require } . ( + $ARGV[0] =~ m{ \/ .*? ([^\/]+) $ }x + ? do { my @p = split (/\-/, $1); pop @p; join "::", @p } + : $ARGV[0] +) ) or ( print $@ and exit 1)' "$m" 2> /dev/null ; then + + echo -e "$m installation seems to have failed" + return 1 + fi + done +} + CPAN_is_sane() { perl -MCPAN\ 1.94_56 -e 1 &>/dev/null ; } CPAN_supports_BUILDPL() { perl -MCPAN\ 1.9205 -e1 &>/dev/null; }