function failure() {
set -x
# early stage ? - let's not create /build/@PLDISTRO@
- if test -z "$WEBLOG" ; then
- WEBHOST=$(hostname)
+ if [ -z "$WEBLOG" ] ; then
+ WEBHOST=localhost
WEBPATH=/tmp
WEBBASE=/tmp/lbuild-early-$(date +%Y-%m-%d)
WEBLOG=/tmp/lbuild-early-$(date +%Y-%m-%d).log.txt
function success () {
set -x
# early stage ? - let's not create /build/@PLDISTRO@
- if test -z "$WEBLOG" ; then
- WEBHOST=$(hostname)
+ if [ -z "$WEBLOG" ] ; then
+ WEBHOST=localhost
WEBPATH=/tmp
WEBLOG=/tmp/lbuild-early-$(date +%Y-%m-%d).log.txt
fi
function build () {
set -x
set -e
- trap failure ERR INT
echo -n "============================== Starting $COMMAND:build on "
date
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 -
+ 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)
# Create lxc vm
cd $tmpdir
rm -rf $tmpdir
# Extract build again - in the vm
[ -n "$SSH_KEY" ] && setupssh ${BASE} ${SSH_KEY}
- # xxx not working as of now - waiting for Sapan to look into this
virsh -c lxc:/// lxc-enter-namespace $BASE /bin/bash -c "git clone $GIT_REPO /build; cd /build; git checkout $GIT_TAG"
fi
echo "XXXXXXXXXX $COMMAND: preparation of vm $BASE done" $(date)