@@ -429,13 +429,14 @@ function download_module() {
429
429
430
430
switch ( mvm . pkg_install_typeinfo . type ) {
431
431
case 'registry' :
432
- const r = http_get ( mvm . dist . tarball ) ;
432
+ var r = http_get ( mvm . dist . tarball ) ;
433
433
if ( r . statusCode !== 200 ) {
434
434
console . error ( 'download error::' , mvm . dist . tarball ) ;
435
435
process . exit ( ) ;
436
436
}
437
437
438
- const tgz = r . data ;
438
+ let tgz = r . data ;
439
+ r = null ;
439
440
440
441
if ( hash . sha1 ( tgz ) . digest ( ) . hex ( ) !== mvm . dist . shasum ) {
441
442
console . error ( 'shasum:' , mvm . dist . tarball ) ;
@@ -447,6 +448,7 @@ function download_module() {
447
448
t = zlib . gunzip ( tgz ) ;
448
449
else
449
450
t = tgz ;
451
+ tgz = null ;
450
452
451
453
const untar_files = untar ( t . buffer ) ;
452
454
@@ -458,8 +460,8 @@ function download_module() {
458
460
<
10000
code class="diff-text syntax-highlighted-line"> )
459
461
}
460
462
461
- mvm . base_path . forEach ( bp => {
462
- coroutine . parallel ( untar_files , ( file ) => {
463
+ untar_files . forEach ( file => {
464
+ mvm . base_path . forEach ( bp => {
463
465
if ( file . typeflag == 1 ) {
464
466
const read_files = untar_files . filter ( f => f . filename == file . linkname ) ;
465
467
file . typeflag = "0" ;
@@ -474,21 +476,22 @@ function download_module() {
474
476
fs . writeFile ( tpath , file . fileData ) ;
475
477
fs . chmod ( tpath , parseInt ( file . mode , 8 ) ) ;
476
478
}
477
- } )
479
+ } ) ;
478
480
} ) ;
479
481
480
482
install_log ( 'extract:' , mvm . dist . tarball ) ;
481
483
break
482
484
case 'git' :
483
485
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 ) ;
485
487
486
488
if ( git_r . statusCode !== 200 ) {
487
489
console . error ( 'download error::' , mvm . dist . tarball ) ;
488
490
process . exit ( ) ;
489
491
}
490
- const git_zip_file = zip . open ( git_r . body . readAll ( ) ) ;
492
+ var git_zip_file = zip . open ( git_r . body . readAll ( ) ) ;
491
493
const namelist = git_zip_file . namelist ( ) ;
494
+ git_r = null ;
492
495
493
496
archive_root_name = `${ mvm . pkg_install_typeinfo . git_basename } -${ mvm . pkg_install_typeinfo . git_reference } ` ;
494
497
if ( namelist [ 0 ] . indexOf ( archive_root_name ) !== 0 ) {
@@ -514,7 +517,7 @@ function download_module() {
514
517
} )
515
518
} ) ;
516
519
517
- coroutine . parallel ( git_i_tuples , ( [ member , tpath ] ) => {
520
+ git_i_tuples . forEach ( ( [ member , tpath ] ) => {
518
521
git_zip_file . extract ( member , tpath ) ;
519
522
} ) ;
520
523
@@ -524,22 +527,25 @@ function download_module() {
524
527
525
528
if ( mvm . binary ) {
526
529
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 ) ;
528
531
529
532
if ( binary_r . statusCode !== 200 ) {
530
533
console . error ( 'download error::' , mvm . binary . hosted_tarball ) ;
531
534
process . exit ( ) ;
532
535
}
533
536
534
- const tgz = binary_r . data ;
537
+ var tgz = binary_r . data ;
538
+ binary_r = null ;
535
539
536
540
let t ;
537
541
if ( tgz [ 0 ] === 0x1f && tgz [ 1 ] === 0x8b )
538
542
t = zlib . gunzip ( tgz ) ;
539
543
else
540
544
t = tgz ;
545
+ tgz = null ;
541
546
542
547
const untar_files = untar ( t . buffer ) ;
548
+ t = null ;
543
549
544
550
archive_root_name = path . dirname ( untar_files [ 0 ] . filename ) ;
545
551
untar_files . forEach ( file => {
@@ -548,7 +554,7 @@ function download_module() {
548
554
archive_root_name = helpers_string . ensure_unsuffx ( archive_root_name ) ;
549
555
550
556
mvm . base_path . forEach ( bp => {
551
- coroutine . parallel ( untar_files , ( file ) => {
557
+ untar_files . forEach ( file => {
552
558
if ( file . typeflag == 1 ) {
553
559
const read_files = untar_files . filter ( f => f . filename == file . linkname ) ;
554
560
file . typeflag = "0" ;
@@ -563,7 +569,7 @@ function download_module() {
563
569
fs . writeFile ( bpath , file . fileData ) ;
564
570
fs . chmod ( bpath , parseInt ( file . mode , 8 ) ) ;
565
571
}
566
- } )
572
+ } ) ;
567
573
} ) ;
568
574
569
575
install_log ( "extract addon:" , mvm . binary . hosted_tarball ) ;
0 commit comments