Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tar tool for .tar.gz node.js archives #1050

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions node/buildutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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);
Expand All @@ -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}"`);
KonstantinTyukalov marked this conversation as resolved.
Show resolved Hide resolved
} else {
throw new Error('Unsupported archive type: ' + targetPath);
}

// write the completed marker
fs.writeFileSync(marker, '');
Expand Down