From 31478c810a79403fbb670ef7c4ef1d0d48271c80 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 11 May 2024 00:45:39 +0200 Subject: libutil: remove makeDecompressionSink the sole remaining user of this function can use makeDecompressionSource instead, while making the sinkToSource in the caller unnecessary as well Change-Id: I4258227b5dbbb735a75b477d8a57007bfca305e9 --- src/libstore/builtins/fetchurl.cc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/libstore/builtins/fetchurl.cc') diff --git a/src/libstore/builtins/fetchurl.cc b/src/libstore/builtins/fetchurl.cc index 37d640fe4..3a4cdd6e7 100644 --- a/src/libstore/builtins/fetchurl.cc +++ b/src/libstore/builtins/fetchurl.cc @@ -32,23 +32,19 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData) auto fetch = [&](const std::string & url) { - auto source = sinkToSource([&](Sink & sink) { + /* No need to do TLS verification, because we check the hash of + the result anyway. */ + FileTransferRequest request(url); + request.verifyTLS = false; - /* No need to do TLS verification, because we check the hash of - the result anyway. */ - FileTransferRequest request(url); - request.verifyTLS = false; - - auto decompressor = makeDecompressionSink( - unpack && mainUrl.ends_with(".xz") ? "xz" : "none", sink); - fileTransfer->download(std::move(request))->drainInto(*decompressor); - decompressor->finish(); - }); + auto raw = fileTransfer->download(std::move(request)); + auto decompressor = makeDecompressionSource( + unpack && mainUrl.ends_with(".xz") ? "xz" : "none", *raw); if (unpack) - restorePath(storePath, *source); + restorePath(storePath, *decompressor); else - writeFile(storePath, *source); + writeFile(storePath, *decompressor); auto executable = drv.env.find("executable"); if (executable != drv.env.end() && executable->second == "1") { -- cgit v1.2.3