diff --git a/.idea/dictionaries/develar.xml b/.idea/dictionaries/develar.xml index d3ffc1cc326..fcc6c3bbde9 100644 --- a/.idea/dictionaries/develar.xml +++ b/.idea/dictionaries/develar.xml @@ -24,6 +24,7 @@ globby gnubin graphicsmagick + gtar hicolor icnsutils keyserver diff --git a/src/linuxPackager.ts b/src/linuxPackager.ts index a57700f5acc..9db79b78140 100755 --- a/src/linuxPackager.ts +++ b/src/linuxPackager.ts @@ -43,7 +43,7 @@ export class LinuxPackager extends PlatformPackager { this.fpmPath = BluebirdPromise.resolve("fpm") } else { - this.fpmPath = downloadFpm(process.platform === "darwin" ? "1.5.0-1" : "1.5.0-2.3.1", process.platform === "darwin" ? "osx" : `linux-x86${process.arch === "ia32" ? "" : "_64"}`) + this.fpmPath = downloadFpm(process.platform === "darwin" ? "1.5.1-20150715-2.2.2" : "1.5.0-2.3.1", process.platform === "darwin" ? "osx" : `linux-x86${process.arch === "ia32" ? "" : "_64"}`) } } } @@ -73,14 +73,6 @@ export class LinuxPackager extends PlatformPackager { const appOutDir = this.computeAppOutDir(outDir, arch) await this.doPack(this.computePackOptions(outDir, appOutDir, arch), outDir, appOutDir, arch, this.customBuildOptions) - for (let target of targets) { - if (target === "zip" || target === "7z" || target.startsWith("tar.")) { - const destination = path.join(outDir, `${this.metadata.name}-${this.metadata.version}${getArchSuffix(arch)}.${target}`) - postAsyncTasks.push(this.archiveApp(target, appOutDir, destination) - .then(() => this.dispatchArtifactCreated(destination))) - } - } - postAsyncTasks.push(this.packageInDistributableFormat(outDir, appOutDir, arch, targets)) } @@ -190,7 +182,7 @@ Icon=${this.metadata.name} } protected async packageInDistributableFormat(outDir: string, appOutDir: string, arch: Arch, targets: Array): Promise { - // todo fix fpm - if we run in parallel, get strange tar errors + // todo fix fpm - if run in parallel, get strange tar errors for (let target of targets) { target = target === "default" ? "deb" : target if (target !== "dir" && target !== "zip" && target !== "7z" && !target.startsWith("tar.")) { @@ -199,6 +191,21 @@ Icon=${this.metadata.name} this.dispatchArtifactCreated(destination) } } + + const promises: Array> = [] + // https://github.com/electron-userland/electron-builder/issues/460 + // for some reasons in parallel to fmp we cannot use tar + for (let target of targets) { + if (target === "zip" || target === "7z" || target.startsWith("tar.")) { + const destination = path.join(outDir, `${this.metadata.name}-${this.metadata.version}${getArchSuffix(arch)}.${target}`) + promises.push(this.archiveApp(target, appOutDir, destination) + .then(() => this.dispatchArtifactCreated(destination))) + } + } + + if (promises.length > 0) { + await BluebirdPromise.all(promises) + } } private async buildPackage(destination: string, target: string, options: LinuxBuildOptions, appOutDir: string, arch: Arch): Promise { diff --git a/src/platformPackager.ts b/src/platformPackager.ts index 9d77df22dd0..8598d17ebf2 100644 --- a/src/platformPackager.ts +++ b/src/platformPackager.ts @@ -397,8 +397,7 @@ export abstract class PlatformPackager const compression = this.devMetadata.build.compression const storeOnly = compression === "store" - const fileToArchive = this.platform === Platform.OSX ? path.join(appOutDir, `${this.appName}.app`) : appOutDir - const baseDir = path.dirname(fileToArchive) + const dirToArchive = this.platform === Platform.OSX ? path.join(appOutDir, `${this.appName}.app`) : appOutDir if (format.startsWith("tar.")) { // we don't use 7z here - develar: I spent a lot of time making pipe working - but it works on OS X and often hangs on Linux (even if use pipe-io lib) // and in any case it is better to use system tools (in the light of docker - it is not problem for user because we provide complete docker image). @@ -409,8 +408,8 @@ export abstract class PlatformPackager tarEnv[info.env] = storeOnly ? info.minLevel : info.maxLevel } - await spawn(process.platform === "darwin" ? "/usr/local/opt/gnu-tar/libexec/gnubin/tar" : "tar", [info.flag, "-cf", outFile, fileToArchive], { - cwd: baseDir, + await spawn(process.platform === "darwin" || process.platform === "freebsd" ? "gtar" : "tar", [info.flag, "--transform", `s,^\.,${path.basename(outFile, "." + format)},`, "-cf", outFile, "."], { + cwd: dirToArchive, stdio: ["ignore", debug.enabled ? "inherit" : "ignore", "inherit"], env: tarEnv }) @@ -449,10 +448,10 @@ export abstract class PlatformPackager args.push("-mm=" + (storeOnly ? "Copy" : "Deflate")) } - args.push(outFile, fileToArchive) + args.push(outFile, dirToArchive) await spawn(path7za, args, { - cwd: baseDir, + cwd: path.dirname(dirToArchive), stdio: ["ignore", debug.enabled ? "inherit" : "ignore", "inherit"], }) } diff --git a/test/src/linuxPackagerTest.ts b/test/src/linuxPackagerTest.ts index 055bb14b5cf..37e9d6de314 100755 --- a/test/src/linuxPackagerTest.ts +++ b/test/src/linuxPackagerTest.ts @@ -9,36 +9,38 @@ const __awaiter = require("out/awaiter") test.ifNotWindows("deb", () => assertPack("test-app-one", platform(Platform.LINUX))) -test.ifDevOrLinuxCi("rpm", () => assertPack("test-app-one", { +test.ifDevOrLinuxCi("targets", () => assertPack("test-app-one", { targets: Platform.LINUX.createTarget(), devMetadata: { build: { linux: { - target: ["rpm"] + // "apk" is very slow, don't test for now + target: ["sh", "freebsd", "pacman", "zip", "7z"], } } } })) -test.ifDevOrLinuxCi("targets", () => assertPack("test-app-one", { +test.ifDevOrLinuxCi("tar", () => assertPack("test-app-one", { targets: Platform.LINUX.createTarget(), devMetadata: { build: { linux: { // "apk" is very slow, don't test for now - target: ["sh", "freebsd", "pacman", "zip", "7z"], + target: ["tar.xz", "tar.lz", "tar.bz2"], } } } })) -test.ifDevOrLinuxCi("tar", () => assertPack("test-app-one", { +// https://github.com/electron-userland/electron-builder/issues/460 +// for some reasons in parallel to fmp we cannot use tar +test.ifDevOrLinuxCi("rpm and tar.gz", () => assertPack("test-app-one", { targets: Platform.LINUX.createTarget(), devMetadata: { build: { linux: { - // "apk" is very slow, don't test for now - target: ["tar.xz", "tar.lz", "tar.gz", "tar.bz2"], + target: ["rpm", "tar.gz"], } } }