From 284b165a2df86bcc516f380fe81a7794b69123cb Mon Sep 17 00:00:00 2001 From: Konstantin Tyukalov Date: Fri, 12 Jul 2024 17:51:12 +0400 Subject: [PATCH] Use tar tool for .tar.gz --- node/buildutils.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/node/buildutils.js b/node/buildutils.js index 343438de7..c053f9112 100644 --- a/node/buildutils.js +++ b/node/buildutils.js @@ -51,7 +51,7 @@ const getExternalsAsync = async () => { downloadFileAsync(nodeUrl + '/' + nodeVersion + '/win-x64/node.exe'), downloadFileAsync(nodeUrl + '/' + nodeVersion + '/win-x64/node.lib') ]); - + var nodeDirectory = path.join(testPath, 'node'); mkdir('-p', nodeDirectory); cp(nodeExePath, path.join(nodeDirectory, 'node.exe')); @@ -118,7 +118,7 @@ var downloadArchiveAsync = async function (url, fileName) { if (test('-f', marker)) { return targetPath; } - + // download the archive var archivePath = await downloadFileAsync(url, scrubbedUrl); console.log('Extracting archive: ' + url); @@ -130,8 +130,16 @@ var downloadArchiveAsync = async function (url, fileName) { // extract mkdir('-p', targetPath); - var zip = new admZip(archivePath); - zip.extractAllTo(targetPath); + + if (targetPath.endsWith('.zip')) { + var zip = new admZip(archivePath); + zip.extractAllTo(targetPath); + } + else if (targetPath.endsWith('.tar.gz')) { + run(`tar --extract --gzip --file="${archivePath}" --directory="${targetPath}"`); + } else { + throw new Error('Unsupported archive type: ' + targetPath); + } // write the completed marker fs.writeFileSync(marker, '');