From 8d9b952c54f2c20f606aec2fccd33eaa3c1d9a2d Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Fri, 13 May 2016 14:19:41 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20win=20ia32=20out=20dir=20name=20?= =?UTF-8?q?=E2=80=94=20unexpanded=20$arch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/fpmDownload.ts | 20 +++++++++++++------- src/winPackager.ts | 2 +- test/src/winPackagerTest.ts | 15 +++++++++++++-- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 4687220b605..00defe96c78 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "bugs": "https://github.com/electron-userland/electron-builder/issues", "homepage": "https://github.com/electron-userland/electron-builder", "dependencies": { - "7zip-bin": "^1.0.0", + "7zip-bin": "^1.0.5", "asar": "^0.11.0", "bluebird": "^3.3.5", "chalk": "^1.1.3", diff --git a/src/fpmDownload.ts b/src/fpmDownload.ts index 86d60315a80..97eef635038 100644 --- a/src/fpmDownload.ts +++ b/src/fpmDownload.ts @@ -1,5 +1,5 @@ import { statOrNull, spawn, debug, debug7z } from "./util" -import { writeFile, rename, remove } from "fs-extra-p" +import { writeFile, rename, remove, stat, emptyDir } from "fs-extra-p" import { download } from "./httpRequest" import { path7za } from "7zip-bin" import * as path from "path" @@ -41,25 +41,31 @@ async function doDownloadFpm(version: string, osAndArch: string): Promise([download(url, archiveName), emptyDir(tempUnpackDir)]) + + if (debug.enabled && (!(await stat(archiveName)).isFile())) { + throw new Error(`${archiveName} was not downloaded correctly`) + } + + const args = ["x", archiveName, "-o" + tempUnpackDir, "-bd"] if (debug7z.enabled) { args.push("-bb3") } else if (!debug.enabled) { args.push("-bb0") } + await spawn(path7za, args, { cwd: cacheDir, stdio: ["ignore", debug.enabled ? "inherit" : "ignore", "inherit"], diff --git a/src/winPackager.ts b/src/winPackager.ts index ccb9938cad9..3579244a307 100644 --- a/src/winPackager.ts +++ b/src/winPackager.ts @@ -230,7 +230,7 @@ function isIco(buffer: Buffer): boolean { } export function computeDistOut(outDir: string, arch: string): string { - return path.join(outDir, "win" + (arch === "x64" ? "" : "-arch")) + return path.join(outDir, `win${arch === "x64" ? "" : `-${arch}` }`) } function checkConflictingOptions(options: any) { diff --git a/test/src/winPackagerTest.ts b/test/src/winPackagerTest.ts index f48d59d0c04..68759580374 100755 --- a/test/src/winPackagerTest.ts +++ b/test/src/winPackagerTest.ts @@ -12,13 +12,24 @@ import ElectronPackagerOptions = ElectronPackager.ElectronPackagerOptions //noinspection JSUnusedLocalSymbols const __awaiter = require("out/awaiter") -test.ifNotCiOsx("win", () => assertPack("test-app-one", signed(platform(Platform.WINDOWS)), +test.ifNotCiOsx("win", () => assertPack("test-app-one", signed({ + platform: [Platform.WINDOWS], + arch: "all", + }), { tempDirCreated: process.env.TEST_DELTA ? it => modifyPackageJson(it, data => { data.build.win = { remoteReleases: "https://github.com/develar/__test-app-releases", } - }) : null + }) : null, + expectedArtifacts: [ + "RELEASES", + "RELEASES", + "TestApp Setup 1.1.0-ia32.exe", + "TestApp Setup 1.1.0.exe", + "TestApp-1.1.0-full.nupkg", + "TestApp-1.1.0-full.nupkg" + ], } ))