Skip to content

Commit 618432c

Browse files
committedJan 14, 2017
Use buildDependencies package and prebuild images (and publish them)
1 parent ecbcc93 commit 618432c

File tree

5 files changed

+76
-7
lines changed

5 files changed

+76
-7
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ build/
22
out/
33
node_modules/
44
npm-debug.log
5+
prebuilds/

‎package.json

+33-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"name": "nodeos-usersfs",
33
"version": "1.0.0-RC3.0",
44
"scripts": {
5+
"BigRedButton": "scripts/BigRedButton",
56
"build": "scripts/build",
7+
"install": "prebuild-install -d https://github.com/NodeOS/nodeos-usersfs/releases/download/v{version}/{platform}-{arch}.tar.gz || (buildDependencies && npm run build)",
68
"test": "scripts/test",
79
"unbuild": "scripts/unbuild"
810
},
@@ -34,6 +36,33 @@
3436
"slap"
3537
],
3638
"dependencies": {
39+
"builddependencies": "0.0.1",
40+
"prebuild-install": "^2.1.0"
41+
},
42+
"buildDependencies": [
43+
"bin-man",
44+
"bin-pwd",
45+
"davius",
46+
"dhcpjs",
47+
"fs-extra",
48+
"ifconfig",
49+
"ip",
50+
"loadtest",
51+
"logon",
52+
"node-bin-getty",
53+
"node-wget",
54+
"nodeos-cross-toolchain",
55+
"nodeos-nodejs",
56+
"nodeos-reverse-proxy",
57+
"npm",
58+
"nsh",
59+
"ntp-client",
60+
"palmtree",
61+
"performance",
62+
"pstree",
63+
"slap"
64+
],
65+
"devDependencies": {
3766
"bin-man": "^0.2.0",
3867
"bin-pwd": "^0.0.0",
3968
"davius": "^0.0.1",
@@ -45,19 +74,18 @@
4574
"logon": "^0.1.3",
4675
"node-bin-getty": "NodeOS/node-bin-getty",
4776
"node-wget": "^0.4.2",
77+
"nodeos-cross-toolchain": "^1.0.0-RC3.0",
78+
"nodeos-nodejs": "^6.9.4",
4879
"nodeos-reverse-proxy": "^0.1.0",
4980
"npm": "^4.0.5",
5081
"nsh": "piranna/nsh",
5182
"ntp-client": "^0.5.3",
5283
"palmtree": "^2.5.0",
5384
"performance": "^1.1.1",
85+
"prebuild": "^6.0.0",
5486
"pstree": "^0.0.1",
55-
"slap": "^0.1.61"
56-
},
57-
"devDependencies": {
58-
"nodeos-cross-toolchain": "^1.0.0-RC3.0",
59-
"nodeos-nodejs": "^6.9.4",
6087
"qemu": "^2.8.0",
88+
"slap": "^0.1.61",
6189
"tar-fs": "^1.15.0"
6290
},
6391
"description": "Generate a read-write users filesystem for NodeOS for demo purposses",

‎scripts/BigRedButton

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# This script should generate all the possible build combinations of
4+
# `nodeos-usersfs` and test them by checking the final files has the correct
5+
# permissions
6+
7+
8+
BUILD="npm run build --no-spin"
9+
TEST="npm test"
10+
11+
12+
eval MACHINE=pc BITS=32 $BUILD && $TEST || exit 1
13+
eval MACHINE=pc BITS=64 $BUILD && $TEST || exit 2
14+
eval MACHINE=raspi2 $BUILD && $TEST || exit 3
15+
16+
17+
#
18+
# Upload release to GitHub
19+
#
20+
21+
if [ "$GITHUB_TOKEN" ]; then
22+
prebuild --upload-all $GITHUB_TOKEN || exit 10
23+
fi

‎scripts/build

+18-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ GRN="\e[32m"
44
CLR="\e[0m"
55

66

7-
TOOLCHAIN=`node -p "require('nodeos-cross-toolchain')"`
7+
TOOLCHAIN=`node -p "require('nodeos-cross-toolchain')"` || exit 1
88

99
source $TOOLCHAIN/scripts/adjustEnvVars.sh &&
1010
source scripts/utils.sh || exit $?
@@ -23,9 +23,12 @@ PATH=$TOOLCHAIN/bin:$PATH
2323
# Define steps paths
2424
#
2525

26+
NODE_PLATFORM=linux
27+
2628
OBJ_ROOT=$OBJECTS/root
2729
OBJ_NODEOS=$OBJECTS/nodeos
2830
OUT_DIR=`pwd`/out/$CPU.tar.gz
31+
PREBUILD=prebuilds/$NODE_PLATFORM-$NODE_ARCH.tar.gz
2932

3033

3134
#
@@ -151,6 +154,8 @@ fi
151154
STEP_DIR=$OUT_DIR
152155

153156
if [[ ! -f $STEP_DIR ]]; then
157+
rmStep $PREBUILD
158+
154159
mkdir -p `dirname $STEP_DIR`
155160

156161
scripts/pack.js "$OBJECTS" nodeos 1 1 | gzip > $STEP_DIR || err 30
@@ -165,3 +170,15 @@ ln -sf $CPU.tar.gz out/latest || err 40
165170

166171

167172
echo -e "${GRN}Successfully built Layer-3 image 'usersfs'${CLR}"
173+
174+
175+
#
176+
# Pack `nodeos-usersfs` in a node-gyp compatible way
177+
#
178+
179+
# TODO use Node.js arch instead of explicit CPUs and move to BigRedButton
180+
181+
STEP_DIR=$PREBUILD
182+
183+
mkdir -p `dirname $STEP_DIR` &&
184+
tar -cf - out/$CPU.tar.gz | gzip > $STEP_DIR || err 100

‎scripts/utils.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
NODE_DIR=`node -p "require('nodeos-nodejs')"`
1+
NODE_DIR=`node -p "require('nodeos-nodejs')"` || exit $?
22

33
NPMi='CC=$TARGET-gcc \
44
CXX=$TARGET-g++ \

0 commit comments

Comments
 (0)
Please sign in to comment.