8000 Merge remote-tracking branch 'origin/dev' into dev · fibjs/fibjs@8347822 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 8347822

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 2114096 + 53304c0 commit 8347822

File tree

7 files changed

+330
-317
lines changed

7 files changed

+330
-317
lines changed

fibjs/scripts/opt_tools/install.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,14 @@ function download_module() {
429429

430430
switch (mvm.pkg_install_typeinfo.type) {
431431
case 'registry':
432-
const r = http_get(mvm.dist.tarball);
432+
var r = http_get(mvm.dist.tarball);
433433
if (r.statusCode !== 200) {
434434
console.error('download error::', mvm.dist.tarball);
435435
process.exit();
436436
}
437437

438-
const tgz = r.data;
438+
let tgz = r.data;
439+
r = null;
439440

440441
if (hash.sha1(tgz).digest().hex() !== mvm.dist.shasum) {
441442
console.error('shasum:', mvm.dist.tarball);
@@ -447,6 +448,7 @@ function download_module() {
447448
t = zlib.gunzip(tgz);
448449
else
449450
t = tgz;
451+
tgz = null;
450452

451453
const untar_files = untar(t.buffer);
452454

@@ -458,8 +460,8 @@ function download_module() {
458460
)
459461
}
460462

461-
mvm.base_path.forEach(bp => {
462-
coroutine.parallel(untar_files, (file) => {
463+
untar_files.forEach(file => {
464+
mvm.base_path.forEach(bp => {
463465
if (file.typeflag == 1) {
464466
const read_files = untar_files.filter(f => f.filename == file.linkname);
465467
file.typeflag = "0";
@@ -474,21 +476,22 @@ function download_module() {
474476
fs.writeFile(tpath, file.fileData);
475477
fs.chmod(tpath, parseInt(file.mode, 8));
476478
}
477-
})
479+
});
478480
});
479481

480482
install_log('extract:', mvm.dist.tarball);
481483
break
482484
case 'git':
483485
const git_archive_url = helpers_pkg.get_git_archive_url(mvm.pkg_install_typeinfo);
484-
const git_r = http_get(git_archive_url);
486+
var git_r = http_get(git_archive_url);
485487

486488
if (git_r.statusCode !== 200) {
487489
console.error('download error::', mvm.dist.tarball);
488490
process.exit();
489491
}
490-
const git_zip_file = zip.open(git_r.body.readAll());
492+
var git_zip_file = zip.open(git_r.body.readAll());
491493
const namelist = git_zip_file.namelist();
494+
git_r = null;
492495

493496
archive_root_name = `${mvm.pkg_install_typeinfo.git_basename}-${mvm.pkg_install_typeinfo.git_reference}`;
494497
if (namelist[0].indexOf(archive_root_name) !== 0) {
@@ -514,7 +517,7 @@ function download_module() {
514517
})
515518
});
516519

517-
coroutine.parallel(git_i_tuples, ([member, tpath]) => {
520+
git_i_tuples.forEach(([member, tpath]) => {
518521
git_zip_file.extract(member, tpath);
519522
});
520523

@@ -524,22 +527,25 @@ function download_module() {
524527

525528
if (mvm.binary) {
526529
install_log("[install addon]", mvm.binary.hosted_tarball);
527-
const binary_r = http_get(mvm.binary.hosted_tarball);
530+
var binary_r = http_get(mvm.binary.hosted_tarball);
528531

529532
if (binary_r.statusCode !== 200) {
530533
console.error('download error::', mvm.binary.hosted_tarball);
531534
process.exit();
532535
}
533536

534-
const tgz = binary_r.data;
537+
var tgz = binary_r.data;
538+
binary_r = null;
535539

536540
let t;
537541
if (tgz[0] === 0x1f && tgz[1] === 0x8b)
538542
t = zlib.gunzip(tgz);
539543
else
540544
t = tgz;
545+
tgz = null;
541546

542547
const untar_files = untar(t.buffer);
548+
t = null;
543549

544550
archive_root_name = path.dirname(untar_files[0].filename);
545551
untar_files.forEach(file => {
@@ -548,7 +554,7 @@ function download_module() {
548554
archive_root_name = helpers_string.ensure_unsuffx(archive_root_name);
549555

550556
mvm.base_path.forEach(bp => {
551-
coroutine.parallel(untar_files, (file) => {
557+
untar_files.forEach(file => {
552558
if (file.typeflag == 1) {
553559
const read_files = untar_files.filter(f => f.filename == file.linkname);
554560
file.typeflag = "0";
@@ -563,7 +569,7 @@ function download_module() {
563569
fs.writeFile(bpath, file.fileData);
564570
fs.chmod(bpath, parseInt(file.mode, 8));
565571
}
566-
})
572+
});
567573
});
568574

569575
install_log("extract addon:", mvm.binary.hosted_tarball);

0 commit comments

Comments
 (0)
0