From a74e6b53cd0763b6020230a93890e8e278ec421e Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Wed, 17 May 2017 17:10:00 -0400 Subject: [PATCH] chore: fix lzma-native not building for the x86 Linux CLI (#1448) There are various problems that contributed to this issue: - `node-pre-gyp` doesn't detect the 6.10.3 node version. We reverted to 6.1.0, which the module recognised, and which shares the same v8 ABI - Passing `--force` to `npm install` causes npm to swallow any errors and silently continue - The x86 Docker container has problems writing to `$HOME/.node-gyp`. The solution is to enable `unsafe-perm` given that the container is running as `root` Fixes: https://github.com/resin-io/etcher/issues/1444 Signed-off-by: Juan Cruz Viotti --- Makefile | 4 ++-- scripts/build/dependencies-npm.sh | 9 +-------- scripts/build/docker/Dockerfile-i686 | 4 ++++ scripts/build/docker/Dockerfile-x86_64 | 4 ++++ scripts/build/docker/Dockerfile.template | 4 ++++ 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 8bf7cb44..b3c85ad1 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ BUILD_OUTPUT_DIRECTORY = $(BUILD_DIRECTORY)/out # --------------------------------------------------------------------- ELECTRON_VERSION = $(shell jq -r '.devDependencies["electron"]' package.json) -NODE_VERSION = 6.10.3 +NODE_VERSION = 6.1.0 COMPANY_NAME = $(shell jq -r '.companyName' package.json) APPLICATION_NAME = $(shell jq -r '.displayName' package.json) APPLICATION_DESCRIPTION = $(shell jq -r '.description' package.json) @@ -191,7 +191,7 @@ $(BUILD_DIRECTORY)/electron-$(TARGET_PLATFORM)-$(TARGET_ARCH)-dependencies: pack $(BUILD_DIRECTORY)/node-$(TARGET_PLATFORM)-$(TARGET_ARCH)-dependencies: package.json npm-shrinkwrap.json \ | $(BUILD_DIRECTORY) mkdir $@ - ./scripts/build/dependencies-npm.sh -p -f \ + ./scripts/build/dependencies-npm.sh -p \ -r "$(TARGET_ARCH)" \ -v "$(NODE_VERSION)" \ -x $@ \ diff --git a/scripts/build/dependencies-npm.sh b/scripts/build/dependencies-npm.sh index 06ce4d5a..e28c5cee 100755 --- a/scripts/build/dependencies-npm.sh +++ b/scripts/build/dependencies-npm.sh @@ -32,7 +32,6 @@ function usage() { echo " -t " echo " -s " echo " -x " - echo " -f force install" echo " -p production install" exit 1 } @@ -42,17 +41,15 @@ ARGV_TARGET_VERSION="" ARGV_TARGET_PLATFORM="" ARGV_TARGET_OPERATING_SYSTEM="" ARGV_PREFIX="" -ARGV_FORCE=false ARGV_PRODUCTION=false -while getopts ":r:v:t:s:x:fp" option; do +while getopts ":r:v:t:s:x:p" option; do case $option in r) ARGV_ARCHITECTURE=$OPTARG ;; v) ARGV_TARGET_VERSION=$OPTARG ;; t) ARGV_TARGET_PLATFORM=$OPTARG ;; s) ARGV_TARGET_OPERATING_SYSTEM=$OPTARG ;; x) ARGV_PREFIX=$OPTARG ;; - f) ARGV_FORCE=true ;; p) ARGV_PRODUCTION=true ;; *) usage ;; esac @@ -87,10 +84,6 @@ export npm_config_arch=$ELECTRON_ARCHITECTURE INSTALL_OPTS="" -if [ "$ARGV_FORCE" == "true" ]; then - INSTALL_OPTS="$INSTALL_OPTS --force" -fi - if [ "$ARGV_PRODUCTION" == "true" ]; then INSTALL_OPTS="$INSTALL_OPTS --production" fi diff --git a/scripts/build/docker/Dockerfile-i686 b/scripts/build/docker/Dockerfile-i686 index 8735b8b1..3d98de96 100644 --- a/scripts/build/docker/Dockerfile-i686 +++ b/scripts/build/docker/Dockerfile-i686 @@ -33,6 +33,10 @@ RUN add-apt-repository ppa:ubuntu-toolchain-r/test \ # NodeJS RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \ && apt-get install -y nodejs + +# See https://github.com/mapbox/node-pre-gyp/issues/165 +RUN npm config set unsafe-perm=true + RUN npm config set spin=false RUN npm install -g uglify-es@3.0.3 electron-installer-debian@0.5.1 diff --git a/scripts/build/docker/Dockerfile-x86_64 b/scripts/build/docker/Dockerfile-x86_64 index c6b7ae6d..df35bc3c 100644 --- a/scripts/build/docker/Dockerfile-x86_64 +++ b/scripts/build/docker/Dockerfile-x86_64 @@ -33,6 +33,10 @@ RUN add-apt-repository ppa:ubuntu-toolchain-r/test \ # NodeJS RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \ && apt-get install -y nodejs + +# See https://github.com/mapbox/node-pre-gyp/issues/165 +RUN npm config set unsafe-perm=true + RUN npm config set spin=false RUN npm install -g uglify-es@3.0.3 electron-installer-debian@0.5.1 diff --git a/scripts/build/docker/Dockerfile.template b/scripts/build/docker/Dockerfile.template index 8460cd1f..aa3b9598 100644 --- a/scripts/build/docker/Dockerfile.template +++ b/scripts/build/docker/Dockerfile.template @@ -33,6 +33,10 @@ RUN add-apt-repository ppa:ubuntu-toolchain-r/test \ # NodeJS RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \ && apt-get install -y nodejs + +# See https://github.com/mapbox/node-pre-gyp/issues/165 +RUN npm config set unsafe-perm=true + RUN npm config set spin=false RUN npm install -g uglify-es@3.0.3 electron-installer-debian@0.5.1