forked from lix-project/nix-eval-jobs
Merge pull request #18 from nix-community/meta-arg
Add flag to enable meta
This commit is contained in:
commit
909b7ab4c2
|
@ -34,6 +34,7 @@ struct MyArgs : MixEvalArgs, MixCommonArgs
|
|||
Path releaseExpr;
|
||||
Path gcRootsDir;
|
||||
bool flake = false;
|
||||
bool meta = false;
|
||||
size_t nrWorkers = 1;
|
||||
size_t maxMemorySize = 4096;
|
||||
pureEval evalMode = evalAuto;
|
||||
|
@ -94,6 +95,12 @@ struct MyArgs : MixEvalArgs, MixCommonArgs
|
|||
.handler = {&flake, true}
|
||||
});
|
||||
|
||||
addFlag({
|
||||
.longName = "meta",
|
||||
.description = "include derivation meta field in output",
|
||||
.handler = {&meta, true}
|
||||
});
|
||||
|
||||
expectArg("expr", &releaseExpr);
|
||||
}
|
||||
};
|
||||
|
@ -182,6 +189,7 @@ static void worker(
|
|||
reply["outputs"][out.first] = out.second;
|
||||
}
|
||||
|
||||
if (myArgs.meta) {
|
||||
nlohmann::json meta;
|
||||
for (auto & name : drv->queryMetaNames()) {
|
||||
PathSet context;
|
||||
|
@ -198,6 +206,8 @@ static void worker(
|
|||
nlohmann::json field = nlohmann::json::parse(ss.str());
|
||||
meta[name] = field;
|
||||
}
|
||||
reply["meta"] = meta;
|
||||
}
|
||||
|
||||
/* Register the derivation as a GC root. !!! This
|
||||
registers roots for jobs that we may have already
|
||||
|
|
|
@ -13,7 +13,7 @@ BIN = PROJECT_ROOT.joinpath("build", "src", "nix-eval-jobs")
|
|||
|
||||
def common_test(extra_args: List[str]) -> None:
|
||||
with TemporaryDirectory() as tempdir:
|
||||
cmd = [str(BIN), "--gc-roots-dir", tempdir] + extra_args
|
||||
cmd = [str(BIN), "--gc-roots-dir", tempdir, "--meta"] + extra_args
|
||||
res = subprocess.run(
|
||||
cmd,
|
||||
cwd=TEST_ROOT.joinpath("assets"),
|
||||
|
@ -30,11 +30,12 @@ def common_test(extra_args: List[str]) -> None:
|
|||
assert built_job["name"] == "job1"
|
||||
assert built_job["outputs"]["out"].startswith("/nix/store")
|
||||
assert built_job["drvPath"].endswith(".drv")
|
||||
|
||||
assert built_job["meta"]['broken'] is False
|
||||
|
||||
substituted_job = results[1]
|
||||
assert substituted_job["attr"] == "substitutedJob"
|
||||
assert substituted_job["name"].startswith("hello-")
|
||||
assert substituted_job["meta"]['broken'] is False
|
||||
|
||||
|
||||
def test_flake() -> None:
|
||||
|
|
Loading…
Reference in a new issue