Don't anticipate CA but not fixed outputs for now

This commit is contained in:
John Ericson 2020-06-03 18:50:45 +00:00
parent 2500403059
commit 3a9e4c3262

View file

@ -3690,10 +3690,10 @@ void DerivationGoal::registerOutputs()
hash). */ hash). */
std::string ca; std::string ca;
if (i.second.hashAlgo != "") { if (derivationIsFixed(derivationType)) {
FileIngestionMethod outputHashMode; HashType ht; FileIngestionMethod outputHashMode; Hash h;
i.second.parseHashType(outputHashMode, ht); i.second.parseHashInfo(outputHashMode, h);
if (outputHashMode == FileIngestionMethod::Flat) { if (outputHashMode == FileIngestionMethod::Flat) {
/* The output path should be a regular file without execute permission. */ /* The output path should be a regular file without execute permission. */
@ -3706,16 +3706,11 @@ void DerivationGoal::registerOutputs()
/* Check the hash. In hash mode, move the path produced by /* Check the hash. In hash mode, move the path produced by
the derivation to its content-addressed location. */ the derivation to its content-addressed location. */
Hash h2 = outputHashMode == FileIngestionMethod::Recursive Hash h2 = outputHashMode == FileIngestionMethod::Recursive
? hashPath(ht, actualPath).first ? hashPath(h.type, actualPath).first
: hashFile(ht, actualPath); : hashFile(h.type, actualPath);
auto dest = worker.store.makeFixedOutputPath(outputHashMode, h2, i.second.path.name()); auto dest = worker.store.makeFixedOutputPath(outputHashMode, h2, i.second.path.name());
// true if either floating CA, or incorrect fixed hash.
bool needsMove = true;
if (i.second.hash != "") {
Hash h = Hash(i.second.hash, ht);
if (h != h2) { if (h != h2) {
/* Throw an error after registering the path as /* Throw an error after registering the path as
@ -3724,13 +3719,7 @@ void DerivationGoal::registerOutputs()
delayedException = std::make_exception_ptr( delayedException = std::make_exception_ptr(
BuildError("hash mismatch in fixed-output derivation '%s':\n wanted: %s\n got: %s", BuildError("hash mismatch in fixed-output derivation '%s':\n wanted: %s\n got: %s",
worker.store.printStorePath(dest), h.to_string(SRI), h2.to_string(SRI))); worker.store.printStorePath(dest), h.to_string(SRI), h2.to_string(SRI)));
} else {
// matched the fixed hash, so no move needed.
needsMove = false;
}
}
if (needsMove) {
Path actualDest = worker.store.Store::toRealPath(dest); Path actualDest = worker.store.Store::toRealPath(dest);
if (worker.store.isValidPath(dest)) if (worker.store.isValidPath(dest))