forked from lix-project/lix
Merge pull request #7386 from edolstra/fix-json
Really fix 'nix store make-content-addressed --json'
This commit is contained in:
commit
7bba4b343b
|
@ -37,13 +37,15 @@ struct CmdMakeContentAddressed : virtual CopyCommand, virtual StorePathsCommand,
|
||||||
StorePathSet(storePaths.begin(), storePaths.end()));
|
StorePathSet(storePaths.begin(), storePaths.end()));
|
||||||
|
|
||||||
if (json) {
|
if (json) {
|
||||||
nlohmann::json jsonRewrites = json::object();
|
auto jsonRewrites = json::object();
|
||||||
for (auto & path : storePaths) {
|
for (auto & path : storePaths) {
|
||||||
auto i = remappings.find(path);
|
auto i = remappings.find(path);
|
||||||
assert(i != remappings.end());
|
assert(i != remappings.end());
|
||||||
jsonRewrites[srcStore->printStorePath(path)] = srcStore->printStorePath(i->second);
|
jsonRewrites[srcStore->printStorePath(path)] = srcStore->printStorePath(i->second);
|
||||||
}
|
}
|
||||||
std::cout << nlohmann::json{"rewrites", jsonRewrites}.dump();
|
auto json = json::object();
|
||||||
|
json["rewrites"] = jsonRewrites;
|
||||||
|
std::cout << json.dump();
|
||||||
} else {
|
} else {
|
||||||
for (auto & path : storePaths) {
|
for (auto & path : storePaths) {
|
||||||
auto i = remappings.find(path);
|
auto i = remappings.find(path);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
source common.sh
|
source common.sh
|
||||||
|
|
||||||
enableFeatures "fetch-closure"
|
enableFeatures "fetch-closure"
|
||||||
needLocalStore "'--no-require-sigs' can’t be used with the daemon"
|
|
||||||
|
|
||||||
clearStore
|
clearStore
|
||||||
clearCacheCache
|
clearCacheCache
|
||||||
|
@ -28,6 +27,8 @@ clearStore
|
||||||
[ ! -e $nonCaPath ]
|
[ ! -e $nonCaPath ]
|
||||||
[ -e $caPath ]
|
[ -e $caPath ]
|
||||||
|
|
||||||
|
if [[ "$NIX_REMOTE" != "daemon" ]]; then
|
||||||
|
|
||||||
# In impure mode, we can use non-CA paths.
|
# In impure mode, we can use non-CA paths.
|
||||||
[[ $(nix eval --raw --no-require-sigs --impure --expr "
|
[[ $(nix eval --raw --no-require-sigs --impure --expr "
|
||||||
builtins.fetchClosure {
|
builtins.fetchClosure {
|
||||||
|
@ -38,6 +39,8 @@ clearStore
|
||||||
|
|
||||||
[ -e $nonCaPath ]
|
[ -e $nonCaPath ]
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
# 'toPath' set to empty string should fail but print the expected path.
|
# 'toPath' set to empty string should fail but print the expected path.
|
||||||
nix eval -v --json --expr "
|
nix eval -v --json --expr "
|
||||||
builtins.fetchClosure {
|
builtins.fetchClosure {
|
||||||
|
|
Loading…
Reference in a new issue