From 06220a71c1430c97bfcd8012b00530a987e40e97 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 23 Mar 2024 00:47:16 +0100 Subject: libstore: convert dumpPath to a generator Change-Id: Ic4cf5562504aa29130304469936f958c0426e5ef --- src/libfetchers/path.cc | 6 ++---- src/libfetchers/tarball.cc | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/libfetchers') diff --git a/src/libfetchers/path.cc b/src/libfetchers/path.cc index 11c952dc2..8e47616d0 100644 --- a/src/libfetchers/path.cc +++ b/src/libfetchers/path.cc @@ -130,10 +130,8 @@ struct PathInputScheme : InputScheme time_t mtime = 0; if (!storePath || storePath->name() != "source" || !store->isValidPath(*storePath)) { // FIXME: try to substitute storePath. - auto src = sinkToSource([&](Sink & sink) { - mtime = dumpPathAndGetMtime(absPath, sink, defaultPathFilter); - }); - storePath = store->addToStoreFromDump(*src, "source"); + auto src = GeneratorSource{dumpPathAndGetMtime(absPath, mtime, defaultPathFilter)}; + storePath = store->addToStoreFromDump(src, "source"); } input.attrs.insert_or_assign("lastModified", uint64_t(mtime)); diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc index c903895e2..6ce35aeb2 100644 --- a/src/libfetchers/tarball.cc +++ b/src/libfetchers/tarball.cc @@ -71,7 +71,7 @@ DownloadFileResult downloadFile( storePath = std::move(cached->storePath); } else { StringSink sink; - dumpString(res.data, sink); + sink << dumpString(res.data); auto hash = hashString(htSHA256, res.data); ValidPathInfo info { *store, -- cgit v1.2.3