Skip to content

Commit 7a5252c

Browse files
committed
fix: update fpm to 1.6.3
1 parent 6735da5 commit 7a5252c

File tree

6 files changed

+29
-88
lines changed

6 files changed

+29
-88
lines changed

docker/4/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM electronuserland/electron-builder:base
22

3-
ENV NODE_VERSION 4.5.0
3+
ENV NODE_VERSION 4.6.0
44

55
# https://github.com/npm/npm/issues/4531
66
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \

docker/6/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM electronuserland/electron-builder:base
22

3-
ENV NODE_VERSION 6.6.0
3+
ENV NODE_VERSION 6.7.0
44

55
# https://github.com/npm/npm/issues/4531
66
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \

docker/base/Dockerfile

Lines changed: 4 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ ENV XZ_VERSION 5.2.2
1212
# we don't use our bundled 7za because it is better to build for specific platform - not generic
1313
ENV USE_SYSTEM_7ZA true
1414

15-
# we don't use our bundled fpm because it is better to build ruby & tools for specific platform - not generic. And easy to maintain (update ruby and so on).
16-
ENV USE_SYSTEM_FPM true
17-
1815
ENV DEBUG_COLORS true
1916
ENV FORCE_COLOR true
2017

@@ -23,7 +20,9 @@ RUN apt-get update -y && \
2320
apt-get clean && \
2421
rm -rf /var/lib/apt/lists/* && \
2522
curl -L http://tukaani.org/xz/xz-$XZ_VERSION.tar.xz | tar -xJ && cd xz-$XZ_VERSION && ./configure && make && make install && cd .. && rm -rf xz-$XZ_VERSION && ldconfig && \
26-
mkdir -p /tmp/7z && curl -L http://downloads.sourceforge.net/project/p7zip/p7zip/15.14.1/p7zip_15.14.1_src_all.tar.bz2 | tar -xj -C /tmp/7z --strip-components 1 && cd /tmp/7z && cp makefile.linux_amd64_asm makefile.machine && make && make install && rm -rf /tmp/7z
23+
mkdir -p /tmp/7z && curl -L http://downloads.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2 | tar -xj -C /tmp/7z --strip-components 1 && cd /tmp/7z && cp makefile.linux_amd64_asm makefile.machine && make && make install && rm -rf /tmp/7z
24+
25+
COPY test.sh /test.sh
2726

2827
# nodejs keys
2928
RUN set -ex \
@@ -40,8 +39,6 @@ RUN set -ex \
4039
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
4140
done
4241

43-
COPY test.sh /test.sh
44-
4542
WORKDIR /project
4643

4744
# fix error /usr/local/bundle/gems/fpm-1.5.0/lib/fpm/package/freebsd.rb:72:in `encode': "\xE2" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
@@ -50,59 +47,4 @@ WORKDIR /project
5047
RUN locale-gen en_US.UTF-8
5148
ENV LANG en_US.UTF-8
5249
ENV LANGUAGE en_US:en
53-
ENV LC_ALL en_US.UTF-8
54-
55-
# Ruby
56-
# copied from https://github.com/docker-library/ruby/blob/0b94677b368947b64dcdcb312cd81ba946df3676/2.3/Dockerfile
57-
58-
# skip installing gem documentation
59-
RUN mkdir -p /usr/local/etc \
60-
&& { \
61-
echo 'install: --no-document'; \
62-
echo 'update: --no-document'; \
63-
} >> /usr/local/etc/gemrc
64-
65-
ENV RUBY_MAJOR 2.3
66-
ENV RUBY_VERSION 2.3.1
67-
ENV RUBY_DOWNLOAD_SHA256 b87c738cb2032bf4920fef8e3864dc5cf8eae9d89d8d523ce0236945c5797dcd
68-
ENV RUBYGEMS_VERSION 2.6.4
69-
ENV BUNDLER_VERSION 1.12.4
70-
71-
# some of ruby's build scripts are written in ruby
72-
# we purge this later to make sure our final image uses what we just built
73-
RUN set -ex \
74-
&& buildDeps=' \
75-
bison \
76-
libgdbm-dev \
77-
ruby \
78-
' \
79-
&& apt-get update \
80-
&& apt-get install -y --no-install-recommends $buildDeps \
81-
&& rm -rf /var/lib/apt/lists/* \
82-
&& curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \
83-
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum -c - \
84-
&& mkdir -p /usr/src/ruby \
85-
&& tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \
86-
&& rm ruby.tar.gz \
87-
&& cd /usr/src/ruby \
88-
&& { echo '#define ENABLE_PATH_CHECK 0'; echo; cat file.c; } > file.c.new && mv file.c.new file.c \
89-
&& autoconf \
90-
&& ./configure --disable-install-doc \
91-
&& make -j"$(nproc)" \
92-
&& make install \
93-
&& apt-get purge -y --auto-remove $buildDeps \
94-
&& gem update --system $RUBYGEMS_VERSION \
95-
&& rm -r /usr/src/ruby \
96-
&& cd / && gem install bundler --version "$BUNDLER_VERSION"
97-
98-
# install things globally, for great justice
99-
# and don't create ".bundle" in all our apps
100-
ENV GEM_HOME /usr/local/bundle
101-
ENV BUNDLE_PATH="$GEM_HOME" \
102-
BUNDLE_BIN="$GEM_HOME/bin" \
103-
BUNDLE_SILENCE_ROOT_WARNING=1 \
104-
BUNDLE_APP_CONFIG="$GEM_HOME"
105-
ENV PATH $BUNDLE_BIN:$PATH
106-
RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
107-
&& chmod 777 "$GEM_HOME" "$BUNDLE_BIN" \
108-
&& mkdir -p /tmp/fpm && curl -L https://github.com/jordansissel/fpm/archive/103602c83215c0f7d18e32316268a3db38de5cc0.tar.gz | tar -xz -C /tmp/fpm --strip-components 1 && cd /tmp/fpm && bundle install && make install && cd .. && rm -rf /tmp/fpm
50+
ENV LC_ALL en_US.UTF-8

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"lint": "tslint 'src/**/*.ts' 'test/src/**/*.ts' 'nsis-auto-updater/src/**/*.ts'",
2626
"pretest": "npm run compile && npm run lint && npm run pack-updater",
2727
"test": "node ./test/out/helpers/runTests.js",
28+
"test-linux": "docker run --rm -ti -v ${PWD}:/project -v ${PWD##*/}-node-modules:/project/node_modules -v ~/.electron:/root/.electron electronuserland/electron-builder:wine /test.sh",
2829
"pack-updater": "cd nsis-auto-updater && npm install --production --no-bin-links && npm prune --production && rm -rf nm && cp -a node_modules nm && cd ..",
2930
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
3031
"//": "Update wiki if docs changed. Update only if functionalily are generally available (latest release, not next)",
@@ -88,9 +89,9 @@
8889
"progress": "^1.1.8",
8990
"progress-stream": "^1.2.0",
9091
"read-installed": "^4.0.3",
91-
"sanitize-filename": "^1.6.0",
92+
"sanitize-filename": "^1.6.1",
9293
"semver": "^5.3.0",
93-
"source-map-support": "^0.4.2",
94+
"source-map-support": "^0.4.3",
9495
"tunnel-agent": "^0.4.3",
9596
"update-notifier": "^1.0.2",
9697
"uuid-1345": "^0.99.6",
@@ -116,8 +117,8 @@
116117
"@types/source-map-support": "^0.2.28",
117118
"ava-tf": "^0.16.0",
118119
"babel-plugin-array-includes": "^2.0.3",
119-
"babel-plugin-transform-es2015-destructuring": "^6.9.0",
120-
"babel-plugin-transform-es2015-parameters": "^6.11.4",
120+
"babel-plugin-transform-es2015-destructuring": "^6.16.0",
121+
"babel-plugin-transform-es2015-parameters": "^6.16.0",
121122
"babel-plugin-transform-es2015-spread": "^6.8.0",
122123
"decompress-zip": "^0.3.0",
123124
"diff": "^3.0.0",

src/targets/fpm.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { LinuxBuildOptions, Arch } from "../metadata"
22
import { smarten, PlatformPackager, TargetEx } from "../platformPackager"
33
import { use, exec } from "../util/util"
44
import * as path from "path"
5-
import { downloadFpm } from "../util/binDownload"
5+
import { getBin } from "../util/binDownload"
66
import { readFile, outputFile } from "fs-extra-p"
77
import { Promise as BluebirdPromise } from "bluebird"
88
import { LinuxTargetHelper, installPrefix } from "./LinuxTargetHelper"
@@ -15,8 +15,18 @@ const template = require("lodash.template")
1515
const __awaiter = require("../util/awaiter")
1616

1717
const fpmPath = (process.platform === "win32" || process.env.USE_SYSTEM_FPM === "true") ?
18-
BluebirdPromise.resolve("fpm") :
19-
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"}`)
18+
BluebirdPromise.resolve("fpm") : downloadFpm()
19+
20+
// can be called in parallel, all calls for the same version will get the same promise - will be downloaded only once
21+
function downloadFpm(): Promise<string> {
22+
const version = process.platform === "darwin" ? "fpm-1.6.3-20150715-2.2.2" : "fpm-1.6.3-2.3.1"
23+
const osAndArch = process.platform === "darwin" ? "mac" : `linux-x86${process.arch === "ia32" ? "" : "_64"}`
24+
const sha2 = process.platform === "darwin" ? "1b13080ecfd2b6fddb984ed6e1dfcb38cdf5b051a04d609c2a95227ed9a5ecbc" :
25+
(process.arch === "ia32" ? "b55f25749a27097140171f073466c52e59f733a275fea99e2334c540627ffc62" : "4c6fc529e996f7ff850da2d0bb6c85080e43be672494b14c0c6bdcc03bf57328")
26+
27+
return getBin("fpm", version, `https://dl.bintray.com/electron-userland/bin/${version}-${osAndArch}.7z`, sha2)
28+
.then(it => path.join(it, "fpm"))
29+
}
2030

2131
export default class FpmTarget extends TargetEx {
2232
private readonly options = Object.assign({}, this.packager.platformSpecificBuildOptions, (<any>this.packager.devMetadata.build)[this.name])

src/util/binDownload.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { statOrNull, spawn, debug, debug7zArgs, getTempName } from "./util"
2-
import { rename, remove, unlink, emptyDir } from "fs-extra-p"
2+
import { rename, unlink, emptyDir } from "fs-extra-p"
33
import { download } from "./httpRequest"
44
import { path7za } from "7zip-bin"
55
import * as path from "path"
@@ -11,18 +11,12 @@ const __awaiter = require("./awaiter")
1111

1212
const versionToPromise = new Map<string, BluebirdPromise<string>>()
1313

14-
// can be called in parallel, all calls for the same version will get the same promise - will be downloaded only once
15-
export function downloadFpm(version: string, osAndArch: string): Promise<string> {
16-
return getBin("fpm", `fpm-${version}-${osAndArch}`, `https://github.com/develar/fpm-self-contained/releases/download/v${version}/${`fpm-${version}-${osAndArch}`}.7z`)
17-
.then(it => path.join(it, "fpm"))
18-
}
19-
20-
export function getBinFromBintray(name: string, version: string, sha2?: string): Promise<string> {
14+
export function getBinFromBintray(name: string, version: string, sha2: string): Promise<string> {
2115
const dirName = `${name}-${version}`
2216
return getBin(name, dirName, `https://dl.bintray.com/electron-userland/bin/${dirName}.7z`, sha2)
2317
}
2418

25-
export function getBin(name: string, dirName: string, url: string, sha2?: string): Promise<string> {
19+
export function getBin(name: string, dirName: string, url: string, sha2: string): Promise<string> {
2620
let promise = versionToPromise.get(dirName)
2721
// if rejected, we will try to download again
2822
if (promise != null && !promise.isRejected()) {
@@ -38,7 +32,7 @@ export function getBin(name: string, dirName: string, url: string, sha2?: string
3832
// * don't need to find node_modules
3933
// * don't pollute user project dir (important in case of 1-package.json project structure)
4034
// * simplify/speed-up tests (don't download fpm for each test project)
41-
async function doGetBin(name: string, dirName: string, url: string, sha2?: string): Promise<string> {
35+
async function doGetBin(name: string, dirName: string, url: string, sha2: string): Promise<string> {
4236
const cachePath = path.join(homedir(), ".cache", name)
4337
const dirPath = path.join(cachePath, dirName)
4438

@@ -63,20 +57,14 @@ async function doGetBin(name: string, dirName: string, url: string, sha2?: strin
6357
cwd: cachePath,
6458
})
6559

66-
const isOldMethod = sha2 == null
67-
6860
await BluebirdPromise.all([
69-
rename(isOldMethod ? path.join(tempUnpackDir, dirName) : tempUnpackDir, dirPath)
61+
rename(tempUnpackDir, dirPath)
7062
.catch(e => {
7163
console.warn(`Cannot move downloaded ${name} into final location (another process downloaded faster?): ${e}`)
7264
}),
7365
unlink(archiveName),
7466
])
7567

76-
if (isOldMethod) {
77-
await remove(tempUnpackDir)
78-
}
79-
8068
debug(`${name}} downloaded to ${dirPath}`)
8169
return dirPath
8270
}

0 commit comments

Comments
 (0)