aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-05-01 20:10:00 +0200
committereldritch horrors <pennae@lix.systems>2024-07-06 12:36:37 +0200
commit5af76dee371ea5fa1eb72141370fdf18851d67c7 (patch)
treea51cc0348910a8fce0df02c132efe9a438ddd911 /src/libstore/build
parent4162a66cee97ec16c88d991ef9a6d9baa3740053 (diff)
libutil: turn HashModuloSink into a free function
Change-Id: I5878007502fa68c2816a0f4c61f7d0e60bdde702
Diffstat (limited to 'src/libstore/build')
-rw-r--r--src/libstore/build/local-derivation-goal.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc
index b2a301b00..6a298e6eb 100644
--- a/src/libstore/build/local-derivation-goal.cc
+++ b/src/libstore/build/local-derivation-goal.cc
@@ -2216,23 +2216,21 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
rewriteOutput(outputRewrites);
/* FIXME optimize and deduplicate with addToStore */
std::string oldHashPart { scratchPath->hashPart() };
- HashModuloSink caSink { outputHash.hashType, oldHashPart };
- std::visit(overloaded {
- [&](const TextIngestionMethod &) {
- caSink << readFileSource(actualPath);
+ auto input = std::visit(overloaded {
+ [&](const TextIngestionMethod &) -> GeneratorSource {
+ return GeneratorSource(readFileSource(actualPath));
},
- [&](const FileIngestionMethod & m2) {
+ [&](const FileIngestionMethod & m2) -> GeneratorSource {
switch (m2) {
case FileIngestionMethod::Recursive:
- caSink << dumpPath(actualPath);
- break;
+ return GeneratorSource(dumpPath(actualPath));
case FileIngestionMethod::Flat:
- caSink << readFileSource(actualPath);
- break;
+ return GeneratorSource(readFileSource(actualPath));
}
+ assert(false);
},
}, outputHash.method.raw);
- auto got = caSink.finish().first;
+ auto got = computeHashModulo(outputHash.hashType, oldHashPart, input).first;
auto optCA = ContentAddressWithReferences::fromPartsOpt(
outputHash.method,