When the hash of an url being fetched does not match the expected value, this
commit will cause fetch-yarn-deps to include the url in the error message to
assist debugging.
---
pkgs/build-support/node/fetch-yarn-deps/index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkgs/build-support/node/fetch-yarn-deps/index.js b/pkgs/build-support/node/fetch-yarn-deps/index.js
index e60fdeb54330..91e3d1014661 100755
--- a/pkgs/build-support/node/fetch-yarn-deps/index.js
+++ b/pkgs/build-support/node/fetch-yarn-deps/index.js
@@ -39,7 +39,7 @@ const downloadFileHttps = (fileName, url, expectedHash, hashType = 'sha1') => {
const h = hash.read()
if (expectedHash === undefined){
console.log(`Warning: lockfile url ${url} doesn't end in "#<hash>" to validate against. Downloaded file had hash ${h}.`);
- } else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h}`))
+ } else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h} for ${url}`))
resolve()
})
res.on('error', e => reject(e))
--
2.44.0
https://github.com/NixOS/nixpkgs/pull/329863
On Wed, Jul 24, 2024 at 02:59:35PM GMT, Adam Joseph wrote:
>When the hash of an url being fetched does not match the expected value, this
>commit will cause fetch-yarn-deps to include the url in the error message to
>assist debugging.
>---
> pkgs/build-support/node/fetch-yarn-deps/index.js | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/pkgs/build-support/node/fetch-yarn-deps/index.js b/pkgs/build-support/node/fetch-yarn-deps/index.js
>index e60fdeb54330..91e3d1014661 100755
>--- a/pkgs/build-support/node/fetch-yarn-deps/index.js
>+++ b/pkgs/build-support/node/fetch-yarn-deps/index.js
>@@ -39,7 +39,7 @@ const downloadFileHttps = (fileName, url, expectedHash, hashType = 'sha1') => {
> const h = hash.read()
> if (expectedHash === undefined){
> console.log(`Warning: lockfile url ${url} doesn't end in "#<hash>" to validate against. Downloaded file had hash ${h}.`);
>- } else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h}`))
>+ } else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h} for ${url}`))
> resolve()
> })
> res.on('error', e => reject(e))
>--
>2.44.0
>
--
Florian Klink