Skip to content

Commit

Permalink
fix: use app-builder as xz-7za proxy
Browse files Browse the repository at this point in the history
Close #2523
  • Loading branch information
develar committed Jan 27, 2018
1 parent 85b65fd commit e35846a
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 39 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.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions packages/electron-builder-lib/src/options/linuxOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ export interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSp
*/
readonly depends?: Array<string> | null

/**
* The compression type.
* @default xz
*/
readonly compression?: "gz" | "bzip2" | "xz" | null

readonly icon?: string

/**
Expand All @@ -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"]`.
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/electron-builder-lib/src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

Expand Down
3 changes: 1 addition & 2 deletions packages/electron-builder-lib/src/targets/archive.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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),
Expand Down
10 changes: 6 additions & 4 deletions packages/electron-builder-lib/src/targets/fpm.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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",
Expand Down
25 changes: 12 additions & 13 deletions packages/electron-builder-lib/src/targets/tools.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"))
})

Expand Down Expand Up @@ -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==",
})
}
2 changes: 1 addition & 1 deletion packages/electron-publisher-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 10 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit e35846a

Please sign in to comment.