- if [ ! -d $(rootdir ${BASE}) ] ; then
- echo $COMMAND : cannot find vm $BASE
- exit 1
- fi
- # manage LOG - beware it might be a symlink so nuke it first
- LOG=$(logfile ${BASE})
- rm -f $LOG
- exec > $LOG 2>&1
- set -x
- echo "XXXXXXXXXX $COMMAND: using existing vm $BASE" $(date)
- # start in case e.g. we just rebooted
- virsh --connect lxc:/// start ${BASE} || :
- # retrieve environment from the previous run
- FCDISTRO=$($RUN_IN_DOMAIN ${BASE} /build/getdistroname.sh)
- BUILD_SCM_URL=$($RUN_IN_DOMAIN ${BASE} make --no-print-directory -C /build stage1=skip +build-GITPATH)
- # for efficiency, crop everything in one make run
- tmp=/tmp/${BASE}-env.sh
- $RUN_IN_DOMAIN ${BASE} make --no-print-directory -C /build stage1=skip \
- ++PLDISTRO ++PLDISTROTAGS ++PERSONALITY ++MAILTO ++WEBPATH ++TESTBUILDURL ++WEBROOT > $tmp
- . $tmp
- rm -f $tmp
- # update build
- [ -n "$SSH_KEY" ] && setupssh ${BASE} ${SSH_KEY}
- $RUN_IN_DOMAIN $BASE bash -c "cd /build; git pull; make tests-clean"
- # make sure we refresh the tests place in case it has changed
- rm -f /build/MODULES/tests
- options=(${options[@]} -d $PLDISTRO -t $PLDISTROTAGS -s $BUILD_SCM_URL)
- [ -n "$PERSONALITY" ] && options=(${options[@]} -p $PERSONALITY)
- [ -n "$MAILTO" ] && options=(${options[@]} -m $MAILTO)
- [ -n "$WEBPATH" ] && options=(${options[@]} -w $WEBPATH)
- [ -n "$TESTBUILDURL" ] && options=(${options[@]} -W $TESTBUILDURL)
- [ -n "$WEBROOT" ] && options=(${options[@]} -r $WEBROOT)
- show_env
- else
- # create vm: check it does not exist yet
- i=
- while [ -d $(rootdir ${BASE})${i} ] ; do
- # we name subsequent builds <base>-n<i> so the logs and builds get sorted properly
- [ -z ${i} ] && BASE=${BASE}-n
- i=$((${i}+1))
- if [ $i -gt 100 ] ; then
- echo "$COMMAND: Failed to create build vm $(rootdir ${BASE})${i}"
- exit 1
- fi
- done
- BASE=${BASE}${i}
- # need update
- # manage LOG - beware it might be a symlink so nuke it first
- LOG=$(logfile ${BASE})
- rm -f $LOG
- exec > $LOG 2>&1
- set -x
- echo "XXXXXXXXXX $COMMAND: creating vm $BASE" $(date)
- show_env
-
- ### extract the whole build - much simpler
- tmpdir=/tmp/$COMMAND-$$
- GIT_REPO=$(echo $BUILD_SCM_URL | cut -d@ -f1)
- GIT_TAG=$(echo $BUILD_SCM_URL | cut -s -d@ -f2)
- GIT_TAG=${GIT_TAG:-master}
- mkdir -p $tmpdir; git archive --remote=$GIT_REPO $GIT_TAG | tar -C $tmpdir -xf -
+ if [ ! -d $(rootdir ${BASE}) ] ; then
+ echo $COMMAND : cannot find vm $BASE
+ exit 1
+ fi
+ # manage LOG - beware it might be a symlink so nuke it first
+ LOG=$(logfile ${BASE})
+ rm -f $LOG
+ exec > $LOG 2>&1
+ set -x
+ echo "XXXXXXXXXX $COMMAND: using existing vm $BASE" $(date)
+ # start in case e.g. we just rebooted
+ virsh -c lxc:/// start ${BASE} || :
+ # retrieve environment from the previous run
+ FCDISTRO=$(run_in_build_guest $BASE /build/getdistroname.sh)
+ BUILD_SCM_URL=$(run_in_build_guest $BASE make --no-print-directory -C /build stage1=skip +build-GITPATH)
+ # for efficiency, crop everything in one make run
+ tmp=/tmp/${BASE}-env.sh
+ run_in_build_guest $BASE make --no-print-directory -C /build stage1=skip \
+ ++PLDISTRO ++PLDISTROTAGS ++PERSONALITY ++MAILDEST ++WEBPATH ++TESTBUILDURL ++WEBROOT > $tmp
+ . $tmp
+ rm -f $tmp
+ # update build
+ [ -n "$SSH_KEY" ] && setupssh ${BASE} ${SSH_KEY}
+ run_in_build_guest $BASE "(cd /build; git pull; make tests-clean)"
+ # make sure we refresh the tests place in case it has changed
+ rm -f /build/MODULES/tests
+ options=(${options[@]} -d $PLDISTRO -t $PLDISTROTAGS -s $BUILD_SCM_URL)
+ [ -n "$PERSONALITY" ] && options=(${options[@]} -p $PERSONALITY)
+ [ -n "$MAILDEST" ] && options=(${options[@]} -m $MAILDEST)
+ [ -n "$WEBPATH" ] && options=(${options[@]} -w $WEBPATH)
+ [ -n "$TESTBUILDURL" ] && options=(${options[@]} -W $TESTBUILDURL)
+ [ -n "$WEBROOT" ] && options=(${options[@]} -r $WEBROOT)
+ show_env
+ else
+ # create vm: check it does not exist yet
+ i=
+ while [ -d $(rootdir ${BASE})${i} ] ; do
+ # we name subsequent builds <base>-n<i> so the logs and builds get sorted properly
+ [ -z ${i} ] && BASE=${BASE}-n
+ i=$((${i}+1))
+ if [ $i -gt 100 ] ; then
+ echo "$COMMAND: Failed to create build vm $(rootdir ${BASE})${i}"
+ exit 1
+ fi
+ done
+ BASE=${BASE}${i}
+ # need update
+ # manage LOG - beware it might be a symlink so nuke it first
+ LOG=$(logfile ${BASE})
+ rm -f $LOG
+ exec > $LOG 2>&1
+ set -x
+ echo "XXXXXXXXXX $COMMAND: creating vm $BASE" $(date)
+ show_env
+
+ ### extract the whole build - much simpler
+ tmpdir=/tmp/$COMMAND-$$
+ GIT_REPO=$(echo $BUILD_SCM_URL | cut -d@ -f1)
+ GIT_TAG=$(echo $BUILD_SCM_URL | cut -s -d@ -f2)
+ GIT_TAG=${GIT_TAG:-master}
+ mkdir -p $tmpdir
+ ( git archive --remote=$GIT_REPO $GIT_TAG | tar -C $tmpdir -xf -) || \
+ ( echo "==================== git archive FAILED, trying git clone instead" ; \
+ git clone $GIT_REPO $tmpdir && cd $tmpdir && git checkout $GIT_TAG && rm -rf .git)