Skip to content

Commit

Permalink
resolving #73742: lost build_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
andk committed Mar 19, 2012
1 parent 938d885 commit 3895138
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,3 +1,5 @@
* RT #73742: watch build_dirs and react calmly when one has gone lost

2011-08-07 Andreas J. Koenig <andk@cpan.org>

* release 1.9800
Expand Down
23 changes: 21 additions & 2 deletions lib/CPAN.pm
Expand Up @@ -1316,9 +1316,28 @@ sub is_installed {

sub _list_sorted_descending_is_tested {
my($self) = @_;
sort
my $foul = 0;
my @sorted = sort
{ ($self->{is_tested}{$b}||0) <=> ($self->{is_tested}{$a}||0) }
keys %{$self->{is_tested}}
grep
{ if ($foul){ 0 } elsif (-e) { 1 } else { $foul = $_; 0 } }
keys %{$self->{is_tested}};
if ($foul) {
$CPAN::Frontend->mywarn("Lost build_dir detected ($foul), giving up all cached test results of currently running session.\n");
for my $dbd (keys %{$self->{is_tested}}) { # distro-build-dir
SEARCH: for my $d ($CPAN::META->all_objects("CPAN::Distribution")) {
if ($d->{build_dir} && $d->{build_dir} eq $dbd) {
$CPAN::Frontend->mywarn(sprintf "Flushing cache for %s\n", $d->pretty_id);
$d->fforce("");
last SEARCH;
}
}
delete $self->{is_tested}{$dbd};
}
return ();
} else {
return @sorted;
}
}

#-> sub CPAN::set_perl5lib
Expand Down

0 comments on commit 3895138

Please sign in to comment.