Skip to content

Get rid of addWantedOutputs #13240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libfetchers/include/nix/fetchers/input-cache.hh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "fetchers.hh"
#include "nix/fetchers/fetchers.hh"

namespace nix::fetchers {

Expand Down
24 changes: 11 additions & 13 deletions src/libstore/build/derivation-building-goal.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "nix/store/build/derivation-building-goal.hh"
#include "nix/store/build/derivation-goal.hh"
#include "nix/store/build/derivation-trampoline-goal.hh"
#ifndef _WIN32 // TODO enable build hook on Windows
# include "nix/store/build/hook-instance.hh"
# include "nix/store/build/derivation-builder.hh"
Expand Down Expand Up @@ -266,7 +266,7 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()
auto mEntry = get(inputGoals, drvPath);
if (!mEntry) return std::nullopt;

auto buildResult = (*mEntry)->getBuildResult(DerivedPath::Built{drvPath, OutputsSpec::Names{outputName}});
auto & buildResult = (*mEntry)->buildResult;
if (!buildResult.success()) return std::nullopt;

auto i = get(buildResult.builtOutputs, outputName);
Expand Down Expand Up @@ -296,30 +296,28 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()
worker.store.printStorePath(pathResolved),
});

// FIXME wanted outputs
auto resolvedDrvGoal = worker.makeDerivationGoal(
makeConstantStorePathRef(pathResolved), OutputsSpec::All{}, buildMode);
/* TODO https://github.com/NixOS/nix/issues/13247 we should
let the calling goal do this, so it has a change to pass
just the output(s) it cares about. */
auto resolvedDrvGoal = worker.makeDerivationTrampolineGoal(
pathResolved, OutputsSpec::All{}, drvResolved, buildMode);
{
Goals waitees{resolvedDrvGoal};
co_await await(std::move(waitees));
}

trace("resolved derivation finished");

auto resolvedDrv = *resolvedDrvGoal->drv;
auto resolvedResult = resolvedDrvGoal->getBuildResult(DerivedPath::Built{
.drvPath = makeConstantStorePathRef(pathResolved),
.outputs = OutputsSpec::All{},
});
auto resolvedResult = resolvedDrvGoal->buildResult;

SingleDrvOutputs builtOutputs;

if (resolvedResult.success()) {
auto resolvedHashes = staticOutputHashes(worker.store, resolvedDrv);
auto resolvedHashes = staticOutputHashes(worker.store, drvResolved);

StorePathSet outputPaths;

for (auto & outputName : resolvedDrv.outputNames()) {
for (auto & outputName : drvResolved.outputNames()) {
auto initialOutput = get(initialOutputs, outputName);
auto resolvedHash = get(resolvedHashes, outputName);
if ((!initialOutput) || (!resolvedHash))
Expand All @@ -340,7 +338,7 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()

throw Error(
"derivation '%s' doesn't have expected output '%s' (derivation-goal.cc/realisation)",
resolvedDrvGoal->drvReq->to_string(worker.store), outputName);
worker.store.printStorePath(pathResolved), outputName);
}();

if (!drv->type().isImpure()) {
Expand Down
Loading
Loading