libfetchers: asyncify downloadFile, downloadTarball

Change-Id: I6f6e5b61667efeda8c575ae1f3bd87ee75fb9f9e
This commit is contained in:
eldritch horrors
2025-02-08 17:26:19 +00:00
parent 60f391ef3d
commit 8bfd2d4bb1
8 changed files with 61 additions and 37 deletions
+7 -4
View File
@@ -270,10 +270,13 @@ static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v
// TODO: fetching may fail, yet the path may be substitutable.
// https://github.com/NixOS/nix/issues/4313
auto storePath =
unpack
? fetchers::downloadTarball(state.ctx.store, *url, name, (bool) expectedHash).tree.storePath
: fetchers::downloadFile(state.ctx.store, *url, name, (bool) expectedHash).storePath;
auto storePath = unpack
? state.aio
.blockOn(fetchers::downloadTarball(state.ctx.store, *url, name, (bool) expectedHash))
.tree.storePath
: state.aio
.blockOn(fetchers::downloadFile(state.ctx.store, *url, name, (bool) expectedHash))
.storePath;
if (expectedHash) {
auto hash = unpack