also expose store path in json

This commit is contained in:
Jörg Thalheim 2021-12-31 12:00:04 +01:00
parent 14b78c41aa
commit 26948992b3
2 changed files with 6 additions and 3 deletions

View file

@ -171,10 +171,13 @@ static void worker(
throw EvalError("derivation must have a 'system' attribute");
auto drvPath = drv->queryDrvPath();
auto localStore = state.store.dynamic_pointer_cast<LocalFSStore>();
auto storePath = localStore->parseStorePath(drvPath);
reply["name"] = drv->queryName();
reply["system"] = drv->querySystem();
reply["drvPath"] = drvPath;
reply["storePath"] = localStore->printStorePath(storePath);
nlohmann::json meta;
for (auto & name : drv->queryMetaNames()) {
@ -196,9 +199,7 @@ static void worker(
/* Register the derivation as a GC root. !!! This
registers roots for jobs that we may have already
done. */
auto localStore = state.store.dynamic_pointer_cast<LocalFSStore>();
auto storePath = localStore->parseStorePath(drvPath);
if (gcRootsDir != "" && localStore) {
if (gcRootsDir != "") {
Path root = gcRootsDir + "/" + std::string(baseNameOf(drvPath));
if (!pathExists(root))
localStore->addPermRoot(storePath, root);

View file

@ -28,6 +28,8 @@ def common_test(extra_args: List[str]) -> None:
built_job = results[0]
assert built_job["attr"] == "builtJob"
assert built_job["name"] == "job1"
assert built_job["storePath"].startswith("/nix/store")
assert built_job["drvPath"].endswith(".drv")
substituted_job = results[1]