From 2a240e458e41ef94dadab6d7cd6e2be79900a6c9 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 10 Aug 2015 08:02:10 -0400 Subject: [PATCH 1/5] Pass along drvPath and outputName for inputs that are previous builds. This allows importing the .drv and getting the same store paths as if the input had been passed in as nix expressions defining a proper derivation. --- src/lib/Hydra/Helper/AddBuilds.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm index 6137e2ca..416aa2b0 100644 --- a/src/lib/Hydra/Helper/AddBuilds.pm +++ b/src/lib/Hydra/Helper/AddBuilds.pm @@ -105,10 +105,14 @@ sub fetchInputBuild { my $relName = ($prevBuild->releasename or $prevBuild->nixname); my $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/; + my $mainOutput = getMainOutput($prevBuild); + return - { storePath => getMainOutput($prevBuild)->path + { storePath => $mainOutput->path , id => $prevBuild->id , version => $version + , outputName => $mainOutput->name + , drvPath => $prevBuild->drvPath }; } @@ -279,6 +283,8 @@ sub buildInputToString { (defined $input->{gitTag} ? "; gitTag = \"" . $input->{gitTag} . "\"" : "") . (defined $input->{shortRev} ? "; shortRev = \"" . $input->{shortRev} . "\"" : "") . (defined $input->{version} ? "; version = \"" . $input->{version} . "\"" : "") . + (defined $input->{outputName} ? "; outputName = \"" . $input->{outputName} . "\"" : "") . + (defined $input->{drvPath} ? "; drvPath = " . $input->{drvPath} . "" : "") . ";}"; } return $result; From ce5ffa9fba0236b9b0739665b89bb60cd5357aa9 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 10 Aug 2015 13:47:39 -0400 Subject: [PATCH 2/5] Only pass the drv path if it is still valid --- src/lib/Hydra/Helper/AddBuilds.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm index 416aa2b0..5d72e7a7 100644 --- a/src/lib/Hydra/Helper/AddBuilds.pm +++ b/src/lib/Hydra/Helper/AddBuilds.pm @@ -107,13 +107,17 @@ sub fetchInputBuild { my $mainOutput = getMainOutput($prevBuild); - return + my $result = { storePath => $mainOutput->path , id => $prevBuild->id , version => $version , outputName => $mainOutput->name - , drvPath => $prevBuild->drvPath }; + if (isValidPath($prevBuild->drvPath)) { + $input->{drvPath} = $prevBuild->drvPath; + } + + return $result; } From 882b6b3377648ee9e8fa84a34b9ca57f4f3988f0 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 10 Aug 2015 13:48:09 -0400 Subject: [PATCH 3/5] Pass a build's drv path as a store path --- src/lib/Hydra/Helper/AddBuilds.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm index 5d72e7a7..88ea373d 100644 --- a/src/lib/Hydra/Helper/AddBuilds.pm +++ b/src/lib/Hydra/Helper/AddBuilds.pm @@ -288,7 +288,7 @@ sub buildInputToString { (defined $input->{shortRev} ? "; shortRev = \"" . $input->{shortRev} . "\"" : "") . (defined $input->{version} ? "; version = \"" . $input->{version} . "\"" : "") . (defined $input->{outputName} ? "; outputName = \"" . $input->{outputName} . "\"" : "") . - (defined $input->{drvPath} ? "; drvPath = " . $input->{drvPath} . "" : "") . + (defined $input->{drvPath} ? "; drvPath = builtins.storePath " . $input->{drvPath} . "" : "") . ";}"; } return $result; From 163e696813566a22c5bff8cd73b608473903358d Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 10 Aug 2015 13:52:40 -0400 Subject: [PATCH 4/5] Copy-paste error --- src/lib/Hydra/Helper/AddBuilds.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm index 88ea373d..b1fade59 100644 --- a/src/lib/Hydra/Helper/AddBuilds.pm +++ b/src/lib/Hydra/Helper/AddBuilds.pm @@ -114,7 +114,7 @@ sub fetchInputBuild { , outputName => $mainOutput->name }; if (isValidPath($prevBuild->drvPath)) { - $input->{drvPath} = $prevBuild->drvPath; + $result->{drvPath} = $prevBuild->drvPath; } return $result; From 1705ca41e7cd3ed21994ecf437b0545dee22171a Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 10 Aug 2015 13:59:22 -0400 Subject: [PATCH 5/5] Remove unneeded camelcase --- src/lib/Hydra/Helper/AddBuilds.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm index b1fade59..cbb8f2fd 100644 --- a/src/lib/Hydra/Helper/AddBuilds.pm +++ b/src/lib/Hydra/Helper/AddBuilds.pm @@ -113,8 +113,8 @@ sub fetchInputBuild { , version => $version , outputName => $mainOutput->name }; - if (isValidPath($prevBuild->drvPath)) { - $result->{drvPath} = $prevBuild->drvPath; + if (isValidPath($prevBuild->drvpath)) { + $result->{drvPath} = $prevBuild->drvpath; } return $result;