[libmoosex-has-sugar-perl] 42/120: Report failure from cpanm

Intrigeri intrigeri at moszumanska.debian.org
Wed Aug 27 21:35:09 UTC 2014


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to annotated tag 0.05070422-source
in repository libmoosex-has-sugar-perl.

commit e7f9b4eeeb928a58e443e7906e3a9d090231395f
Author: Kent Fredric <kentfredric at gmail.com>
Date:   Thu Oct 24 10:25:03 2013 +1300

    Report failure from cpanm
---
 report_fail_ctx.pl | 42 ++++++++++++++++++++++++++++++++++++++++++
 yamls/sterile.yaml |  2 ++
 2 files changed, 44 insertions(+)

diff --git a/report_fail_ctx.pl b/report_fail_ctx.pl
new file mode 100644
index 0000000..fc62f44
--- /dev/null
+++ b/report_fail_ctx.pl
@@ -0,0 +1,42 @@
+#!/usr/bin/env perl 
+
+use strict;
+use warnings;
+use utf8;
+
+sub diag { print STDERR @_; print STDERR "\n" }
+sub env_exists { return exists $ENV{ $_[0] } }
+sub env_true   { return ( env_exists( $_[0] ) and $ENV{ $_[0] } ) }
+sub env_is     { return ( env_exists( $_[0] ) and $ENV{ $_[0] } eq $_[1] ) }
+
+sub safe_exec_nonfatal {
+  my ( $command, @params ) = @_;
+  diag("running $command @params");
+  my $exit = system( $command, @params );
+  if ( $exit != 0 ) {
+    my $low  = $exit & 0b11111111;
+    my $high = $exit >> 8;
+    warn "$command failed: $? $! and exit = $high , flags = $low";
+    if ( $high != 0 ) {
+      return $high;
+    }
+    else {
+      return 1;
+    }
+
+  }
+  return 0;
+}
+
+sub safe_exec {
+  my ( $command, @params ) = @_;
+  my $exit_code = safe_exec_nonfatal( $command, @params );
+  if ( $exit_code != 0 ) {
+    exit $exit_code;
+  }
+  return 1;
+}
+
+diag("Last 1000 lines of cpanm build log");
+safe_exec('tail', '-n', '1000',  $ENV{HOME} . '/.cpanm/build.log');
+
diff --git a/yamls/sterile.yaml b/yamls/sterile.yaml
index 89985b7..c700aa6 100644
--- a/yamls/sterile.yaml
+++ b/yamls/sterile.yaml
@@ -32,6 +32,8 @@ before_script:
   - time perl ./maint-travis-ci/before_script.pl
 script:
   - time perl ./maint-travis-ci/script.pl
+after_failure:
+  - perl ./maint-travis-ci/report_fail_ctx.pl
 branches:
   only:
     - "build/master"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmoosex-has-sugar-perl.git



More information about the Pkg-perl-cvs-commits mailing list