From: Jos I. Boumans Date: Tue, 22 May 2007 14:45:19 +0000 (+0200) Subject: update CPANPLUS::Dist::Build to 0.06_01 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=078adea48b953fdf5a6f7d170d6c4c35dcab75f3;p=p5sagit%2Fp5-mst-13.2.git update CPANPLUS::Dist::Build to 0.06_01 From: "Jos I. Boumans" Message-Id: <208F4537-CCF8-401B-9F97-EF1902EA2FB6@dwim.org> p4raw-id: //depot/perl@31266 --- diff --git a/lib/CPANPLUS/Dist/Build.pm b/lib/CPANPLUS/Dist/Build.pm index 4d4aec0..bd08e39 100644 --- a/lib/CPANPLUS/Dist/Build.pm +++ b/lib/CPANPLUS/Dist/Build.pm @@ -29,7 +29,7 @@ use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; local $Params::Check::VERBOSE = 1; -$VERSION = '0.06'; +$VERSION = '0.06_01'; =pod @@ -535,10 +535,13 @@ sub create { ### send success on force... $test_fail++; - unless($force) { - $dist->status->test(0); - $fail++; last RUN; + if( !$force and !$cb->_callbacks->proceed_on_test_failure->( + $self, $@ ) + ) { + $dist->status->test(0); + $fail++; last RUN; } + } else { $dist->status->test(1); } diff --git a/lib/CPANPLUS/Dist/Build/t/01_CPANPLUS-Dist-Build-Constants.t b/lib/CPANPLUS/Dist/Build/t/01_CPANPLUS-Dist-Build-Constants.t index c7cb348..a1be084 100644 --- a/lib/CPANPLUS/Dist/Build/t/01_CPANPLUS-Dist-Build-Constants.t +++ b/lib/CPANPLUS/Dist/Build/t/01_CPANPLUS-Dist-Build-Constants.t @@ -1,3 +1,11 @@ +### make sure we can find our conf.pl file +BEGIN { + use FindBin; + require "$FindBin::Bin/inc/conf.pl"; +} + + + BEGIN { chdir 't' if -d 't' }; ### this is to make devel::cover happy ### diff --git a/lib/CPANPLUS/Dist/Build/t/02_CPANPLUS-Dist-Build.t b/lib/CPANPLUS/Dist/Build/t/02_CPANPLUS-Dist-Build.t index 9417cec..92da256 100644 --- a/lib/CPANPLUS/Dist/Build/t/02_CPANPLUS-Dist-Build.t +++ b/lib/CPANPLUS/Dist/Build/t/02_CPANPLUS-Dist-Build.t @@ -194,7 +194,12 @@ while( my($path,$need_cc) = each %Map ) { ### since we're die'ing in the Build.PL, do a local *STDERR, ### so we dont spam the result through the test -- this is expected ### behaviour after all. - my $rv = do { local *STDERR; $clone->prepare( force => 1 ) }; + ### also quell the warning for print() on unopened fh... + my $rv = do { + local $^W; + local *STDERR; + $clone->prepare( force => 1 ) + }; ok( !$rv, ' $mod->prepare failed' ); my $re = quotemeta( $build_pl ); @@ -209,7 +214,8 @@ while( my($path,$need_cc) = each %Map ) { sub find_module { my $module = shift; - # Don't add the .pm yet, in case it's a packlist or something like ExtUtils::xsubpp. + ### Don't add the .pm yet, in case it's a packlist or something + ### like ExtUtils::xsubpp. my $file = File::Spec->catfile( split m/::/, $module ); my $candidate; foreach (@INC) { diff --git a/lib/CPANPLUS/Dist/Build/t/inc/conf.pl b/lib/CPANPLUS/Dist/Build/t/inc/conf.pl index 1892922..ff77c61 100644 --- a/lib/CPANPLUS/Dist/Build/t/inc/conf.pl +++ b/lib/CPANPLUS/Dist/Build/t/inc/conf.pl @@ -62,6 +62,55 @@ use File::Basename qw[basename]; $Locale::Maketext::Lexicon::VERSION = 0; } +### clean up files for PERLCORE mostly -- make clean isn't invoked +### there... otoh, we should clean up after ourselves anyway. +END { + ### chdir to our own test dir, so we know all files are relative + ### to this point, no matter whether run from perlcore tests or + ### regular CPAN installs + chdir "$FindBin::Bin" if -d "$FindBin::Bin"; + + ### XXX hardcoded + _clean_test_dir( [qw|dummy-perl dummy-cpanplus| ] ); +} + +### whenever we start a new script, we want to clean out our +### old files from the test '.cpanplus' dir.. +sub _clean_test_dir { + my $dirs = shift || []; + my $verbose = shift || 0; + + for my $dir ( @$dirs ) { + + ### if it's not there, don't bother + next unless -d $dir; + + my $dh; + opendir $dh, $dir or die "Could not open basedir '$dir': $!"; + while( my $file = readdir $dh ) { + next if $file =~ /^\./; # skip dot files + + my $path = File::Spec->catfile( $dir, $file ); + + ### directory, rmtree it + if( -d $path ) { + print "Deleting directory '$path'\n" if $verbose; + eval { rmtree( $path ) }; + warn "Could not delete '$path' while cleaning up '$dir'" if $@; + + ### regular file + } else { + print "Deleting file '$path'\n" if $verbose; + 1 while unlink $path; + } + } + + close $dh; + } + + return 1; +} + 1; __END__ diff --git a/lib/CPANPLUS/Dist/Build/t/src/noxs/Foo-Bar-0.01.tar.gz.packed b/lib/CPANPLUS/Dist/Build/t/src/noxs/Foo-Bar-0.01.tar.gz.packed index e978261..cc2951c 100644 --- a/lib/CPANPLUS/Dist/Build/t/src/noxs/Foo-Bar-0.01.tar.gz.packed +++ b/lib/CPANPLUS/Dist/Build/t/src/noxs/Foo-Bar-0.01.tar.gz.packed @@ -10,7 +10,7 @@ To recreate it use the following command: uupacktool.pl -p lib/CPANPLUS/Dist/Build/t/src/noxs/Foo-Bar-0.01.tar.gz lib/CPANPLUS/Dist/Build/t/src/noxs/Foo-Bar-0.01.tar.gz.packed -Created at Fri May 4 14:00:53 2007 +Created at Tue May 22 13:44:00 2007 ######################################################################### __UU__ M'XL("-