From cc1b6d394e2e65575b29093b6a63af7a7b30e4ec Mon Sep 17 00:00:00 2001 From: Michael Bishop Date: Fri, 20 Sep 2024 04:08:22 -0300 Subject: [PATCH 1/2] fix the binary cache calling isValidPath, and 2 other files with the same issue --- src/lib/Hydra/Controller/Root.pm | 2 +- src/lib/Hydra/Plugin/S3Backup.pm | 2 +- src/lib/Hydra/Plugin/SubversionInput.pm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 473892511..75d35ac3c 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -329,7 +329,7 @@ sub nar :Local :Args(1) { else { $path = $Nix::Config::storeDir . "/$path"; - gone($c, "Path " . $path . " is no longer available.") unless isValidPath($path); + gone($c, "Path " . $path . " is no longer available.") unless $MACHINE_LOCAL_STORE->isValidPath($path); $c->stash->{current_view} = 'NixNAR'; $c->stash->{storePath} = $path; diff --git a/src/lib/Hydra/Plugin/S3Backup.pm b/src/lib/Hydra/Plugin/S3Backup.pm index 98e797478..a0d678510 100644 --- a/src/lib/Hydra/Plugin/S3Backup.pm +++ b/src/lib/Hydra/Plugin/S3Backup.pm @@ -92,7 +92,7 @@ sub buildFinished { my $hash = substr basename($path), 0, 32; my ($deriver, $narHash, $time, $narSize, $refs) = queryPathInfo($path, 0); my $system; - if (defined $deriver and isValidPath($deriver)) { + if (defined $deriver and $MACHINE_LOCAL_STORE->isValidPath($deriver)) { $system = derivationFromPath($deriver)->{platform}; } foreach my $reference (@{$refs}) { diff --git a/src/lib/Hydra/Plugin/SubversionInput.pm b/src/lib/Hydra/Plugin/SubversionInput.pm index 83c1f39d2..d3579c40f 100644 --- a/src/lib/Hydra/Plugin/SubversionInput.pm +++ b/src/lib/Hydra/Plugin/SubversionInput.pm @@ -46,7 +46,7 @@ sub fetchInput { $MACHINE_LOCAL_STORE->addTempRoot($cachedInput->storepath) if defined $cachedInput; - if (defined $cachedInput && isValidPath($cachedInput->storepath)) { + if (defined $cachedInput && $MACHINE_LOCAL_STORE->isValidPath($cachedInput->storepath)) { $storePath = $cachedInput->storepath; $sha256 = $cachedInput->sha256hash; } else { From 1ef6b5e7b467c67c085facca909f3eafc33d9b55 Mon Sep 17 00:00:00 2001 From: hacker1024 Date: Wed, 21 Aug 2024 22:13:38 +1000 Subject: [PATCH 2/2] Use Nix::Store and Nix::Utils in NARInfo.pm These are required for the `signString` and `readFile` subroutines used when signing NARs. (cherry picked from commit b94a7b6d5c56362af9ea85d944f8454d861ec001) --- src/lib/Hydra/View/NARInfo.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/Hydra/View/NARInfo.pm b/src/lib/Hydra/View/NARInfo.pm index bf8711a4a..801fc06a5 100644 --- a/src/lib/Hydra/View/NARInfo.pm +++ b/src/lib/Hydra/View/NARInfo.pm @@ -6,6 +6,8 @@ use File::Basename; use Hydra::Helper::CatalystUtils; use MIME::Base64; use Nix::Manifest; +use Nix::Store; +use Nix::Utils; use Hydra::Helper::Nix; use base qw/Catalyst::View/;