Module: check_mk
Branch: master
Commit: 204a4094f165055b29c982fcf0d5363e4f84854a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=204a4094f16505…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 4 18:45:04 2017 +0200
windows agent chroot can now be acessed in parallel
When CHROOT_BUILD_DIR is set to a custom directory name when
calling the make-agent script, this will be used as mount point
to mount the current Check_MK base path into.
This makes it possible to use a single chroot for multiple
build jobs in parallel. This is needed for our build system.
Change-Id: Ibfe6a82041d8dede30d375347f81ad49aa19ad87
---
agents/windows/do-chroot | 14 +++++++++++---
agents/windows/make-agent | 4 +++-
agents/windows/make-chroot | 1 -
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/agents/windows/do-chroot b/agents/windows/do-chroot
index eaef0cb..560e020 100755
--- a/agents/windows/do-chroot
+++ b/agents/windows/do-chroot
@@ -15,6 +15,10 @@ if [ -z $CHROOT_PATH ]; then
exit 1
fi
+if [ -z $CHROOT_BUILD_DIR ]; then
+ echo "ERROR: CHROOT_BUILD_DIR not set"
+ exit 1
+fi
if [ ! -e $CHROOT_PATH/proc/self ] ; then
mount -t proc proc $CHROOT_PATH/proc
@@ -28,8 +32,12 @@ if [ ! -e $CHROOT_PATH/dev/pts/ptmx ] ; then
mount -t devpts devpts $CHROOT_PATH/dev/pts 2>/dev/null || true
fi
-if [ ! -e $CHROOT_PATH/build/Makefile ] ; then
- mount -o bind $BASE $CHROOT_PATH/build
+if [ ! -e $CHROOT_PATH/$CHROOT_BUILD_DIR ]; then
+ mkdir $CHROOT_PATH/$CHROOT_BUILD_DIR
+fi
+
+if [ ! -e $CHROOT_PATH/$CHROOT_BUILD_DIR/Makefile ] ; then
+ mount -o bind $BASE $CHROOT_PATH/$CHROOT_BUILD_DIR
fi
if [ -n "$CMD" ] ; then
@@ -38,7 +46,7 @@ else
chroot $CHROOT_PATH /usr/bin/env CHROOTNAME=$CHROOTNAME bash -l
fi
-umount $CHROOT_PATH/build
+umount $CHROOT_PATH/$CHROOT_BUILD_DIR
umount $CHROOT_PATH/dev/pts
sleep 2
umount $CHROOT_PATH/dev
diff --git a/agents/windows/make-agent b/agents/windows/make-agent
index 2bf473e..124a6ad 100755
--- a/agents/windows/make-agent
+++ b/agents/windows/make-agent
@@ -21,6 +21,7 @@ base="$(dirname "$(dirname "$(cd "$(dirname
"${BASH_SOURCE[0]}")" && pwd)")")"
# May be set from external environment. Otherwise use chroot
# directory in agents/windows
export CHROOT_PATH=${CHROOT_PATH:-$base/agents/windows/chroot}
+export CHROOT_BUILD_DIR=${CHROOT_BUILD_DIR:-build}
setup() {
sudo apt-get install "${chroot_dependencies[@]}"
@@ -79,7 +80,8 @@ fi
ensure_chroot
# Pass remaining targets to make inside chroot.
-sudo CHROOT_PATH=$CHROOT_PATH ./do-chroot "cd build/agents/windows; make
$targets"
+sudo CHROOT_PATH=$CHROOT_PATH CHROOT_BUILD_DIR=$CHROOT_BUILD_DIR \
+ ./do-chroot "cd $CHROOT_BUILD_DIR/agents/windows; make $targets"
# Some cleanup: chown build artifacts to the original user.
find . -maxdepth 1 -regextype egrep \
diff --git a/agents/windows/make-chroot b/agents/windows/make-chroot
index 25e3beb..d7bf81f 100755
--- a/agents/windows/make-chroot
+++ b/agents/windows/make-chroot
@@ -143,7 +143,6 @@ if [ ! -h $CHROOT_PATH/usr/bin/python ] ; then
cd -
fi
-mkdir $CHROOT_PATH/build
cp "$BASE/agents/windows/$VERSIONFILE" "$CHROOT_PATH/"
echo "+ CLEANING UP"