Merge pull request #15 from nix-community/json
also expose store path in json
This commit is contained in:
commit
77aa769aef
|
@ -171,10 +171,13 @@ static void worker(
|
||||||
throw EvalError("derivation must have a 'system' attribute");
|
throw EvalError("derivation must have a 'system' attribute");
|
||||||
|
|
||||||
auto drvPath = drv->queryDrvPath();
|
auto drvPath = drv->queryDrvPath();
|
||||||
|
auto localStore = state.store.dynamic_pointer_cast<LocalFSStore>();
|
||||||
|
auto storePath = localStore->parseStorePath(drvPath);
|
||||||
|
|
||||||
reply["name"] = drv->queryName();
|
reply["name"] = drv->queryName();
|
||||||
reply["system"] = drv->querySystem();
|
reply["system"] = drv->querySystem();
|
||||||
reply["drvPath"] = drvPath;
|
reply["drvPath"] = drvPath;
|
||||||
|
reply["storePath"] = localStore->printStorePath(storePath);
|
||||||
|
|
||||||
nlohmann::json meta;
|
nlohmann::json meta;
|
||||||
for (auto & name : drv->queryMetaNames()) {
|
for (auto & name : drv->queryMetaNames()) {
|
||||||
|
@ -196,9 +199,7 @@ static void worker(
|
||||||
/* Register the derivation as a GC root. !!! This
|
/* Register the derivation as a GC root. !!! This
|
||||||
registers roots for jobs that we may have already
|
registers roots for jobs that we may have already
|
||||||
done. */
|
done. */
|
||||||
auto localStore = state.store.dynamic_pointer_cast<LocalFSStore>();
|
if (gcRootsDir != "") {
|
||||||
auto storePath = localStore->parseStorePath(drvPath);
|
|
||||||
if (gcRootsDir != "" && localStore) {
|
|
||||||
Path root = gcRootsDir + "/" + std::string(baseNameOf(drvPath));
|
Path root = gcRootsDir + "/" + std::string(baseNameOf(drvPath));
|
||||||
if (!pathExists(root))
|
if (!pathExists(root))
|
||||||
localStore->addPermRoot(storePath, root);
|
localStore->addPermRoot(storePath, root);
|
||||||
|
|
|
@ -28,6 +28,8 @@ def common_test(extra_args: List[str]) -> None:
|
||||||
built_job = results[0]
|
built_job = results[0]
|
||||||
assert built_job["attr"] == "builtJob"
|
assert built_job["attr"] == "builtJob"
|
||||||
assert built_job["name"] == "job1"
|
assert built_job["name"] == "job1"
|
||||||
|
assert built_job["storePath"].startswith("/nix/store")
|
||||||
|
assert built_job["drvPath"].endswith(".drv")
|
||||||
|
|
||||||
|
|
||||||
substituted_job = results[1]
|
substituted_job = results[1]
|
||||||
|
|
Loading…
Reference in a new issue