aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-14 16:38:43 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-14 16:42:03 -0500
commitb3d91239ae9f21a60057b278ceeff663fb786246 (patch)
treee5c910beda88a280b197d27cc269595d667d988b /src/libstore/build
parent056cc1c1b903114f59c536dd9821b46f68516f4e (diff)
Make `ValidPathInfo` have plain `StorePathSet` references like before
This change can wait for another PR.
Diffstat (limited to 'src/libstore/build')
-rw-r--r--src/libstore/build/local-derivation-goal.cc11
-rw-r--r--src/libstore/build/substitution-goal.cc10
2 files changed, 13 insertions, 8 deletions
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc
index d96858fc0..bb4f92989 100644
--- a/src/libstore/build/local-derivation-goal.cc
+++ b/src/libstore/build/local-derivation-goal.cc
@@ -2523,7 +2523,10 @@ DrvOutputs LocalDerivationGoal::registerOutputs()
auto narHashAndSize = hashPath(htSHA256, actualPath);
ValidPathInfo newInfo0 { requiredFinalPath, narHashAndSize.first };
newInfo0.narSize = narHashAndSize.second;
- newInfo0.references = rewriteRefs();
+ auto refs = rewriteRefs();
+ newInfo0.references = std::move(refs.others);
+ if (refs.self)
+ newInfo0.references.insert(newInfo0.path);
return newInfo0;
},
@@ -2774,12 +2777,12 @@ void LocalDerivationGoal::checkOutputs(const std::map<std::string, ValidPathInfo
auto i = outputsByPath.find(worker.store.printStorePath(path));
if (i != outputsByPath.end()) {
closureSize += i->second.narSize;
- for (auto & ref : i->second.referencesPossiblyToSelf())
+ for (auto & ref : i->second.references)
pathsLeft.push(ref);
} else {
auto info = worker.store.queryPathInfo(path);
closureSize += info->narSize;
- for (auto & ref : info->referencesPossiblyToSelf())
+ for (auto & ref : info->references)
pathsLeft.push(ref);
}
}
@@ -2819,7 +2822,7 @@ void LocalDerivationGoal::checkOutputs(const std::map<std::string, ValidPathInfo
auto used = recursive
? getClosure(info.path).first
- : info.referencesPossiblyToSelf();
+ : info.references;
if (recursive && checks.ignoreSelfRefs)
used.erase(info.path);
diff --git a/src/libstore/build/substitution-goal.cc b/src/libstore/build/substitution-goal.cc
index 36b0ea7a7..994cb4ac2 100644
--- a/src/libstore/build/substitution-goal.cc
+++ b/src/libstore/build/substitution-goal.cc
@@ -165,8 +165,9 @@ void PathSubstitutionGoal::tryNext()
/* To maintain the closure invariant, we first have to realise the
paths referenced by this one. */
- for (auto & i : info->references.others)
- addWaitee(worker.makePathSubstitutionGoal(i));
+ for (auto & i : info->references)
+ if (i != storePath) /* ignore self-references */
+ addWaitee(worker.makePathSubstitutionGoal(i));
if (waitees.empty()) /* to prevent hang (no wake-up event) */
referencesValid();
@@ -187,8 +188,9 @@ void PathSubstitutionGoal::referencesValid()
return;
}
- for (auto & i : info->references.others)
- assert(worker.store.isValidPath(i));
+ for (auto & i : info->references)
+ if (i != storePath) /* ignore self-references */
+ assert(worker.store.isValidPath(i));
state = &PathSubstitutionGoal::tryToRun;
worker.wakeUp(shared_from_this());