(travis) Adjust test infrastructure for recent extensive TravisCI changes
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / common.bash
index 0faf8a5..689e5af 100755 (executable)
@@ -26,7 +26,7 @@ $(perl -0777 -p -e 's/.+\n\n(?!\z)//s' < /proc/cpuinfo)
 $(free -m -t)
 
 = Diskinfo
-$(sudo df -h)
+$(df -h)
 
 $(mount | grep '^/')
 
@@ -37,10 +37,10 @@ $(uname -a)
 $(ip addr)
 
 = Network Sockets Status
-$(sudo netstat -an46p | grep -Pv '\s(CLOSING|(FIN|TIME|CLOSE)_WAIT.?|LAST_ACK)\s')
+$( (sudo netstat -an46p || netstat -an46p) | grep -Pv '\s(CLOSING|(FIN|TIME|CLOSE)_WAIT.?|LAST_ACK)\s')
 
 = Processlist
-$(sudo ps fuxa)
+$(ps fuxa)
 
 = Environment
 $(env | grep -P 'TEST|HARNESS|MAKE|TRAVIS|PERL|DBIC' | LC_ALL=C sort | cat -v)
@@ -171,7 +171,7 @@ installdeps() {
   HARNESS_OPTIONS="j$VCPU_USE"
 
   if ! run_or_err "Attempting install of $# modules under parallel ($HARNESS_OPTIONS) testing ($MODLIST)" "_dep_inst_with_test $MODLIST" quiet_fail ; then
-    local errlog="failed after ${DELTA_TIME}s Exit:$LASTEXIT Log:$(/usr/bin/nopaste -q -s Shadowcat -d "Parallel testfail" <<< "$LASTOUT")"
+    local errlog="failed after ${DELTA_TIME}s Exit:$LASTEXIT Log:$(/usr/bin/perl /usr/bin/nopaste -q -s Shadowcat -d "Parallel testfail" <<< "$LASTOUT")"
     echo "$errlog"
 
     POSTMORTEM="$POSTMORTEM$(
@@ -199,15 +199,51 @@ _dep_inst_with_test() {
     for m in "$@"; do
       if ! perl -e '
 
+$ARGV[0] =~ s/-TRIAL\.//;
+
 my $mod = (
-  $ARGV[0] =~ m{ \/ .*? ([^\/]+) $ }x
+  # abuse backtrack
+  $ARGV[0] =~ m{ / .*? ( [^/]+ ) $ }x
     ? do { my @p = split (/\-/, $1); pop @p; join "::", @p }
     : $ARGV[0]
 );
 
-$mod = q{List::Util} if $mod eq q{Scalar::List::Utils};
+# map some install-names to a module/version combo
+# serves both as a grandfathered title-less tarball, and
+# as a minimum version check for upgraded core modules
+my $eval_map = {
+
+  # this is temporary, will need something more robust down the road
+  # (perhaps by then Module::CoreList will be dep-free)
+  "Module::Build" => { ver => "0.4214" },
+  "podlators" => { mod => "Pod::Man", ver => "2.17" },
+
+  "File::Spec" => { ver => "3.47" },
+  "Cwd" => { ver => "3.47" },
+
+  "List::Util" => { ver => "1.42" },
+  "Scalar::Util" => { ver => "1.42" },
+  "Scalar::List::Utils" => { mod => "List::Util", ver => "1.42" },
+};
+
+my $m = $eval_map->{$mod}{mod} || $mod;
 
-eval qq{require($mod)} or ( print $@ and exit 1)
+eval(
+  "require $m"
+
+  .
+
+  ($eval_map->{$mod}{ver}
+    ? "; $m->VERSION(\$eval_map->{\$mod}{ver}) "
+    : ""
+  )
+
+  .
+
+  "; 1"
+)
+  or
+( print $@ and exit 1)
 
       ' "$m" 2> /dev/null ; then
         echo -e "$m installation seems to have failed"
@@ -253,9 +289,14 @@ purge_sitelib() {
         { (my $mp = $_ . ".pm" ) =~ s|::|/|g; $mp }
         grep
           { $mcl_source !~ / ^ \s+ \x27 $_ \x27 \s* \=\> /mx }
-          keys %{ DBIx::Class::Optional::Dependencies->modreq_list_for([
-            keys %{ DBIx::Class::Optional::Dependencies->req_group_list }
-          ])}
+          (
+            qw(
+              Module::Build::Tiny
+            ),
+            keys %{ DBIx::Class::Optional::Dependencies->modreq_list_for([
+              keys %{ DBIx::Class::Optional::Dependencies->req_group_list }
+            ])}
+          )
       ;
 
       # now that we have the list we can go ahead and destroy every single one
@@ -279,3 +320,5 @@ purge_sitelib() {
 CPAN_is_sane() { perl -MCPAN\ 1.94_56 -e 1 &>/dev/null ; }
 
 CPAN_supports_BUILDPL() { perl -MCPAN\ 1.9205 -e1 &>/dev/null; }
+
+have_sudo() { sudo /bin/true &>/dev/null ; }