diff --git a/dist/setup/index.js b/dist/setup/index.js index 4a555e0..ab1d6b3 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -129211,12 +129211,20 @@ async function downloadVersion(downloadUrl, artifactName, platform, arch, versio const downloadPath = await tc.downloadTool(downloadUrl, undefined, githubToken); await (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, version); let uvDir; - const extension = getExtension(platform); if (platform === "pc-windows-msvc") { - const fullPathWithExtension = `${downloadPath}${extension}`; - await node_fs_1.promises.copyFile(downloadPath, fullPathWithExtension); - uvDir = await tc.extractZip(fullPathWithExtension); // On windows extracting the zip does not create an intermediate directory + try { + // Try tar first as it's much faster, but only bsdtar supports zip files, + // so this my fail if another tar, like gnu tar, ends up being used. + uvDir = await tc.extractTar(downloadPath, undefined, "x"); + } + catch (err) { + core.info(`Extracting with tar failed, falling back to zip extraction: ${err.message}`); + const extension = getExtension(platform); + const fullPathWithExtension = `${downloadPath}${extension}`; + await node_fs_1.promises.copyFile(downloadPath, fullPathWithExtension); + uvDir = await tc.extractZip(fullPathWithExtension); + } } else { const extractedDir = await tc.extractTar(downloadPath); diff --git a/src/download/download-version.ts b/src/download/download-version.ts index 3e7096c..5c71e6c 100644 --- a/src/download/download-version.ts +++ b/src/download/download-version.ts @@ -108,12 +108,21 @@ async function downloadVersion( await validateChecksum(checkSum, downloadPath, arch, platform, version); let uvDir: string; - const extension = getExtension(platform); if (platform === "pc-windows-msvc") { - const fullPathWithExtension = `${downloadPath}${extension}`; - await fs.copyFile(downloadPath, fullPathWithExtension); - uvDir = await tc.extractZip(fullPathWithExtension); // On windows extracting the zip does not create an intermediate directory + try { + // Try tar first as it's much faster, but only bsdtar supports zip files, + // so this my fail if another tar, like gnu tar, ends up being used. + uvDir = await tc.extractTar(downloadPath, undefined, "x"); + } catch (err) { + core.info( + `Extracting with tar failed, falling back to zip extraction: ${(err as Error).message}`, + ); + const extension = getExtension(platform); + const fullPathWithExtension = `${downloadPath}${extension}`; + await fs.copyFile(downloadPath, fullPathWithExtension); + uvDir = await tc.extractZip(fullPathWithExtension); + } } else { const extractedDir = await tc.extractTar(downloadPath); uvDir = path.join(extractedDir, artifactName);