From dcf386cfedc392cd68f194e9f70f289d22441d8b Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Wed, 13 Feb 2013 13:09:07 +0100 Subject: [PATCH] Make getDrvLogPath work with both bucketed and non-bucketed nix logs. --- src/lib/Hydra/Helper/Nix.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index 93dc3bf7..024194a6 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -253,13 +253,11 @@ sub getLatestSuccessfulViewResult { sub getDrvLogPath { my ($drvPath) = @_; my $base = basename $drvPath; - my $fn = - ($ENV{NIX_LOG_DIR} || "/nix/var/log/nix") . "/drvs/" - . substr($base, 0, 2) . "/" - . substr($base, 2); - return $fn if -f $fn; - $fn .= ".bz2"; - return $fn if -f $fn; + my $bucketed = substr($base, 0, 2) . "/" . substr($base, 2); + my $fn = ($ENV{NIX_LOG_DIR} || "/nix/var/log/nix") . "/drvs/"; + for ($fn . $bucketed . ".bz2", $fn . $bucketed, $fn . $base . ".bz2", $fn . $base) { + return $_ if (-f $_); + } return undef; }