1
0
mirror of https://github.com/rancher/os.git synced 2025-09-17 07:30:42 +00:00

speed up the full build by swapping lzma with gzip if run with --dev flag

This commit is contained in:
Ivan Mikushin
2015-09-19 20:43:00 +05:00
parent 25fa1b769d
commit 39e2e6c3b3
7 changed files with 27 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
include build.conf include build.conf
FORCE_PULL := 0 FORCE_PULL := 0
DEV_BUILD := 0
compile: bin/rancheros compile: bin/rancheros
@@ -24,7 +25,7 @@ bin/rancheros: ros-build-image
build-all: ros-build-image build-all: ros-build-image
./scripts/docker-run.sh make -f Makefile.docker FORCE_PULL=$(FORCE_PULL) $@ ./scripts/docker-run.sh make -f Makefile.docker DEV_BUILD=$(DEV_BUILD) FORCE_PULL=$(FORCE_PULL) $@
mkdir -p bin dist mkdir -p bin dist
docker cp ros-build:/go/src/github.com/rancherio/os/bin/rancheros bin/ docker cp ros-build:/go/src/github.com/rancherio/os/bin/rancheros bin/
@@ -32,7 +33,7 @@ build-all: ros-build-image
installer: ros-build-image installer: ros-build-image
./scripts/docker-run.sh --rm make -f Makefile.docker FORCE_PULL=$(FORCE_PULL) $@ ./scripts/docker-run.sh --rm make -f Makefile.docker DEV_BUILD=$(DEV_BUILD) FORCE_PULL=$(FORCE_PULL) $@
version: version:

View File

@@ -1,5 +1,6 @@
include build.conf include build.conf
FORCE_PULL := 0 FORCE_PULL := 0
DEV_BUILD := 0
bin/rancheros: bin/rancheros:
@@ -33,7 +34,7 @@ $(BUILD)/images.tar: bin/rancheros
$(DIST)/artifacts/initrd: bin/rancheros assets/docker $(BUILD)/kernel/ $(BUILD)/images.tar $(DIST)/artifacts/initrd: bin/rancheros assets/docker $(BUILD)/kernel/ $(BUILD)/images.tar
mkdir -p $(dir $@) mkdir -p $(dir $@)
DFS_IMAGE=$(DFS_IMAGE) ./scripts/mk-initrd.sh DFS_IMAGE=$(DFS_IMAGE) DEV_BUILD=$(DEV_BUILD) ./scripts/mk-initrd.sh
$(DIST)/artifacts/rancheros.iso: minimal $(DIST)/artifacts/rancheros.iso: minimal

View File

@@ -1,6 +1,17 @@
#!/bin/bash #!/bin/bash
set -e set -e
make all if [ "$1" != "--dev" ]; then
echo
echo Running \"production\" build. Will use lzma to compress initrd, which is somewhat slow...
echo Ctrl+C if you don\'t want this.
echo
echo For \"developer\" builds, run ./build.sh --dev
echo
make all
else
make DEV_BUILD=1 all
fi
ls -lh dist/artifacts ls -lh dist/artifacts

View File

@@ -9,4 +9,4 @@ fi
docker build -t ros-build-base -f Dockerfile.build-base . docker build -t ros-build-base -f Dockerfile.build-base .
docker build -t ros-build -f Dockerfile.build . docker build -t ros-build -f Dockerfile.build .
./scripts/docker-run.sh --name ros-ci make -f Makefile.docker minimal integration-tests ./scripts/docker-run.sh --name ros-ci make -f Makefile.docker DEV_BUILD=1 minimal integration-tests

View File

@@ -27,4 +27,10 @@ docker export ${DFS} | tar xvf - -C ${INITRD_DIR} --exclude=usr/bin/dockerlaunc
--exclude=usr/libexec/git-core \ --exclude=usr/libexec/git-core \
usr usr
cd ${INITRD_DIR} && find | cpio -H newc -o | lzma -c > ${DIST}/artifacts/initrd if [ "$DEV_BUILD" == "1" ]; then
COMPRESS=gzip
else
COMPRESS=lzma
fi
cd ${INITRD_DIR} && find | cpio -H newc -o | ${COMPRESS} > ${DIST}/artifacts/initrd

View File

@@ -84,7 +84,7 @@ if [ "$REBUILD" == "1" ]; then
if [ ! -d ${INITRD_TMP} ]; then if [ ! -d ${INITRD_TMP} ]; then
mkdir -p ${INITRD_TMP} mkdir -p ${INITRD_TMP}
pushd ${INITRD_TMP} pushd ${INITRD_TMP}
xz -dc ${INITRD} | cpio -idmv xz -dfc ${INITRD} | gunzip -f | cpio -idm
popd popd
fi fi

View File

@@ -5,6 +5,6 @@ cd $(dirname $0)/../../../..
cp ./tests/integration/assets/test_02/build.conf ./ cp ./tests/integration/assets/test_02/build.conf ./
make -f Makefile.docker minimal make -f Makefile.docker DEV_BUILD=1 minimal
exec ./scripts/run --qemu --no-rebuild --fresh exec ./scripts/run --qemu --no-rebuild --fresh