[libdist-zilla-role-bootstrap-perl] 12/101: Experimental hacks to support dzil building on master
Axel Beckert
abe at deuxchevaux.org
Sat Aug 8 11:58:31 UTC 2015
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to annotated tag 0.2.2-source
in repository libdist-zilla-role-bootstrap-perl.
commit 8d4c5337b9d7c1da67a4af9cfa2719c37a1df4fe
Author: Kent Fredric <kentfredric at gmail.com>
Date: Thu Oct 24 05:21:45 2013 +1300
Experimental hacks to support dzil building on master
---
install_deps.pl | 17 ++++++++++++++++-
script.pl | 37 ++++++++++++++++++++++++++++++-------
2 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/install_deps.pl b/install_deps.pl
index d569918..8d19949 100644
--- a/install_deps.pl
+++ b/install_deps.pl
@@ -6,6 +6,7 @@ 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 {
my ( $command, @params ) = @_;
@@ -31,10 +32,24 @@ if ( not env_exists('TRAVIS') ) {
}
my (@params) = qw[ --quiet --notest --mirror http://cpan.metacpan.org/ --no-man-pages ];
-if ( env_true('DEVELOPER_DEPS') ) {
+if ( env_true('DEVELOPER_DEPS') or env_is('TRAVIS_BRANCH','master') ) {
push @params, '--dev';
}
+if ( env_is('TRAVIS_BRANCH', 'master' ) ) {
+ safe_exec('cpanm', @params, 'Dist::Zilla', 'Capture::Tiny');
+}
safe_exec( 'cpanm', @params, '--installdeps', '.' );
+if ( env_is('TRAVIS_BRANCH', 'master' ) ) {
+ require Capture::Tiny;
+ my $stdout = Capture::Tiny::capture_stdout(sub {
+ safe_exec('dzil', 'authordeps', '--missing');
+ });
+ safe_exec('cpanm', @params, split /\n/, $stdout );
+ $stdout = Capture::Tiny::capture_stdout(sub {
+ safe_exec('dzil','listdeps', '--missing');
+ });
+ safe_exec('cpanm', @params, split /\n/, $stdout );
+}
if ( env_true('AUTHOR_TESTING') or env_true('RELEASE_TESTING') ) {
require CPAN::Meta;
my $meta = CPAN::Meta->load_file('META.json');
diff --git a/script.pl b/script.pl
index a9bc59b..d3cbec7 100644
--- a/script.pl
+++ b/script.pl
@@ -7,8 +7,9 @@ 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 {
+sub safe_exec_nonfatal {
my ( $command, @params ) = @_;
diag("running $command @params");
my $exit = system( $command, @params );
@@ -17,11 +18,21 @@ sub safe_exec {
my $high = $exit >> 8;
warn "$command failed: $? $! and exit = $high , flags = $low";
if ( $high != 0 ) {
- exit $high;
+ return $high;
}
else {
- exit 1;
+ 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;
}
@@ -31,9 +42,21 @@ if ( not env_exists('TRAVIS') ) {
exit 1;
}
-my @paths = './t';
+if ( env_is('TRAVIS_BRANCH', 'master' ) ) {
+ my $xtest = safe_exec_nonfatal('dzil','xtest');
+ my $test = safe_exec_nonfatal('dzil','test');
+ if ( $test != 0) {
+ exit $test;
+ }
+ if ( $xtest != 0 ){
+ exit $xtest;
+ }
+ exit 0;
+} else {
+ my @paths = './t';
-if ( env_true('AUTHOR_TESTING') or env_true('RELEASE_TESTING') ) {
- push @paths, './xt';
+ if ( env_true('AUTHOR_TESTING') or env_true('RELEASE_TESTING') ) {
+ push @paths, './xt';
+ }
+ safe_exec( 'prove', '--blib', '--shuffle', '--color', '--recurse', '--timer', '--jobs', 30, @paths );
}
-safe_exec( 'prove', '--blib', '--shuffle', '--color', '--recurse', '--timer', '--jobs', 30, @paths );
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-role-bootstrap-perl.git
More information about the Pkg-perl-cvs-commits
mailing list