8000 options, refactor: fix installation errors for symbolic link files in… · fibjs/fibjs@ab6a9d3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit ab6a9d3

Browse files
committed
options, refactor: fix installation errors for symbolic link files in tar.gz.
1 parent 734028d commit ab6a9d3

File tree

3 files changed

+418
-399
lines changed

3 files changed

+418
-399
lines changed

fibjs/scripts/internal/helpers/untar.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,8 @@ const untar = (function () {
235235
// While we don't encounter an empty block, keep making TarLocalFiles.
236236
while (bstream.peekNumber(4) != 0) {
237237
var oneLocalFile = new TarLocalFile(bstream);
238-
if (oneLocalFile && oneLocalFile.isValid) {
238+
if (oneLocalFile && oneLocalFile.typeflag != 5)
239239
localFiles.push(oneLocalFile);
240-
// totalUncompressedBytesInArchive += oneLocalFile.size;
241-
}
242240
}
243241
return localFiles;
244242
}

fibjs/scripts/opt_tools/install.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,14 @@ function download_module() {
461461

462462
mvm.base_path.forEach(bp => {
463463
coroutine.parallel(untar_files, (file) => {
464+
if (file.typeflag == 1) {
465+
const read_files = untar_files.filter(f => f.filename == file.linkname);
466+
file.typeflag = "0";
467+
file.linkname = "";
468+
file.fileData = read_files[0].fileData;
469+
file.size = read_files[0].size;
470+
}
471+
464472
const relpath = file.filename.slice(archive_root_name.length);
465473

466474
if (!relpath) return;
@@ -519,7 +527,7 @@ function download_module() {
519527
}
520528

521529
if (mvm.binary) {
522-
console.error(mvm.binary.hosted_tarball);
530+
install_log("[install addon]", mvm.binary.hosted_tarball);
523531
const binary_r = http_get(mvm.binary.hosted_tarball);
524532

525533
if (binary_r.statusCode !== 200) {
@@ -545,13 +553,22 @@ function download_module() {
545553

546554
mvm.base_path.forEach(bp => {
547555
coroutine.parallel(untar_files, (file) => {
556+
if (file.typeflag == 1) {
557+
const read_files = untar_files.filter(f => f.filename == file.linkname);
558+
file.typeflag = "0";
559+
file.linkname = "";
560+
file.fileData = read_files[0].fileData;
561+
file.size = read_files[0].size;
562+
}
563+
548564
var bpath = path.join(bp, mvm.name, mvm.binary.module_path, file.filename.slice(archive_root_name.length));
549565
helpers_fs.mkdirp(path.dirname(bpath));
550566
fs.writeFile(bpath, file.fileData);
551567
fs.chmod(bpath, parseInt(file.mode, 8));
552-
install_log("extract addons:", bpath);
553568
})
554569
});
570+
571+
install_log("extract addon:", mvm.binary.hosted_tarball);
555572
}
556573

557574
if (mvm.bin) {

0 commit comments

Comments
 (0)
0