|
22 | 22 | #include "posix-fs-canonicalise.hh" |
23 | 23 | #include "posix-source-accessor.hh" |
24 | 24 |
|
25 | | -#include <regex> |
26 | 25 | #include <queue> |
27 | 26 |
|
28 | 27 | #include <sys/un.h> |
@@ -976,32 +975,11 @@ void LocalDerivationGoal::startBuilder() |
976 | 975 |
|
977 | 976 | /* Handle exportReferencesGraph(), if set. */ |
978 | 977 | if (!parsedDrv->hasStructuredAttrs()) { |
979 | | - /* The `exportReferencesGraph' feature allows the references graph |
980 | | - to be passed to a builder. This attribute should be a list of |
981 | | - pairs [name1 path1 name2 path2 ...]. The references graph of |
982 | | - each `pathN' will be stored in a text file `nameN' in the |
983 | | - temporary build directory. The text files have the format used |
984 | | - by `nix-store --register-validity'. However, the deriver |
985 | | - fields are left empty. */ |
986 | | - auto s = getOr(drv->env, "exportReferencesGraph", ""); |
987 | | - Strings ss = tokenizeString<Strings>(s); |
988 | | - if (ss.size() % 2 != 0) |
989 | | - throw BuildError("odd number of tokens in 'exportReferencesGraph': '%1%'", s); |
990 | | - for (Strings::iterator i = ss.begin(); i != ss.end(); ) { |
991 | | - auto fileName = *i++; |
992 | | - static std::regex regex("[A-Za-z_][A-Za-z0-9_.-]*"); |
993 | | - if (!std::regex_match(fileName, regex)) |
994 | | - throw Error("invalid file name '%s' in 'exportReferencesGraph'", fileName); |
995 | | - |
996 | | - auto storePathS = *i++; |
997 | | - if (!worker.store.isInStore(storePathS)) |
998 | | - throw BuildError("'exportReferencesGraph' contains a non-store path '%1%'", storePathS); |
999 | | - auto storePath = worker.store.toStorePath(storePathS).first; |
1000 | | - |
| 978 | + for (auto & [fileName, storePathSet] : drvOptions->exportReferencesGraph) { |
1001 | 979 | /* Write closure info to <fileName>. */ |
1002 | 980 | writeFile(tmpDir + "/" + fileName, |
1003 | 981 | worker.store.makeValidityRegistration( |
1004 | | - worker.store.exportReferences({storePath}, inputPaths), false, false)); |
| 982 | + worker.store.exportReferences(storePathSet, inputPaths), false, false)); |
1005 | 983 | } |
1006 | 984 | } |
1007 | 985 |
|
@@ -1595,7 +1573,7 @@ void LocalDerivationGoal::initEnv() |
1595 | 1573 |
|
1596 | 1574 | void LocalDerivationGoal::writeStructuredAttrs() |
1597 | 1575 | { |
1598 | | - if (auto structAttrsJson = parsedDrv->prepareStructuredAttrs(worker.store, inputPaths)) { |
| 1576 | + if (auto structAttrsJson = parsedDrv->prepareStructuredAttrs(worker.store, *drvOptions, inputPaths)) { |
1599 | 1577 | auto json = structAttrsJson.value(); |
1600 | 1578 | nlohmann::json rewritten; |
1601 | 1579 | for (auto & [i, v] : json["outputs"].get<nlohmann::json::object_t>()) { |
|
0 commit comments