Re: [Module-build-general] [PATCH] - really fix add_to_cleanup
Status: Beta
Brought to you by:
kwilliams
|
From: Dave R. <au...@ur...> - 2003-04-24 14:37:59
|
On Thu, 24 Apr 2003, Dave Rolsky wrote: > Ken, you changed my patch in a way that broke it. Unfortunately, my test > case wasn't very good, so it didn't catch it. > > Here's another patch that fixes this problem again and adds a test case > that actually tests it ;) Except this broke the XS tests cause it wasn't quite right. Ok, here it is yet again, totally freaking working! -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ ? t/XSTest/lib/XSTest.bs ? t/XSTest/lib/XSTest.c Index: lib/Module/Build/Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.95 diff -u -r1.95 Base.pm --- lib/Module/Build/Base.pm 21 Apr 2003 20:54:40 -0000 1.95 +++ lib/Module/Build/Base.pm 24 Apr 2003 14:36:13 -0000 @@ -307,8 +307,8 @@ } else { # No state file is being used. Maybe it will later, but for now # just save in memory. - @{$self->{add_to_cleanup}}{ @new_files } = (); + return; } @{$self->{cleanup}}{ @new_files } = (); @@ -953,7 +953,7 @@ sub ACTION_clean { my ($self) = @_; - foreach my $item (keys %{$self->{cleanup}}) { + foreach my $item (keys %{$self->{cleanup}}, keys %{$self->{add_to_cleanup}}) { $self->delete_filetree($item); } } Index: t/runthrough.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/runthrough.t,v retrieving revision 1.15 diff -u -r1.15 runthrough.t --- t/runthrough.t 21 Apr 2003 19:44:04 -0000 1.15 +++ t/runthrough.t 24 Apr 2003 14:36:13 -0000 @@ -3,6 +3,7 @@ use Module::Build; use File::Spec; use File::Path; +use IO::File; my $HAVE_YAML = eval {require YAML; 1}; my $HAVE_SIGNATURE = eval {require Module::Signature; 1}; @@ -28,9 +29,19 @@ eval {$build->create_build_script}; ok $@, ''; -ok grep $_ eq 'before_script', keys %{$build->{cleanup}}; - +# Do this here to force it to write cleanup file $build->add_to_cleanup('save_out'); + +my $cleanup = $build->config_file('cleanup'); +my $fh = IO::File->new("<$cleanup") + or die "Cannot read $cleanup: $!"; +my $found = 0; +while (<$fh>) { + chomp; + $found = 1 if $_ eq 'before_script'; +} +ok $found; + my $output = eval { stdout_of( sub { $build->dispatch('test', verbose => 1) } ) }; |