Unverified Commit 96896ef3 authored by Florian Klink's avatar Florian Klink Committed by GitHub
Browse files

Merge pull request #329863 from flokli/fetch-yarn-deps

fetch-yarn-deps: fix broken fetching logic for github releases, improve diagnostic messages, 
parents 8f5e6310 9cac7a74
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -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))
@@ -104,11 +104,14 @@ const downloadPkg = (pkg, verbose) => {
	const [ url, hash ] = pkg.resolved.split('#')
	if (verbose) console.log('downloading ' + url)
	const fileName = urlToName(url)
	if (url.startsWith('https://codeload.github.com/') && url.includes('/tar.gz/')) {
	const s = url.split('/')
	if (url.startsWith('https://codeload.github.com/') && url.includes('/tar.gz/')) {
		return downloadGit(fileName, `https://github.com/${s[3]}/${s[4]}.git`, s[s.length-1])
	} else if (url.startsWith('https://github.com/') && url.endsWith('.tar.gz')) {
		const s = url.split('/')
	} else if (url.startsWith('https://github.com/') && url.endsWith('.tar.gz') &&
		(
			s.length <= 5 ||    // https://github.com/owner/repo.tgz#feedface...
			s[5] == "archive"   // https://github.com/owner/repo/archive/refs/tags/v0.220.1.tar.gz
		)) {
		return downloadGit(fileName, `https://github.com/${s[3]}/${s[4]}.git`, s[s.length-1].replace(/.tar.gz$/, ''))
	} else if (isGitUrl(url)) {
		return downloadGit(fileName, url.replace(/^git\+/, ''), hash)
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,10 @@
    yarnLock = ./github.lock;
    sha256 = "sha256-DIKrhDKoqm7tHZmcuh9eK9VTqp6BxeW0zqDUpY4F57A=";
  };
  githubReleaseDep = testers.invalidateFetcherByDrvHash fetchYarnDeps {
    yarnLock = ./github-release.lock;
    sha256 = "sha256-g+y/H6k8LZ+IjWvkkwV7JhKQH1ycfeqzsIonNv4fDq8=";
  };
  gitUrlDep = testers.invalidateFetcherByDrvHash fetchYarnDeps {
    yarnLock = ./giturl.lock;
    sha256 = "sha256-VPnyqN6lePQZGXwR7VhbFnP7/0/LB621RZwT1F+KzVQ=";
+6 −0
Original line number Diff line number Diff line
"libsession_util_nodejs@https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.3.19/libsession_util_nodejs-v0.3.19.tar.gz":
  version "0.3.19"
  resolved "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.3.19/libsession_util_nodejs-v0.3.19.tar.gz#221c1fc34fcc18601aea4ce1b733ebfa55af66ea"
  dependencies:
    cmake-js "^7.2.1"
    node-addon-api "^6.1.0"