From 434376f8e1ef653e79b4c2b5a38cba45109152e4 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Thu, 26 Aug 2021 16:56:23 -0500 Subject: [PATCH] Remove outputs from JSON output The output of the evaluator should only include either the full derivation (not yet implemented) or fields not directly accessible from the drv such as meta. Right now the output is a fairly arbitrary selection of fields. --- src/nix-eval-jobs.cc | 17 +++-------------- tests/test_eval.py | 4 ++-- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/nix-eval-jobs.cc b/src/nix-eval-jobs.cc index 2840194..ce7462a 100644 --- a/src/nix-eval-jobs.cc +++ b/src/nix-eval-jobs.cc @@ -171,11 +171,9 @@ static void worker( auto drvPath = drv->queryDrvPath(); - nlohmann::json job; - - job["nixName"] = drv->queryName(); - job["system"] =drv->querySystem(); - job["drvPath"] = drvPath; + reply["name"] = drv->queryName(); + reply["system"] = drv->querySystem(); + reply["drvPath"] = drvPath; nlohmann::json meta; for (auto & name : drv->queryMetaNames()) { @@ -193,7 +191,6 @@ static void worker( nlohmann::json field = nlohmann::json::parse(ss.str()); meta[name] = field; } - job["meta"] = meta; /* Register the derivation as a GC root. !!! This registers roots for jobs that we may have already @@ -206,14 +203,6 @@ static void worker( localStore->addPermRoot(storePath, root); } - DrvInfo::Outputs outputs = drv->queryOutputs(); - nlohmann::json out; - for (auto & p : outputs) { - out[p.first] = p.second; - } - job["outputs"] = std::move(out); - - reply["job"] = std::move(job); } else if (v->type() == nAttrs) diff --git a/tests/test_eval.py b/tests/test_eval.py index 7f5e2bf..7e32d7a 100644 --- a/tests/test_eval.py +++ b/tests/test_eval.py @@ -27,12 +27,12 @@ def common_test(extra_args: List[str]) -> None: built_job = results[0] assert built_job["attr"] == "builtJob" - assert built_job["job"]["nixName"] == "job1" + assert built_job["name"] == "job1" substituted_job = results[1] assert substituted_job["attr"] == "substitutedJob" - assert substituted_job["job"]["nixName"].startswith("hello-") + assert substituted_job["name"].startswith("hello-") def test_flake() -> None: