mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 23:12:44 +01:00
Deduplicate "export reference graph" logic a bit
The first part on `drvOptions.exportReferencesGraph` is the same in both cases. It is just how the information is finally rendered that is different.
This commit is contained in:
parent
ca86d34077
commit
2767ae35d9
4 changed files with 39 additions and 12 deletions
|
|
@ -785,17 +785,11 @@ void DerivationBuilderImpl::startBuilder()
|
|||
|
||||
/* Handle exportReferencesGraph(), if set. */
|
||||
if (!drv.structuredAttrs) {
|
||||
for (auto & [fileName, ss] : drvOptions.exportReferencesGraph) {
|
||||
StorePathSet storePathSet;
|
||||
for (auto & storePathS : ss) {
|
||||
if (!store.isInStore(storePathS))
|
||||
throw BuildError("'exportReferencesGraph' contains a non-store path '%1%'", storePathS);
|
||||
storePathSet.insert(store.toStorePath(storePathS).first);
|
||||
}
|
||||
for (auto & [fileName, storePaths] : drvOptions.getParsedExportReferencesGraph(store)) {
|
||||
/* Write closure info to <fileName>. */
|
||||
writeFile(
|
||||
tmpDir + "/" + fileName,
|
||||
store.makeValidityRegistration(store.exportReferences(storePathSet, inputPaths), false, false));
|
||||
store.makeValidityRegistration(store.exportReferences(storePaths, inputPaths), false, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue