diff --git a/lix/libutil/archive.cc b/lix/libutil/archive.cc index b2dcfd058..7381e37b8 100644 --- a/lix/libutil/archive.cc +++ b/lix/libutil/archive.cc @@ -370,56 +370,36 @@ Generator parse(Source & source) } -static WireFormatGenerator restore(NARParseVisitor & sink, nar::Entry entry, const Path & path) +static void restore(NARParseVisitor & sink, nar::Entry entry, const Path & path) { return std::visit( overloaded{ - [](nar::MetadataString m) -> WireFormatGenerator { - co_yield m.data; - }, - [](nar::MetadataRaw r) -> WireFormatGenerator { - co_yield r.raw; - }, + [](nar::MetadataString m) {}, + [](nar::MetadataRaw r) {}, [&](nar::File f) { auto handle = sink.createRegularFile(path, f.size, f.executable); - return [](auto handle, auto f) -> WireFormatGenerator { - while (auto block = f.contents.next()) { - handle->receiveContents(std::string_view{block->data(), block->size()}); - co_yield *block; - } - handle->close(); - }(std::move(handle), std::move(f)); - }, - [&](nar::Symlink sl) { - sink.createSymlink(path, sl.target); - return []() -> WireFormatGenerator { co_return; }(); + while (auto block = f.contents.next()) { + handle->receiveContents(std::string_view{block->data(), block->size()}); + } + handle->close(); }, + [&](nar::Symlink sl) { sink.createSymlink(path, sl.target); }, [&](nar::Directory d) { auto dir = sink.createDirectory(path); - return [](auto dir, auto d) -> WireFormatGenerator { - while (auto entry = d.contents.next()) { - co_yield restore(*dir, std::move(entry->second), entry->first); - } - }(std::move(dir), std::move(d)); + while (auto entry = d.contents.next()) { + restore(*dir, std::move(entry->second), entry->first); + } }, }, std::move(entry) ); } -WireFormatGenerator parseAndCopyDump(NARParseVisitor & sink, Source & source) +void parseDump(NARParseVisitor & sink, Source & source) { auto nar = nar::parse(source); while (auto entry = nar.next()) { - co_yield restore(sink, std::move(*entry), ""); - } -} - -void parseDump(NARParseVisitor & sink, Source & source) -{ - auto parser = parseAndCopyDump(sink, source); - while (parser.next()) { - // ignore the actual item + restore(sink, std::move(*entry), ""); } } diff --git a/lix/libutil/archive.hh b/lix/libutil/archive.hh index 574599f62..7d7d93e6c 100644 --- a/lix/libutil/archive.hh +++ b/lix/libutil/archive.hh @@ -157,7 +157,6 @@ Generator parse(Source & source); } -WireFormatGenerator parseAndCopyDump(NARParseVisitor & sink, Source & source); void parseDump(NARParseVisitor & sink, Source & source); void restorePath(const Path & path, Source & source);