[Qa-jenkins-scm] [jenkins.debian.net] 02/03: reproducible: refactor

Holger Levsen holger at moszumanska.debian.org
Thu Jun 11 17:48:38 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 53bf0e766988c9fa6e6f2d2db15bd2927667fab6
Author: Holger Levsen <holger at layer-acht.org>
Date:   Thu Jun 11 19:31:47 2015 +0200

    reproducible: refactor
---
 bin/reproducible_build.sh    | 16 ++++++++++------
 bin/reproducible_common.sh   |  3 ++-
 bin/reproducible_coreboot.sh |  1 -
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index 539d4ec..8aee48a 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -372,11 +372,8 @@ check_suitability() {
 	if ! $SUITABLE ; then handle_not_for_us $ARCHITECTURES ; fi
 }
 
-build_rebuild() {
-	FTBFS=1
+first_build(){
 	local TMPCFG=$(mktemp -t pbuilderrc_XXXX --tmpdir=$TMPDIR)
-	local NUM_CPU=$(cat /proc/cpuinfo |grep '^processor'|wc -l)
-	mkdir b1 b2
 	set -x
 	printf "BUILDUSERID=1111\nBUILDUSERNAME=pbuilder1\n" > $TMPCFG
 	( timeout -k 12h 12h nice ionice -c 3 sudo \
@@ -390,6 +387,13 @@ build_rebuild() {
 		${SRCPACKAGE}_*.dsc \
 	) 2>&1 | tee -a $RBUILDLOG
 	if ! "$DEBUG" ; then set +x ; fi
+	rm $TMPCFG
+}
+
+build_rebuild() {
+	FTBFS=1
+	mkdir b1 b2
+	first_build
 	if [ -f b1/${SRCPACKAGE}_${EVERSION}_${ARCH}.changes ] ; then
 		# the first build did not FTBFS, try rebuild it.
 		check_for_race_conditions
@@ -397,6 +401,7 @@ build_rebuild() {
 		echo "Re-building ${SRCPACKAGE}/${VERSION} in ${SUITE} on ${ARCH} now."
 		echo "============================================================================="
 		set -x
+		local TMPCFG=$(mktemp -t pbuilderrc_XXXX --tmpdir=$TMPDIR)
 		printf "BUILDUSERID=2222\nBUILDUSERNAME=pbuilder2\n" > $TMPCFG
 		( timeout -k 12h 12h nice ionice -c 3 sudo \
 		  DEB_BUILD_OPTIONS="parallel=$(echo $NUM_CPU-1|bc)" \
@@ -421,14 +426,13 @@ build_rebuild() {
 		else
 			echo "The second build failed, even though the first build was successful." | tee -a ${RBUILDLOG}
 		fi
+		rm $TMPCFG
 	fi
 	cleanup_userContent
 	update_rbuildlog
-	rm $TMPCFG
 	if [ $FTBFS -eq 1 ] ; then handle_ftbfs ; fi
 }
 
-
 #
 # below is what controls the world
 #
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index 84df5d8..b0db080 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -41,6 +41,8 @@ JENKINS_URL=${JENKINS_URL:0:-1}
 SUITES="testing unstable experimental"
 # arches being tested
 ARCHES="amd64"
+# number of cores to be used
+NUM_CPU=$(grep -c '^processor' /proc/cpuinfo)
 
 # existing usertags
 USERTAGS="toolchain infrastructure timestamps fileordering buildpath username hostname uname randomness buildinfo cpu signatures environment umask"
@@ -270,7 +272,6 @@ write_explaination_table() {
 	write_page "<tr><td>env LANG</td><td>LANG=\"en_GB.UTF-8\"</td><td>LANG=\"fr_CH.UTF-8\"</td></tr>"
 	write_page "<tr><td>env LC_ALL</td><td><em>unset</em></td><td>LC_ALL=\"fr_CH.UTF-8\"</td></tr>"
 	write_page "<tr><td>env PATH</td><td>PATH=\"/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:\"</td><td>PATH=\"/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path\"</td></tr>"
-	local NUM_CPU=$(cat /proc/cpuinfo |grep '^processor'|wc -l)
 	if [ "$1" = "debian" ] ; then
 		write_page "<tr><td>env BUILDUSERID</td><td>BUILDUSERID=\"1111\"</td><td>BUILDUSERID=\"2222\"</td></tr>"
 		write_page "<tr><td>env BUILDUSERNAME</td><td>BUILDUSERNAME=\"pbuilder1\"</td><td>BUILDUSERNAME=\"pbuilder2\"</td></tr>"
diff --git a/bin/reproducible_coreboot.sh b/bin/reproducible_coreboot.sh
index 2e8d0f4..c39771c 100755
--- a/bin/reproducible_coreboot.sh
+++ b/bin/reproducible_coreboot.sh
@@ -91,7 +91,6 @@ COREBOOT_VERSION=$(git describe)
 echo "This is coreboot $COREBOOT_VERSION."
 echo
 git log -1
-NUM_CPU=$(cat /proc/cpuinfo |grep '^processor'|wc -l)
 
 echo "============================================================================="
 echo "$(date -u) - Building cross compilers for ${ARCHS} now."

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list