aboutsummaryrefslogtreecommitdiff
path: root/nix/libstore/build.cc
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-10-05 19:15:39 +0200
committerMarius Bakke <mbakke@fastmail.com>2018-10-05 19:15:39 +0200
commitcf6db76d2af2f287f12928df160447ab4165b3e5 (patch)
tree49a1309c0e04c00090ab106f7ae3495a6da328c1 /nix/libstore/build.cc
parente65b2181e8b436278e3dd0b405602a400fbd0a75 (diff)
parenta6798218bea0d6b2df598042d1ced29f74bb4250 (diff)
downloadguix-cf6db76d2af2f287f12928df160447ab4165b3e5.tar
guix-cf6db76d2af2f287f12928df160447ab4165b3e5.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'nix/libstore/build.cc')
-rw-r--r--nix/libstore/build.cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index c7f32494d0..b2c319f00b 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2466,13 +2466,13 @@ void DerivationGoal::registerOutputs()
/* Check the hash. */
Hash h2 = recursive ? hashPath(ht, actualPath).first : hashFile(ht, actualPath);
- if (h != h2)
- throw BuildError(
- format("%1% hash mismatch for output path `%2%'\n"
- " expected: %3%\n"
- " actual: %4%")
- % i->second.hashAlgo % path
- % printHash16or32(h) % printHash16or32(h2));
+ if (h != h2) {
+ if (settings.printBuildTrace)
+ printMsg(lvlError, format("@ hash-mismatch %1% %2% %3% %4%")
+ % path % i->second.hashAlgo
+ % printHash16or32(h) % printHash16or32(h2));
+ throw BuildError(format("hash mismatch for store item '%1%'") % path);
+ }
}
/* Get rid of all weird permissions. This also checks that
@@ -3157,11 +3157,14 @@ void SubstitutionGoal::finished()
throw Error(format("unknown hash algorithm in `%1%'") % expectedHashStr);
Hash expectedHash = parseHash16or32(hashType, string(expectedHashStr, n + 1));
Hash actualHash = hashType == htSHA256 ? hash.first : hashPath(hashType, destPath).first;
- if (expectedHash != actualHash)
- throw SubstError(format("hash mismatch in downloaded path `%1%'\n"
- " expected: %2%\n"
- " actual: %3%")
- % storePath % printHash(expectedHash) % printHash(actualHash));
+ if (expectedHash != actualHash) {
+ if (settings.printBuildTrace)
+ printMsg(lvlError, format("@ hash-mismatch %1% %2% %3% %4%")
+ % storePath % "sha256"
+ % printHash16or32(expectedHash)
+ % printHash16or32(actualHash));
+ throw SubstError(format("hash mismatch for substituted item `%1%'") % storePath);
+ }
}
} catch (SubstError & e) {