1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

Merge pull request #14257 from obsidiansystems/misc-builder-tech-debt

Cleanup misc builder tech debt
This commit is contained in:
John Ericson 2025-10-15 17:28:27 +00:00 committed by GitHub
commit a543519ca9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 6 additions and 20 deletions

View file

@ -100,8 +100,7 @@ Goal::Co DerivationGoal::haveDerivation(bool storeDerivation)
them. */ them. */
if (settings.useSubstitutes && drvOptions.substitutesAllowed()) { if (settings.useSubstitutes && drvOptions.substitutesAllowed()) {
if (!checkResult) if (!checkResult)
waitees.insert(upcast_goal(worker.makeDrvOutputSubstitutionGoal( waitees.insert(upcast_goal(worker.makeDrvOutputSubstitutionGoal(DrvOutput{outputHash, wantedOutput})));
DrvOutput{outputHash, wantedOutput}, buildMode == bmRepair ? Repair : NoRepair)));
else { else {
auto * cap = getDerivationCA(*drv); auto * cap = getDerivationCA(*drv);
waitees.insert(upcast_goal(worker.makePathSubstitutionGoal( waitees.insert(upcast_goal(worker.makePathSubstitutionGoal(
@ -171,8 +170,6 @@ Goal::Co DerivationGoal::haveDerivation(bool storeDerivation)
auto outputHashes = staticOutputHashes(worker.evalStore, *drv); auto outputHashes = staticOutputHashes(worker.evalStore, *drv);
auto resolvedHashes = staticOutputHashes(worker.store, drvResolved); auto resolvedHashes = staticOutputHashes(worker.store, drvResolved);
StorePathSet outputPaths;
auto outputHash = get(outputHashes, wantedOutput); auto outputHash = get(outputHashes, wantedOutput);
auto resolvedHash = get(resolvedHashes, wantedOutput); auto resolvedHash = get(resolvedHashes, wantedOutput);
if ((!outputHash) || (!resolvedHash)) if ((!outputHash) || (!resolvedHash))
@ -212,7 +209,6 @@ Goal::Co DerivationGoal::haveDerivation(bool storeDerivation)
worker.store.signRealisation(newRealisation); worker.store.signRealisation(newRealisation);
worker.store.registerDrvOutput(newRealisation); worker.store.registerDrvOutput(newRealisation);
} }
outputPaths.insert(realisation.outPath);
auto status = success.status; auto status = success.status;
if (status == BuildResult::Success::AlreadyValid) if (status == BuildResult::Success::AlreadyValid)

View file

@ -8,8 +8,7 @@
namespace nix { namespace nix {
DrvOutputSubstitutionGoal::DrvOutputSubstitutionGoal( DrvOutputSubstitutionGoal::DrvOutputSubstitutionGoal(const DrvOutput & id, Worker & worker)
const DrvOutput & id, Worker & worker, RepairFlag repair, std::optional<ContentAddress> ca)
: Goal(worker, init()) : Goal(worker, init())
, id(id) , id(id)
{ {

View file

@ -104,10 +104,9 @@ Worker::makePathSubstitutionGoal(const StorePath & path, RepairFlag repair, std:
return initGoalIfNeeded(substitutionGoals[path], path, *this, repair, ca); return initGoalIfNeeded(substitutionGoals[path], path, *this, repair, ca);
} }
std::shared_ptr<DrvOutputSubstitutionGoal> std::shared_ptr<DrvOutputSubstitutionGoal> Worker::makeDrvOutputSubstitutionGoal(const DrvOutput & id)
Worker::makeDrvOutputSubstitutionGoal(const DrvOutput & id, RepairFlag repair, std::optional<ContentAddress> ca)
{ {
return initGoalIfNeeded(drvOutputSubstitutionGoals[id], id, *this, repair, ca); return initGoalIfNeeded(drvOutputSubstitutionGoals[id], id, *this);
} }
GoalPtr Worker::makeGoal(const DerivedPath & req, BuildMode buildMode) GoalPtr Worker::makeGoal(const DerivedPath & req, BuildMode buildMode)

View file

@ -29,14 +29,7 @@ class DrvOutputSubstitutionGoal : public Goal
DrvOutput id; DrvOutput id;
public: public:
DrvOutputSubstitutionGoal( DrvOutputSubstitutionGoal(const DrvOutput & id, Worker & worker);
const DrvOutput & id,
Worker & worker,
RepairFlag repair = NoRepair,
std::optional<ContentAddress> ca = std::nullopt);
typedef void (DrvOutputSubstitutionGoal::*GoalState)();
GoalState state;
Co init(); Co init();
Co realisationFetched(Goals waitees, std::shared_ptr<const Realisation> outputInfo, nix::ref<nix::Store> sub); Co realisationFetched(Goals waitees, std::shared_ptr<const Realisation> outputInfo, nix::ref<nix::Store> sub);

View file

@ -240,8 +240,7 @@ public:
*/ */
std::shared_ptr<PathSubstitutionGoal> makePathSubstitutionGoal( std::shared_ptr<PathSubstitutionGoal> makePathSubstitutionGoal(
const StorePath & storePath, RepairFlag repair = NoRepair, std::optional<ContentAddress> ca = std::nullopt); const StorePath & storePath, RepairFlag repair = NoRepair, std::optional<ContentAddress> ca = std::nullopt);
std::shared_ptr<DrvOutputSubstitutionGoal> makeDrvOutputSubstitutionGoal( std::shared_ptr<DrvOutputSubstitutionGoal> makeDrvOutputSubstitutionGoal(const DrvOutput & id);
const DrvOutput & id, RepairFlag repair = NoRepair, std::optional<ContentAddress> ca = std::nullopt);
/** /**
* Make a goal corresponding to the `DerivedPath`. * Make a goal corresponding to the `DerivedPath`.