~andir/nixpkgs-dev

fetch-yarn-deps: improve diagnostic messages v1 PROPOSED

Adam Joseph: 1
 fetch-yarn-deps: improve diagnostic messages

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~andir/nixpkgs-dev/patches/54068/mbox | git am -3
Learn more about email & git

[PATCH] fetch-yarn-deps: improve diagnostic messages Export this patch

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