1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 19:03:16 +02:00

Remove Tree datatype

This commit is contained in:
Eelco Dolstra 2022-07-25 15:21:37 +02:00
parent e7faf65784
commit 4f8f52ae58
7 changed files with 23 additions and 32 deletions

View file

@ -68,11 +68,11 @@ static void prim_fetchMercurial(EvalState & state, const PosIdx pos, Value * * a
auto input = fetchers::Input::fromAttrs(std::move(attrs));
// FIXME: use name
auto [tree, input2] = input.fetch(state.store);
auto [storePath, input2] = input.fetch(state.store);
auto attrs2 = state.buildBindings(8);
auto storePath = state.store->printStorePath(tree.storePath);
attrs2.alloc(state.sOutPath).mkString(storePath, {storePath});
auto storePath2 = state.store->printStorePath(storePath);
attrs2.alloc(state.sOutPath).mkString(storePath2, {storePath2});
if (input2.getRef())
attrs2.alloc("branch").mkString(*input2.getRef());
// Backward compatibility: set 'rev' to
@ -84,7 +84,7 @@ static void prim_fetchMercurial(EvalState & state, const PosIdx pos, Value * * a
attrs2.alloc("revCount").mkInt(*revCount);
v.mkAttrs(attrs2);
state.allowPath(tree.storePath);
state.allowPath(storePath);
}
static RegisterPrimOp r_fetchMercurial("fetchMercurial", 1, prim_fetchMercurial);

View file

@ -196,19 +196,19 @@ static void fetchTree(
params.emptyRevFallback,
false);
} else {
auto [tree, input2] = input.fetch(state.store);
auto [storePath, input2] = input.fetch(state.store);
auto storePath = state.store->printStorePath(tree.storePath);
auto storePath2 = state.store->printStorePath(storePath);
emitTreeAttrs(
state, input2, v,
[&](Value & vOutPath) {
vOutPath.mkString(storePath, {storePath});
vOutPath.mkString(storePath2, {storePath2});
},
params.emptyRevFallback,
false);
state.allowPath(tree.storePath);
state.allowPath(storePath);
}
}
@ -283,7 +283,7 @@ static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v
// https://github.com/NixOS/nix/issues/4313
auto storePath =
unpack
? fetchers::downloadTarball(state.store, *url, name, (bool) expectedHash).first.storePath
? fetchers::downloadTarball(state.store, *url, name, (bool) expectedHash).first
: fetchers::downloadFile(state.store, *url, name, (bool) expectedHash).storePath;
if (expectedHash) {