mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
exportReferencesGraph: Allow exporting a list of store paths
This commit is contained in:
parent
8191992c83
commit
82327e3cc4
2 changed files with 23 additions and 15 deletions
|
@ -1742,8 +1742,12 @@ int childEntry(void * arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PathSet exportReferences(Store & store, Path storePath)
|
PathSet exportReferences(Store & store, PathSet storePaths)
|
||||||
{
|
{
|
||||||
|
PathSet paths;
|
||||||
|
|
||||||
|
for (auto storePath : storePaths) {
|
||||||
|
|
||||||
/* Check that the store path is valid. */
|
/* Check that the store path is valid. */
|
||||||
if (!store.isInStore(storePath))
|
if (!store.isInStore(storePath))
|
||||||
throw BuildError(format("'exportReferencesGraph' contains a non-store path '%1%'")
|
throw BuildError(format("'exportReferencesGraph' contains a non-store path '%1%'")
|
||||||
|
@ -1753,13 +1757,14 @@ PathSet exportReferences(Store & store, Path storePath)
|
||||||
throw BuildError(format("'exportReferencesGraph' contains an invalid path '%1%'")
|
throw BuildError(format("'exportReferencesGraph' contains an invalid path '%1%'")
|
||||||
% storePath);
|
% storePath);
|
||||||
|
|
||||||
|
store.computeFSClosure(storePath, paths);
|
||||||
|
}
|
||||||
|
|
||||||
/* If there are derivations in the graph, then include their
|
/* If there are derivations in the graph, then include their
|
||||||
outputs as well. This is useful if you want to do things
|
outputs as well. This is useful if you want to do things
|
||||||
like passing all build-time dependencies of some path to a
|
like passing all build-time dependencies of some path to a
|
||||||
derivation that builds a NixOS DVD image. */
|
derivation that builds a NixOS DVD image. */
|
||||||
PathSet paths, paths2;
|
PathSet paths2(paths);
|
||||||
store.computeFSClosure(storePath, paths);
|
|
||||||
paths2 = paths;
|
|
||||||
|
|
||||||
for (auto & j : paths2) {
|
for (auto & j : paths2) {
|
||||||
if (isDerivation(j)) {
|
if (isDerivation(j)) {
|
||||||
|
@ -1868,7 +1873,7 @@ void DerivationGoal::startBuilder()
|
||||||
/* Write closure info to <fileName>. */
|
/* Write closure info to <fileName>. */
|
||||||
writeFile(tmpDir + "/" + fileName,
|
writeFile(tmpDir + "/" + fileName,
|
||||||
worker.store.makeValidityRegistration(
|
worker.store.makeValidityRegistration(
|
||||||
exportReferences(worker.store, storePath), false, false));
|
exportReferences(worker.store, {storePath}), false, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2366,8 +2371,11 @@ void DerivationGoal::writeStructuredAttrs()
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
{
|
{
|
||||||
JSONPlaceholder jsonRoot(str, true);
|
JSONPlaceholder jsonRoot(str, true);
|
||||||
|
PathSet storePaths;
|
||||||
|
for (auto & p : *i)
|
||||||
|
storePaths.insert(p.get<std::string>());
|
||||||
worker.store.pathInfoToJSON(jsonRoot,
|
worker.store.pathInfoToJSON(jsonRoot,
|
||||||
exportReferences(worker.store, i->get<std::string>()), false, true);
|
exportReferences(worker.store, storePaths), false, true);
|
||||||
}
|
}
|
||||||
json[i.key()] = nlohmann::json::parse(str.str()); // urgh
|
json[i.key()] = nlohmann::json::parse(str.str()); // urgh
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,5 +62,5 @@ mkDerivation {
|
||||||
"1foobar" = "BAD";
|
"1foobar" = "BAD";
|
||||||
"foo$" = "BAD";
|
"foo$" = "BAD";
|
||||||
|
|
||||||
exportReferencesGraph.refs = dep;
|
exportReferencesGraph.refs = [ dep ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue