From e35846aac2fc6ca61d5259f9bc51cb2aaa26961d Mon Sep 17 00:00:00 2001 From: develar Date: Sat, 27 Jan 2018 17:54:40 +0100 Subject: [PATCH] fix: use app-builder as xz-7za proxy Close #2523 --- .idea/dictionaries/develar.xml | 1 + package.json | 4 +-- packages/builder-util/package.json | 2 +- .../src/options/linuxOptions.ts | 12 ++++----- packages/electron-builder-lib/src/packager.ts | 6 ++--- .../src/targets/LinuxTargetHelper.ts | 4 +-- .../src/targets/archive.ts | 3 +-- .../electron-builder-lib/src/targets/fpm.ts | 10 +++++--- .../electron-builder-lib/src/targets/tools.ts | 25 +++++++++---------- packages/electron-publisher-s3/package.json | 2 +- packages/electron-updater/package.json | 2 +- yarn.lock | 14 ++++++++--- 12 files changed, 46 insertions(+), 39 deletions(-) diff --git a/.idea/dictionaries/develar.xml b/.idea/dictionaries/develar.xml index 300dcd611e6..1c562c1bd39 100644 --- a/.idea/dictionaries/develar.xml +++ b/.idea/dictionaries/develar.xml @@ -374,6 +374,7 @@ xorriso xproj xubuntu + xzmt yaml yargs yarnclean diff --git a/package.json b/package.json index c41c829ec96..9d8c37b7a2e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "7zip-bin": "^2.4.1", "archiver": "^2.1.1", "async-exit-hook": "^2.0.1", - "aws-sdk": "^2.186.0", + "aws-sdk": "^2.188.0", "bluebird-lst": "^1.0.5", "chalk": "^2.3.0", "chromium-pickle-js": "^0.2.0", @@ -60,7 +60,7 @@ "sanitize-filename": "^1.6.1", "sax": "^1.2.4", "semver": "^5.5.0", - "source-map-support": "^0.5.2", + "source-map-support": "^0.5.3", "stat-mode": "^0.2.2", "temp-file": "^3.1.1", "tunnel-agent": "^0.6.0", diff --git a/packages/builder-util/package.json b/packages/builder-util/package.json index a521b51d785..39377361805 100644 --- a/packages/builder-util/package.json +++ b/packages/builder-util/package.json @@ -19,7 +19,7 @@ "chalk": "^2.3.0", "debug": "^3.1.0", "builder-util-runtime": "^0.0.0-semantic-release", - "source-map-support": "^0.5.2", + "source-map-support": "^0.5.3", "7zip-bin": "^2.4.1", "ini": "^1.3.5", "tunnel-agent": "^0.6.0", diff --git a/packages/electron-builder-lib/src/options/linuxOptions.ts b/packages/electron-builder-lib/src/options/linuxOptions.ts index 3fd5a39fb75..763d1df8c2d 100644 --- a/packages/electron-builder-lib/src/options/linuxOptions.ts +++ b/packages/electron-builder-lib/src/options/linuxOptions.ts @@ -75,6 +75,12 @@ export interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSp */ readonly depends?: Array | null + /** + * The compression type. + * @default xz + */ + readonly compression?: "gz" | "bzip2" | "xz" | null + readonly icon?: string /** @@ -95,12 +101,6 @@ export interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSp } export interface DebOptions extends LinuxTargetSpecificOptions { - /** - * The compression type. - * @default xz - */ - readonly compression?: "gz" | "bzip2" | "xz" | null - /** * Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]`. */ diff --git a/packages/electron-builder-lib/src/packager.ts b/packages/electron-builder-lib/src/packager.ts index da8c566e40f..b4ae0e38d3f 100644 --- a/packages/electron-builder-lib/src/packager.ts +++ b/packages/electron-builder-lib/src/packager.ts @@ -243,7 +243,7 @@ export class Packager { this._devMetadata = await orNullIfFileNotExist(readPackageJson(devPackageFile)) const devMetadata = this.devMetadata - const configuration = await getConfig(projectDir, configPath, configFromOptions, new Lazy(() => BluebirdPromise.resolve(devMetadata))) + const configuration = await getConfig(projectDir, configPath, configFromOptions, new Lazy(() => Promise.resolve(devMetadata))) if (log.isDebugEnabled) { log.debug({config: serializeToYaml(JSON.parse(safeStringifyJson(configuration)))}, "effective config") } @@ -278,7 +278,7 @@ export class Packager { this._devMetadata = devMetadata if (repositoryInfo != null) { - this._repositoryInfo.value = BluebirdPromise.resolve(repositoryInfo) + this._repositoryInfo.value = Promise.resolve(repositoryInfo) } const projectDir = this.projectDir @@ -290,7 +290,7 @@ export class Packager { throw new Error(`Cannot compute electron version for prepacked asar`) } } - configuration.electronVersion = await computeElectronVersion(projectDir, new Lazy(() => BluebirdPromise.resolve(this.metadata))) + configuration.electronVersion = await computeElectronVersion(projectDir, new Lazy(() => Promise.resolve(this.metadata))) } this._appInfo = new AppInfo(this) diff --git a/packages/electron-builder-lib/src/targets/LinuxTargetHelper.ts b/packages/electron-builder-lib/src/targets/LinuxTargetHelper.ts index 5fbdf1b820d..9ff2cc79e50 100644 --- a/packages/electron-builder-lib/src/targets/LinuxTargetHelper.ts +++ b/packages/electron-builder-lib/src/targets/LinuxTargetHelper.ts @@ -2,7 +2,7 @@ import { isEmptyOrSpaces, log } from "builder-util" import { outputFile } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" -import { LinuxConfiguration, LinuxTargetSpecificOptions } from ".." +import { LinuxTargetSpecificOptions } from ".." import { LinuxPackager } from "../linuxPackager" import { IconInfo } from "../platformPackager" import { getTemplatePath } from "../util/pathManager" @@ -46,7 +46,7 @@ export class LinuxTargetHelper { return iconPath == null ? null : path.resolve(this.packager.projectDir, iconPath) } - getDescription(options: LinuxConfiguration) { + getDescription(options: LinuxTargetSpecificOptions) { return options.description || this.packager.appInfo.description } diff --git a/packages/electron-builder-lib/src/targets/archive.ts b/packages/electron-builder-lib/src/targets/archive.ts index 65fdfbbeb73..833f223a774 100644 --- a/packages/electron-builder-lib/src/targets/archive.ts +++ b/packages/electron-builder-lib/src/targets/archive.ts @@ -1,5 +1,4 @@ import { path7za } from "7zip-bin" -import BluebirdPromise from "bluebird-lst" import { debug7z, debug7zArgs, exec } from "builder-util" import { exists, unlinkIfExists } from "builder-util/out/fs" import { move } from "fs-extra-p" @@ -15,7 +14,7 @@ export async function tar(compression: CompressionLevel | any | any, format: str tarArgs.push(tarFile) tarArgs.push(path.basename(dirToArchive)) - await BluebirdPromise.all([ + await Promise.all([ exec(path7za, tarArgs, {cwd: path.dirname(dirToArchive)}), // remove file before - 7z doesn't overwrite file, but update unlinkIfExists(outFile), diff --git a/packages/electron-builder-lib/src/targets/fpm.ts b/packages/electron-builder-lib/src/targets/fpm.ts index 9882baca858..8ed42f170ec 100644 --- a/packages/electron-builder-lib/src/targets/fpm.ts +++ b/packages/electron-builder-lib/src/targets/fpm.ts @@ -1,4 +1,4 @@ -import { path7za, pathCompressStdIn } from "7zip-bin" +import { path7za } from "7zip-bin" import BluebirdPromise from "bluebird-lst" import { Arch, debug, exec, isMacOsSierra, log, smarten, TmpDir, toLinuxArchString, use } from "builder-util" import { computeEnv } from "builder-util/out/bundledTool" @@ -11,7 +11,7 @@ import * as errorMessages from "../errorMessages" import { LinuxPackager } from "../linuxPackager" import { getTemplatePath } from "../util/pathManager" import { installPrefix, LinuxTargetHelper } from "./LinuxTargetHelper" -import { fpmPath, getLinuxToolsPath } from "./tools" +import { fpmPath, getAppBuilderTool, getLinuxToolsPath } from "./tools" interface FpmOptions { maintainer: string | undefined @@ -149,11 +149,13 @@ export default class FpmTarget extends Target { args.push("--category", packageCategory) } + const compression = options.compression if (target === "deb") { - args.push("--deb-compression", (options as DebOptions).compression || "xz") + args.push("--deb-compression", compression || "xz") use((options as DebOptions).priority, it => args.push("--deb-priority", it!)) } else if (target === "rpm") { + args.push("--rpm-compression", (compression === "xz" ? "xzmt" : compression) || "xzmt") args.push("--rpm-os", "linux") if (synopsis != null) { @@ -212,7 +214,7 @@ export default class FpmTarget extends Target { const env = { ...process.env, - FPM_COMPRESS_PROGRAM: pathCompressStdIn, + FPM_COMPRESS_PROGRAM: await getAppBuilderTool(), SZA_PATH: path7za, SZA_COMPRESSION_LEVEL: packager.compression === "store" ? "0" : "9", SZA_ARCHIVE_TYPE: "xz", diff --git a/packages/electron-builder-lib/src/targets/tools.ts b/packages/electron-builder-lib/src/targets/tools.ts index e3a57e3f473..aa5059ffa49 100644 --- a/packages/electron-builder-lib/src/targets/tools.ts +++ b/packages/electron-builder-lib/src/targets/tools.ts @@ -1,4 +1,3 @@ -import BluebirdPromise from "bluebird-lst" import { isEnvTrue } from "builder-util" import { getBin, getBinFromGithub } from "builder-util/out/binDownload" import { Lazy } from "lazy-val" @@ -17,20 +16,20 @@ export function getAppImage() { export const fpmPath = new Lazy(() => { if (process.platform === "win32" || process.env.USE_SYSTEM_FPM === "true") { - return BluebirdPromise.resolve("fpm") + return Promise.resolve("fpm") } const osAndArch = process.platform === "darwin" ? "mac" : `linux-x86${process.arch === "ia32" ? "" : "_64"}` if (process.platform === "darwin") { //noinspection SpellCheckingInspection - return getBinFromGithub("fpm", "1.9.2.1-20150715-2.2.2-mac", "6sZZoRKkxdmv3a6E5dnZgVl23apGnImhDtGHKhgCE1WOtXBUJnx+w0WvB2HD2/sitz4f93Mf7+QqDCIbfP7LOw==") + return getBinFromGithub("fpm", "1.9.3-20150715-2.2.2-mac", "oXfq+0H2SbdrbMik07mYloAZ8uHrmf6IJk+Q3P1kwywuZnKTXSaaeZUJNlWoVpRDWNu537YxxpBQWuTcF+6xfw==") .then(it => path.join(it, "fpm")) } //noinspection SpellCheckingInspection - const checksum = process.arch === "ia32" ? "cTT/HdjrQ6qTJQhTZaZC3lyDkRCyNFtNBZ0F7n6mh5B3YmD5ttJZ0xn65pQS03dhEi67A8K1xXNO+tyEEviiIg==" : "0zKxWlHuQEUsXJpWll5Bc4OTI8d0jcMVlme9OeHI+Y+s3sv1S4KyGLOEVEkNw6pRU8F+A1Dj5IR95/+U8YzB0A==" - return getBinFromGithub("fpm", `1.9.2-2.3.1-${osAndArch}`, checksum) + const checksum = process.arch === "ia32" ? "OnzvBdsHE5djcXcAT87rwbnZwS789ZAd2ehuIO42JWtBAHNzXKxV4o/24XFX5No4DJWGO2YSGQttW+zn7d/4rQ==" : "fcKdXPJSso3xFs5JyIJHG1TfHIRTGDP0xhSBGZl7pPZlz4/TJ4rD/q3wtO/uaBBYeX0qFFQAFjgu1uJ6HLHghA==" + return getBinFromGithub("fpm", `1.9.3-2.3.1-${osAndArch}`, checksum) .then(it => path.join(it, "fpm")) }) @@ -124,13 +123,13 @@ export function getAppBuilderTool() { return getTool({ repository: "develar/app-builder", name: "app-builder", - version: "0.6.0", - mac: "d27p1TYhPVlWFS+3TO8dh80sHP5imMnZTS04ODvL9xHpCQ7KZEUqFEWYi7zDFXKfzBU6zwBcRGrb8BwQAawvzg==", - "linux-ia32": "1aLAsDliV/kCYfOQR/NX43pRwO/v4nC7F98Z9ZRO8r8iXEpTLYVJC19FNup81WpD0hvxLBspnbq73YiSE3aX8g==", - "linux-x64": "6iu/0BzEKTIuCZ/pVPorpLTXjTzqcquTfrlyB9mEyPXQcHPTueK+tBBDQ6SIO7eaGq+W3PDe1oEjgiz2q3Zd4g==", - "linux-armv7": "zUxn5fAxeGylF7mqVP+Aaas3vD3ITTS26EBty9VkGz51EYgCVYnQVTacDIQjwB6s1zit6jt8EJy5Jj0Y+6U+7w==", - "linux-armv8": "69napXVwaPqQcNp7tozNyo7VJbB90E2RToN0pqGppdfUBzTLJUNnZL5D7H4MoUUPS/WgNRalEswb7GfZOsK4XA==", - "win-ia32": "HW+pZS96d0v96iq0y8BX4vg5J97oFMujPaqziatRNZif26EI75lS5S58qCEmooyr9lXDLwbIlNIhrKg7ZzlNhw==", - "win-x64": "eO8eJq2N/t0/3g3EuRut0LU460WUqzywiRhr+OjEUQH1Gt7GuIdc4gYOfDazYjyeTqlATCfT/OzQMdplaac2wQ==", + version: "0.6.1", + "linux-armv7": "oDOrB1Cv65OkNF1+bLTpw50xG+C1p6wjbWEwYGR+WbQs6ScrqcN7bPbHrSW1t578d5Y+x/sU5PYrfpBJTE9I2w==", + "linux-armv8": "f10m8QnQr7V2bf1rZnun+uGc1piZjYLZx2OWKyNwsL+IRpT0VCnTUpuL0TV4UJbw1QzPg/JdzGAKubRfuXaWMw==", + "linux-ia32": "qb14V2GfUIZ64ytrJemW0tgcvyrOPzWfWJQ8SJ6O+MmXC+zNGFBR2FYxfTzGOeB9iaXZucdAImxBxCrqUwZgew==", + "linux-x64": "xPYAnXx535ZSMktNwbvsV4U1BadXaad0LtVtQBoFJuuRUQFqyOImK5XBvnhRhac7Ufx1S1jLoVfTMocPWvKutw==", + mac: "ONEM+jbw48kBkqFXkxHQiEXEjLtm0TWVqDEjw7X4SX5GKtejfAGus9efMBcghG9O2ooRqcj5PGtbpV65LQs5ug==", + "win-ia32": "XHQRnsLhuu+O20wf24bKWHT4I8sXT5e16970guutZjqcAC07O6/wQk527R6DBSoGHe+71neUK/oYK6B23glrAw==", + "win-x64": "m1kR07Nz0fHvwPHcfYnJvd8puQfh71qbLoySXJHNS88xyEZNKMJXOTlwjUbv2D05LpzrhgIbBZFH5GOedlCQpA==", }) } \ No newline at end of file diff --git a/packages/electron-publisher-s3/package.json b/packages/electron-publisher-s3/package.json index 4ad40f7f178..d734a5f53b5 100644 --- a/packages/electron-publisher-s3/package.json +++ b/packages/electron-publisher-s3/package.json @@ -12,7 +12,7 @@ ], "dependencies": { "fs-extra-p": "^4.5.0", - "aws-sdk": "^2.186.0", + "aws-sdk": "^2.188.0", "mime": "^2.2.0", "electron-publish": "~0.0.0-semantic-release", "builder-util": "^0.0.0-semantic-release", diff --git a/packages/electron-updater/package.json b/packages/electron-updater/package.json index ff524c5893d..151631bb1f1 100644 --- a/packages/electron-updater/package.json +++ b/packages/electron-updater/package.json @@ -17,7 +17,7 @@ "fs-extra-p": "^4.5.0", "js-yaml": "^3.10.0", "semver": "^5.5.0", - "source-map-support": "^0.5.2", + "source-map-support": "^0.5.3", "builder-util-runtime": "~0.0.0-semantic-release", "electron-is-dev": "^0.3.0", "lodash.isequal": "^4.5.0" diff --git a/yarn.lock b/yarn.lock index f8f44673c8d..70521028c3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -423,9 +423,9 @@ asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" -aws-sdk@^2.186.0: - version "2.186.0" - resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.186.0.tgz#64eccea5bf0449810323c313d9cb41c2a4a2850d" +aws-sdk@^2.188.0: + version "2.188.0" + resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.188.0.tgz#9062abc7dba6393459fa2f3423cf5d294f004611" dependencies: buffer "4.9.1" events "^1.1.1" @@ -4438,12 +4438,18 @@ source-map-support@^0.4.15, source-map-support@^0.4.17: dependencies: source-map "^0.5.6" -source-map-support@^0.5.0, source-map-support@^0.5.2: +source-map-support@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.2.tgz#1a6297fd5b2e762b39688c7fc91233b60984f0a5" dependencies: source-map "^0.6.0" +source-map-support@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.3.tgz#2b3d5fff298cfa4d1afd7d4352d569e9a0158e76" + dependencies: + source-map "^0.6.0" + source-map@^0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"