Make getDrvLogPath work with both bucketed and non-bucketed nix logs.

This commit is contained in:
Petr Rockai 2013-02-13 13:09:07 +01:00
parent bb8059e50c
commit dcf386cfed

View file

@ -253,13 +253,11 @@ sub getLatestSuccessfulViewResult {
sub getDrvLogPath { sub getDrvLogPath {
my ($drvPath) = @_; my ($drvPath) = @_;
my $base = basename $drvPath; my $base = basename $drvPath;
my $fn = my $bucketed = substr($base, 0, 2) . "/" . substr($base, 2);
($ENV{NIX_LOG_DIR} || "/nix/var/log/nix") . "/drvs/" my $fn = ($ENV{NIX_LOG_DIR} || "/nix/var/log/nix") . "/drvs/";
. substr($base, 0, 2) . "/" for ($fn . $bucketed . ".bz2", $fn . $bucketed, $fn . $base . ".bz2", $fn . $base) {
. substr($base, 2); return $_ if (-f $_);
return $fn if -f $fn; }
$fn .= ".bz2";
return $fn if -f $fn;
return undef; return undef;
} }