forked from lix-project/lix
Don't anticipate CA but not fixed outputs for now
This commit is contained in:
parent
2500403059
commit
3a9e4c3262
1 changed files with 6 additions and 17 deletions
|
@ -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,17 +3706,12 @@ 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.
|
if (h != h2) {
|
||||||
bool needsMove = true;
|
|
||||||
|
|
||||||
if (i.second.hash != "") {
|
|
||||||
Hash h = Hash(i.second.hash, ht);
|
|
||||||
if (h != h2) {
|
|
||||||
|
|
||||||
/* Throw an error after registering the path as
|
/* Throw an error after registering the path as
|
||||||
valid. */
|
valid. */
|
||||||
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue