diff options
author | regnat <rg@regnat.ovh> | 2020-11-25 11:20:03 +0100 |
---|---|---|
committer | regnat <rg@regnat.ovh> | 2020-11-25 11:33:00 +0100 |
commit | 13c557fe823549db75c3dc24c99c46e1c4e1378e (patch) | |
tree | 46bd9a929ef711743d9e6e23f87dc1017e83fb56 /src/libstore/build | |
parent | 605bacdc929db4d820b8d5866450de7d1ec6e6cf (diff) |
fix the hash rewriting for ca-derivations
Diffstat (limited to 'src/libstore/build')
-rw-r--r-- | src/libstore/build/derivation-goal.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index bf2bad62c..0e4504857 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -3121,6 +3121,20 @@ void DerivationGoal::registerOutputs() newInfo0.references = refs.second; if (refs.first) newInfo0.references.insert(newInfo0.path); + if (scratchPath != newInfo0.path) { + // Also rewrite the output path + auto source = sinkToSource([&](Sink & nextSink) { + StringSink sink; + dumpPath(actualPath, sink); + RewritingSink rsink2(oldHashPart, std::string(newInfo0.path.hashPart()), nextSink); + rsink2((unsigned char *) sink.s->data(), sink.s->size()); + rsink2.flush(); + }); + Path tmpPath = actualPath + ".tmp"; + restorePath(tmpPath, *source); + deletePath(actualPath); + movePath(tmpPath, actualPath); + } assert(newInfo0.ca); return newInfo0; |