Commits

M0E-lnx  committed 9f95826

isolate jailedbuild process. Log last change to executed SlackBuild

  • Participants
  • Parent commits ba627a8

Comments (0)

Files changed (3)

File slave/usr/local/bin/build-runner

 export GIT_REVISION=$(git show | sed -n 1p | cut -f 2 -d ' '|cut -c -12)
 export GIT_URL=$(git remote show origin | grep Fetch | xargs | cut -f 3 -d ' '|sed 's/.git//g')
 export CHANGESETS="$GIT_URL/changeset"
-echo "Got revision $GIT_REVISION pushed by $GIT_AUTHOR"
+_sbpath="var/vabs/$APPNAME/src/$APPNAME.SlackBuild"
+SB_CHANGE_USER=$(git log -- $_sbpath | sed -n 2p | cut -f 2- -d ' ')
+SB_CHANGE_HASH=$(git log -- $_sbpath | sed -n 1p | cut -f 2 -d ' ' | cut -c -12)
+SB_CHANGE_TIMESTAMP=$(git log -- $_sbpath | sed -n 3p | cut -f 2- -d ' ' |xargs)
+_line="---------------------------------------------------------------------------------------"
+echo "$_line"
+echo "Latest git revision $GIT_REVISION pushed by $GIT_AUTHOR"
 echo ""
-echo "$CHANGESETS/$GIT_REVISION"
+echo "Last change to $APPNAME.SlackBuild:"
+echo "Author    : $SB_CHANGE_USER"
+echo "Date      : $SB_CHANGE_TIMESTAMP"
+echo "Changeset : $GIT_URL/changeset/$SB_CHANGE_HASH"
+echo "$_line"
 echo ""
 cp -ar /home/slackbuilds/var/vabs/$APPNAME /tmp/builds/ || exit 1
 # RESOLVE DEPS BEFORE BUILDING THIS PACKAGE
+dbus-uuidgen --ensure || exit 1
 /usr/local/bin/vldepper "/tmp/builds/$APPNAME/src/$APPNAME.SlackBuild" || exit 1
 cd /tmp/builds/$APPNAME/src || exit 1
-dbus-uuidgen --ensure || exit 1
 sh $APPNAME.SlackBuild || exit 1

File slave/usr/local/bin/jailedbuild

 #!/bin/bash
-
-#    This file is part of vlbuildbot.
-#
-#    vlbuildbot is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v3 as published by
-#    the Free Software Foundation.
-#
-#    vlbuildbot is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    See http://www.gnu.org/licenses/ for complete licensing terms.
-
-# NOTES: ======================================================================
-# 
-# * ro-chroot3 must be modified to accept an argument
-# * Update CHROOTDIR, CHROOT32, and CHROOT64 paths to valid paths on each slave
-# ==============================================================================
-
-# Source the global settings in /tmp/buildbot/vectorlinux/slave.conf
-#source /tmp/buildbot/vectorlinux/slave.conf
-source /etc/vlbuildslave/slavehost.conf || exit 1
-
-export BUILDER=${BUILDER:-"$1"}
-#export JAIL=${JAIL:-"$2"}
-_ARCH=$(get_arch_for_builder $BUILDER) # This should return something like "32" or "64"
-_VLREL=$(branch_to_vlrelease $2) # This should return something like "7p0" or "7p1"
-export JAIL=${JAIL:-"${_ARCH}c${_VLREL}"} # This should end up being something like "32c7p0"
-export USE_CHROOT=${CHROOTS[$JAIL]}
-
-APPNAME="" # We need this because the buildername may be different than the app name
-USE_ARCH=""
-RETVAL=""
-CWD=$(pwd)
-
-# mount the git source on the chroot-RO
-
-
-# END OF MOUNT
-
-if [ -z $BUILDER ]; then
-	echo "No builder indicated."
-	exit 1
-fi
-
-if [[ "$BUILDER" == *~x86_64 ]]; then
-	export APPNAME=$(echo $BUILDER | cut -f 1 -d "~")
-	USE_ARCH=$(uname -m)
-else
-	export APPNAME=$BUILDER
-	USE_ARCH="i586"
-fi
-echo "Building $APPNAME in jail $USE_CHROOT"
-
-# Move the existing CHROOT-RWSB directory out of the way
-# to make a clean new install.
-cd $USE_CHROOT || exit 1
-if [ -d CHROOT-RWSB.old ]; then
-	rm -rf CHROOT-RWSB.old || exit 1
-fi
-
-if [ -d CHROOT-RWSB ]; then
-	mv CHROOT-RWSB CHROOT-RWSB.old || exit 1
-fi
-# if we have a previuos build, delete it.
-if [ -d CHROOT-RWSB.$APPNAME ]; then
-	echo "Found a previous build of $APPNAME ... Removing it."
-	rm -rf CHROOT-RWSB.$APPNAME
-fi
-# remove any old builds
-rm -rf CHROOT-RWSB.$BUILDER
-# Create a new empty CHROOT-RWSB dir
-mkdir CHROOT-RWSB
-mkdir -p CHROOT-RWSB/tmp/builds
-
-
-export ARCH=$USE_ARCH
-# Copy the script that launches the build
-cat /usr/local/bin/build-runner > CHROOT-RWSB/tmp/$APPNAME.build || exit 1
-#cat /usr/local/bin/build-runner.new |sed 's/@BRANCH@/"veclinux-7.1"/g'
-#cat /usr/local/bin/build-runner|sed 's/@BRANCH@/\${2}/g' > CHROOT-RWSB/tmp/$APPNAME.build || exit 1
-chmod +x CHROOT-RWSB/tmp/$APPNAME.build
-
-# INSTALL THE SCRIPT TO SOLVE DEPS
-mkdir CHROOT-RWSB/usr/local/bin -p > /dev/null
-cat /usr/local/bin/vldepper > CHROOT-RWSB/usr/local/bin/vldepper || exit 1
-chmod +x CHROOT-RWSB/usr/local/bin/vldepper || exit 1
-
-export REPOBRANCH=$2
-export TARGETHASH=CHROOTSB-$$
-trap "/usr/local/bin/postbuild-cleanup $TARGETHASH" TERM INT HUP
-/sbin/ro-chrootSB "sh /tmp/$APPNAME.build" "$BUILDER" "$TARGETHASH"
-let RETVAL=$?
-# Move the CHROOT-RWSB dir to reflect the fact that it belongs to the $BUILDER
-# We cannot use the APPNAME here because appname is the same in 32 and 64b, 
-# so we need to builder name
-# read the retval from the build
-
-# Cleanup the source tree because this just gives us a bunch of junk
-# rm -rf $SRC_TREE/$APPNAME/*
-
-# Just in case anything is still mounted
-cd /
-
-# TARGT should b set by ro-chrootSB
-/usr/local/bin/postbuild-cleanup $TARGETHASH
-
-cd $USE_CHROOT
-
-mv CHROOT-RWSB CHROOT-RWSB.$BUILDER
-
-# If everything went fine, we upload
-if [ "$RETVAL" != 0 ]; then
-	# We will not be uploading.  So, delete the failed stuff
-	#rm -rf CHROOT-RWSB.$BUILDER
-	exit 1
-fi
-# Clean up the chroot dir
-#rm -rf CHROOT-RWSB.$BUILDER
-# Otherwise, we continue
-exit $RETVAL
-
+unshare -m /usr/local/bin/jailedbuild.real $@

File slave/usr/local/bin/jailedbuild.real

+#!/bin/bash
+
+#    This file is part of vlbuildbot.
+#
+#    vlbuildbot is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    vlbuildbot is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    See http://www.gnu.org/licenses/ for complete licensing terms.
+
+# NOTES: ======================================================================
+# 
+# * ro-chroot3 must be modified to accept an argument
+# * Update CHROOTDIR, CHROOT32, and CHROOT64 paths to valid paths on each slave
+# ==============================================================================
+
+# Source the global settings in /tmp/buildbot/vectorlinux/slave.conf
+#source /tmp/buildbot/vectorlinux/slave.conf
+source /etc/vlbuildslave/slavehost.conf || exit 1
+
+export BUILDER=${BUILDER:-"$1"}
+#export JAIL=${JAIL:-"$2"}
+_ARCH=$(get_arch_for_builder $BUILDER) # This should return something like "32" or "64"
+_VLREL=$(branch_to_vlrelease $2) # This should return something like "7p0" or "7p1"
+export JAIL=${JAIL:-"${_ARCH}c${_VLREL}"} # This should end up being something like "32c7p0"
+export USE_CHROOT=${CHROOTS[$JAIL]}
+
+APPNAME="" # We need this because the buildername may be different than the app name
+USE_ARCH=""
+RETVAL=""
+CWD=$(pwd)
+
+# mount the git source on the chroot-RO
+
+
+# END OF MOUNT
+
+if [ -z $BUILDER ]; then
+	echo "No builder indicated."
+	exit 1
+fi
+
+if [[ "$BUILDER" == *~x86_64 ]]; then
+	export APPNAME=$(echo $BUILDER | cut -f 1 -d "~")
+	USE_ARCH=$(uname -m)
+else
+	export APPNAME=$BUILDER
+	USE_ARCH="i586"
+fi
+echo "Building $APPNAME in jail $USE_CHROOT"
+
+# Move the existing CHROOT-RWSB directory out of the way
+# to make a clean new install.
+cd $USE_CHROOT || exit 1
+if [ -d CHROOT-RWSB.old ]; then
+	rm -rf CHROOT-RWSB.old || exit 1
+fi
+
+if [ -d CHROOT-RWSB ]; then
+	mv CHROOT-RWSB CHROOT-RWSB.old || exit 1
+fi
+# if we have a previuos build, delete it.
+if [ -d CHROOT-RWSB.$APPNAME ]; then
+	echo "Found a previous build of $APPNAME ... Removing it."
+	rm -rf CHROOT-RWSB.$APPNAME
+fi
+# remove any old builds
+rm -rf CHROOT-RWSB.$BUILDER
+# Create a new empty CHROOT-RWSB dir
+mkdir CHROOT-RWSB
+mkdir -p CHROOT-RWSB/tmp/builds
+
+
+export ARCH=$USE_ARCH
+# Copy the script that launches the build
+cat /usr/local/bin/build-runner > CHROOT-RWSB/tmp/$APPNAME.build || exit 1
+#cat /usr/local/bin/build-runner.new |sed 's/@BRANCH@/"veclinux-7.1"/g'
+#cat /usr/local/bin/build-runner|sed 's/@BRANCH@/\${2}/g' > CHROOT-RWSB/tmp/$APPNAME.build || exit 1
+chmod +x CHROOT-RWSB/tmp/$APPNAME.build
+
+# INSTALL THE SCRIPT TO SOLVE DEPS
+mkdir CHROOT-RWSB/usr/local/bin -p > /dev/null
+cat /usr/local/bin/vldepper > CHROOT-RWSB/usr/local/bin/vldepper || exit 1
+chmod +x CHROOT-RWSB/usr/local/bin/vldepper || exit 1
+
+export REPOBRANCH=$2
+export TARGETHASH=CHROOTSB-$$
+trap "/usr/local/bin/postbuild-cleanup $TARGETHASH" TERM INT HUP
+/sbin/ro-chrootSB "sh /tmp/$APPNAME.build" "$BUILDER" "$TARGETHASH"
+let RETVAL=$?
+# Move the CHROOT-RWSB dir to reflect the fact that it belongs to the $BUILDER
+# We cannot use the APPNAME here because appname is the same in 32 and 64b, 
+# so we need to builder name
+# read the retval from the build
+
+# Cleanup the source tree because this just gives us a bunch of junk
+# rm -rf $SRC_TREE/$APPNAME/*
+
+# Just in case anything is still mounted
+cd /
+
+# TARGT should b set by ro-chrootSB
+/usr/local/bin/postbuild-cleanup $TARGETHASH
+
+cd $USE_CHROOT
+
+mv CHROOT-RWSB CHROOT-RWSB.$BUILDER
+
+# If everything went fine, we upload
+if [ "$RETVAL" != 0 ]; then
+	# We will not be uploading.  So, delete the failed stuff
+	#rm -rf CHROOT-RWSB.$BUILDER
+	exit 1
+fi
+# Clean up the chroot dir
+#rm -rf CHROOT-RWSB.$BUILDER
+# Otherwise, we continue
+exit $RETVAL
+