From 3eb2715c7a91103c78419b3e949a2555a97dc1b3 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 10 Nov 2025 01:50:31 -0500 Subject: [PATCH] Make `OutputsSpec::All` JSON be `"*"` not `["*"]` If it is a list, then it looks like an output set (`OutputSpec::Names`), but if it is just the string `"*"`, then it is more clearly destinguished from all output sets. --- .../data/derived-path/multi_built_built_wildcard.json | 4 +--- src/libstore-tests/data/outputs-spec/all.json | 4 +--- src/libstore-tests/data/outputs-spec/extended/all.json | 4 +--- src/libstore/outputs-spec.cc | 9 +++++---- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/libstore-tests/data/derived-path/multi_built_built_wildcard.json b/src/libstore-tests/data/derived-path/multi_built_built_wildcard.json index da1f9d996ac..073c502f519 100644 --- a/src/libstore-tests/data/derived-path/multi_built_built_wildcard.json +++ b/src/libstore-tests/data/derived-path/multi_built_built_wildcard.json @@ -3,7 +3,5 @@ "drvPath": "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv", "output": "bar" }, - "outputs": [ - "*" - ] + "outputs": "*" } diff --git a/src/libstore-tests/data/outputs-spec/all.json b/src/libstore-tests/data/outputs-spec/all.json index 1449203e9ff..90b74f3fd0e 100644 --- a/src/libstore-tests/data/outputs-spec/all.json +++ b/src/libstore-tests/data/outputs-spec/all.json @@ -1,3 +1 @@ -[ - "*" -] +"*" diff --git a/src/libstore-tests/data/outputs-spec/extended/all.json b/src/libstore-tests/data/outputs-spec/extended/all.json index 1449203e9ff..90b74f3fd0e 100644 --- a/src/libstore-tests/data/outputs-spec/extended/all.json +++ b/src/libstore-tests/data/outputs-spec/extended/all.json @@ -1,3 +1 @@ -[ - "*" -] +"*" diff --git a/src/libstore/outputs-spec.cc b/src/libstore/outputs-spec.cc index 622df5fc344..027444de00f 100644 --- a/src/libstore/outputs-spec.cc +++ b/src/libstore/outputs-spec.cc @@ -139,18 +139,19 @@ using namespace nix; OutputsSpec adl_serializer::from_json(const json & json) { - auto names = json.get(); - if (names == StringSet({"*"})) + if (json.is_string() && json.get() == "*") return OutputsSpec::All{}; - else + else { + auto names = json.get(); return OutputsSpec::Names{std::move(names)}; + } } void adl_serializer::to_json(json & json, const OutputsSpec & t) { std::visit( overloaded{ - [&](const OutputsSpec::All &) { json = std::vector({"*"}); }, + [&](const OutputsSpec::All &) { json = "*"; }, [&](const OutputsSpec::Names & names) { json = names; }, }, t.raw);