workaround bizarre distro vs module confusion
[dbsrgits/DBIx-Class-Schema-Loader.git] / maint / travis-ci_scripts / common.bash
index da6ce33..e633705 100755 (executable)
@@ -12,7 +12,42 @@ if [[ "$TRAVIS" != "true" ]] ; then
   exit 1
 fi
 
-tstamp() { echo -n "[$(date '+%H:%M:%S')]" ; }
+tstamp() { echo -n "[$(date '+%H:%M:%S.%N')]" ; }
+
+ci_vm_state_text() {
+  echo "
+========================== CI System information ============================
+
+= CPUinfo
+$(perl -0777 -p -e 's/.+\n\n(?!\z)//s' < /proc/cpuinfo)
+
+= Meminfo
+$(free -m -t)
+
+= Diskinfo
+$(sudo df -h)
+
+$(mount | grep '^/')
+
+= Kernel info
+$(uname -a)
+
+= Network Configuration
+$(ip addr)
+
+= Network Sockets Status
+$(sudo netstat -an46p | grep -Pv '\s(CLOSING|(FIN|TIME|CLOSE)_WAIT.?|LAST_ACK)\s')
+
+= Processlist
+$(sudo ps fuxa)
+
+= Environment
+$(env | grep -P 'TEST|HARNESS|MAKE|TRAVIS|PERL|DBIC' | LC_ALL=C sort | cat -v)
+
+= Perl in use
+$(perl -V)
+============================================================================="
+}
 
 run_or_err() {
   echo_err -n "$(tstamp) $1 ... "
@@ -51,9 +86,6 @@ 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"
 }
 
@@ -83,7 +115,10 @@ extract_prereqs() {
     s/^\!.*//;
     s/^[^a-z]+//i;
     s/\-[^\-]+$/ /; # strip version part
-    s/\-/::/g
+    s/\-/::/g;
+    s/^\s*Snowball::Swedish\s*$/ Lingua::Stem::Snowball::Se /m; # distro->module
+    s/^\s*Snowball::Norwegian\s*$/ Lingua::Stem::Snowball::No /m;
+    s/^\s*Scalar::List::Utils\s*$/ List::Util /m;
   ' <<< "$OUT")
 
   # throw away what was in $@
@@ -95,6 +130,16 @@ extract_prereqs() {
   echo "$PQ"
 }
 
+listalldeps() {
+  # relies on sorted YAML
+  perl -lne '
+    next unless /^((?:build_)?requires:)/..($_ ne $1 and /^[^ ]/);
+    next if /^[^ ]/ or /^ *perl:/; # drop requires headers, or perl
+    s/^ *([^ ]*): .*/$1/;
+    print;
+  ' MYMETA.yml
+}
+
 parallel_installdeps_notest() {
   if [[ -z "$@" ]] ; then return; fi