@@ -420,6 +420,7 @@ void downloadXpack(string which) {
420
420
421
421
string url = " https://github.com/opendlang/opend/releases/download/CI/opend-latest-" ~ which ~ " .tar.xz" ;
422
422
string destination = getXpackPath();
423
+ bool done;
423
424
424
425
void processor () {
425
426
TarFileHeader tfh;
@@ -429,20 +430,33 @@ void downloadXpack(string which) {
429
430
import std.stdio ;
430
431
File file;
431
432
long currentFileSize;
433
+ bool skippingFile;
432
434
433
435
decompressLzma(
434
436
(in ubyte [] chunk) => cast (void ) processTar(&tfh, &size, chunk,
435
437
(header, isNewFile, fileFinished, data) {
436
438
if (isNewFile) {
437
- import std.stdio ; writeln(" inflating xpack file " , header.filename);
438
- import std.path , std.file ;
439
- mkdirRecurse(dirName(buildPath(destination, header.filename)));
440
- file = File (buildPath(destination, header.filename), " wb" );
441
- currentFileSize = header.size;
439
+ if (header.type == TarFileType.normal)
440
+ skippingFile = false ;
441
+ else
442
+ skippingFile = true ;
443
+
444
+ if (! skippingFile) {
445
+ import std.stdio ; writeln(" inflating xpack file " , header.filename);
446
+ import std.path , std.file ;
447
+ mkdirRecurse(dirName(buildPath(destination, header.filename)));
448
+ file = File (buildPath(destination, header.filename), " wb" );
449
+ currentFileSize = header.size;
450
+ } else {
451
+ }
452
+ }
453
+ if (! skippingFile)
454
+ file.rawWrite(data);
455
+ if (fileFinished) {
456
+ if (! skippingFile)
457
+ file.close();
458
+ skippingFile = false ;
442
459
}
443
- file.rawWrite(data);
444
- if (fileFinished)
445
- file.close();
446
460
}),
447
461
(ubyte [] buffer) {
448
462
try_again:
@@ -458,6 +472,8 @@ void downloadXpack(string which) {
458
472
},
459
473
tarBuffer[]
460
474
);
475
+
476
+ done = true ;
461
477
}
462
478
463
479
auto fiber = new Fiber (&processor, 1 * 1024 * 1024 /* reserve 1 MB stack */ );
@@ -468,8 +484,9 @@ void downloadXpack(string which) {
468
484
auto http = HTTP (url);
469
485
http.onReceive = (ubyte [] data) {
470
486
availableData = data;
471
- fiber.call();
472
- return data.length - availableData.length;
487
+ if (! done)
488
+ fiber.call();
489
+ return data.length;
473
490
};
474
491
http.perform();
475
492
0 commit comments