Skip to content

Commit

Permalink
fix: icudtl.dat: file changed as we read it
Browse files Browse the repository at this point in the history
Close #460
  • Loading branch information
develar committed Jun 3, 2016
1 parent a7b2932 commit 567c813
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
1 change: 1 addition & 0 deletions .idea/dictionaries/develar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 17 additions & 10 deletions src/linuxPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class LinuxPackager extends PlatformPackager<LinuxBuildOptions> {
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"}`)
}
}
}
Expand Down Expand Up @@ -73,14 +73,6 @@ export class LinuxPackager extends PlatformPackager<LinuxBuildOptions> {
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))
}

Expand Down Expand Up @@ -190,7 +182,7 @@ Icon=${this.metadata.name}
}

protected async packageInDistributableFormat(outDir: string, appOutDir: string, arch: Arch, targets: Array<string>): Promise<any> {
// 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.")) {
Expand All @@ -199,6 +191,21 @@ Icon=${this.metadata.name}
this.dispatchArtifactCreated(destination)
}
}

const promises: Array<Promise<any>> = []
// 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<any> {
Expand Down
11 changes: 5 additions & 6 deletions src/platformPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,7 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
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).
Expand All @@ -409,8 +408,8 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
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
})
Expand Down Expand Up @@ -449,10 +448,10 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
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"],
})
}
Expand Down
16 changes: 9 additions & 7 deletions test/src/linuxPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}
}
}
Expand Down

0 comments on commit 567c813

Please sign in to comment.