[Qa-jenkins-scm] [jenkins.debian.net] 02/02: reproducible rpms: use mock with --uniqeext to be able to run mock in parallel and add 2nd fedora-23 build job

Holger Levsen holger at moszumanska.debian.org
Thu Dec 17 18:01:02 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 96a486a48a58dc9312489858ed5292f4eda4b2a4
Author: Holger Levsen <holger at layer-acht.org>
Date:   Thu Dec 17 19:00:38 2015 +0100

    reproducible rpms: use mock with --uniqeext to be able to run mock in parallel and add 2nd fedora-23 build job
---
 TODO                           |  2 --
 bin/jenkins_node_wrapper.sh    |  2 +-
 bin/reproducible_build_rpm.sh  | 14 ++++++++------
 bin/reproducible_setup_mock.sh | 32 +++++++++++++++++---------------
 job-cfg/reproducible.yaml      |  6 ++++++
 5 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/TODO b/TODO
index b60cce7..7e0bf65 100644
--- a/TODO
+++ b/TODO
@@ -284,8 +284,6 @@ The plan is to run a jenkins.d.o host, which is maintained by DSA, but we are ma
 ==== reproducible Fedora
 
 * dont hardcode 23 in reproducible_setup_mock.sh and …build_rpm.sh
-* use mock in parallel with --uniqeext
-** task: needs to be passed via ssh too (and we want ssh to do remote builds like debian from one master node)
 * setup script:
 ** mock --clean just uninstalls the chroot but it'll still be rebuilt next time using cache.  you can delete the caches from /var/cache/mock/ or touch the mock config
 ** is /etc/yum/repos.d/fedora.repo really needed?
diff --git a/bin/jenkins_node_wrapper.sh b/bin/jenkins_node_wrapper.sh
index 1879587..ebf61ef 100755
--- a/bin/jenkins_node_wrapper.sh
+++ b/bin/jenkins_node_wrapper.sh
@@ -112,7 +112,7 @@ elif [[ "$*" =~ reproducible_setup_mock_fedora-23_x86_64 ]] ; then
 elif [ "$1" = "/srv/jenkins/bin/reproducible_build_archlinux_pkg.sh" ] && ( [ "$2" = "1" ] || [ "$2" = "2" ] ) ; then
 	exec /srv/jenkins/bin/reproducible_build_archlinux_pkg.sh "$2" "$3" "$4" "$5" ; croak "Exec failed";
 elif [ "$1" = "/srv/jenkins/bin/reproducible_build_rpm.sh" ] && ( [ "$2" = "1" ] || [ "$2" = "2" ] ) ; then
-	exec /srv/jenkins/bin/reproducible_build_rpm.sh "$2" "$3" "$4" "$5" "$6" ; croak "Exec failed";
+	exec /srv/jenkins/bin/reproducible_build_rpm.sh "$2" "$3" "$4" "$5" "$6" "$7" ; croak "Exec failed";
 elif [ "$*" = "some_jenkins_job_name" ] ; then
 	exec echo run any commands here ; croak "Exec failed";
 fi
diff --git a/bin/reproducible_build_rpm.sh b/bin/reproducible_build_rpm.sh
index 936c284..a13fe84 100755
--- a/bin/reproducible_build_rpm.sh
+++ b/bin/reproducible_build_rpm.sh
@@ -41,7 +41,7 @@ update_mock() {
 	touch -d "$(date -u -d "6 hours ago" '+%Y-%m-%d %H:%M') UTC" $DUMMY
 	if [ ! -f $STAMP ] || [ $DUMMY -nt $STAMP ] ; then
 		echo "$(date -u ) - updating mock for $RELEASE ($ARCH) on $HOSTNAME now..."
-		mock -r $RELEASE-$ARCH --resultdir=. --cleanup-after -v --update 2>&1
+		mock -r $RELEASE-$ARCH --uniqeext=$UNIQEEXT --resultdir=. --cleanup-after -v --update 2>&1
 		echo "$(date -u ) - mock updated."
 		yum -v --releasever=23 check-update # FIXME: dont hard-code releasever here.
 		echo "$(date -u ) - yum updated."
@@ -109,7 +109,7 @@ first_build() {
 	local LOG=$TMPDIR/b1/$SRCPACKAGE/build1.log
 	# nicely run mock with a timeout of $TIMEOUT hours
 	timeout -k $TIMEOUT.1h ${TIMEOUT}h /usr/bin/ionice -c 3 /usr/bin/nice \
-		mock -r $RELEASE-$ARCH --resultdir=$RESULTDIR --cleanup-after -v --rebuild $SRC_RPM 2>&1 | tee -a $LOG
+		mock -r $RELEASE-$ARCH --uniqeext=$UNIQEEXT --resultdir=$RESULTDIR --cleanup-after -v --rebuild $SRC_RPM 2>&1 | tee -a $LOG
 	PRESULT=${PIPESTATUS[0]}
 	if [ $PRESULT -eq 124 ] ; then
 		echo "$(date -u) - mock was killed by timeout after ${TIMEOUT}h." | tee -a $LOG
@@ -131,7 +131,7 @@ second_build() {
 	# NEW_NUM_CPU=$(echo $NUM_CPU-1|bc)
         # nicely run mock with a timeout of $TIMEOUT hours
         timeout -k $TIMEOUT.1h ${TIMEOUT}h /usr/bin/ionice -c 3 /usr/bin/nice \
-		mock -r $RELEASE-$ARCH --resultdir=$RESULTDIR --cleanup-after -v --rebuild $SRC_RPM 2>&1 | tee -a $LOG
+		mock -r $RELEASE-$ARCH --uniqeext=$UNIQEEXT --resultdir=$RESULTDIR --cleanup-after -v --rebuild $SRC_RPM 2>&1 | tee -a $LOG
 	PRESULT=${PIPESTATUS[0]}
 	if [ $PRESULT -eq 124 ] ; then
 		echo "$(date -u) - mock was killed by timeout after ${TIMEOUT}h." | tee -a $LOG
@@ -154,7 +154,7 @@ remote_build() {
 		sleep ${SLEEPTIME}m
 		exec /srv/jenkins/bin/abort.sh
 	fi
-	ssh -p $PORT $FQDN /srv/jenkins/bin/reproducible_build_rpm.sh $BUILDNR $RELEASE $ARCH ${SRCPACKAGE} ${TMPDIR}
+	ssh -p $PORT $FQDN /srv/jenkins/bin/reproducible_build_rpm.sh $BUILDNR $RELEASE $ARCH $UNIQEEXT ${SRCPACKAGE} ${TMPDIR}
 	RESULT=$?
 	if [ $RESULT -ne 0 ] ; then
 		ssh -p $PORT $FQDN "rm -r $TMPDIR" || true
@@ -197,8 +197,9 @@ if [ "$1" = "1" ] || [ "$1" = "2" ] ; then
 	MODE="$1"
 	RELEASE="$2"
 	ARCH="$3"
-	SRCPACKAGE="$4"
-	TMPDIR="$5"
+	UNIQEEXT="$4"
+	SRCPACKAGE="$5"
+	TMPDIR="$6"
 	[ -d $TMPDIR ] || mkdir -p $TMPDIR
 	cd $TMPDIR
 	mkdir -p b$MODE/$SRCPACKAGE
@@ -222,6 +223,7 @@ delay_start # randomize start times
 # first, we need to choose a package…
 RELEASE="$1"
 ARCH="$2"
+UNIQEEXT="mock_${JOB_NAME#reproducible_builder_${RELEASE}_$ARCH}}"
 SRCPACKAGE=""	# package name
 SRC_RPM=""	# src rpm file name
 # not used yet:
diff --git a/bin/reproducible_setup_mock.sh b/bin/reproducible_setup_mock.sh
index 240b693..c39e901 100755
--- a/bin/reproducible_setup_mock.sh
+++ b/bin/reproducible_setup_mock.sh
@@ -17,8 +17,6 @@ if [ -z "$1" ] || [ -z "$2" ] ; then
 fi
 RELEASE=$1
 ARCH=$2
-# not used yet:
-UNIQEEXT="mock_${JOB_NAME#reproducible_builder_${RELEASE}_$ARCH}}"
 
 echo "$(date -u) - showing setup."
 dpkg -l mock
@@ -30,17 +28,21 @@ yum -v --releasever=23 clean all
 echo "$(date -u) - initialising yum for $RELEASE"
 yum -v --releasever=23 check
 yum -v --releasever=23 repolist all
-echo "$(date -u) - starting to cleanly configure mock for $RELEASE on $ARCH."
-echo "$(date -u) - mock --clean"
-mock -r $RELEASE-$ARCH --resultdir=. -v --clean
-echo "$(date -u) - mock --scrub=all"
-mock -r $RELEASE-$ARCH --resultdir=. -v --scrub=all
-tree /var/cache/mock/
-echo "$(date -u) - mock --init"
-mock -r $RELEASE-$ARCH --resultdir=. -v --init
-echo "$(date -u) - mock configured for $RELEASE on $ARCH."
-echo "$(date -u) - mock --install rpm-build yum"
-mock -r $RELEASE-$ARCH --resultdir=. -v --install rpm-build yum
-echo "$(date -u) - mock --update"
-mock -r $RELEASE-$ARCH --resultdir=. -v --update
 
+for i in 1 2 ; do
+	UNIQEEXT="mock_$i"
+	echo "$(date -u) - starting to cleanly configure mock for $RELEASE on $ARCH using unique extension $UNIQEEXT."
+	echo "$(date -u) - mock --clean"
+	mock -r $RELEASE-$ARCH --uniqeext=$UNIQEEXT --resultdir=. -v --clean
+	echo "$(date -u) - mock --scrub=all"
+	mock -r $RELEASE-$ARCH --uniqeext=$UNIQEEXT --resultdir=. -v --scrub=all
+	echo "$(date -u) - mock --init"
+	mock -r $RELEASE-$ARCH --uniqeext=$UNIQEEXT --resultdir=. -v --init
+	echo "$(date -u) - mock --install rpm-build yum"
+	mock -r $RELEASE-$ARCH --uniqeext=$UNIQEEXT --resultdir=. -v --install rpm-build yum
+	echo "$(date -u) - mock --update"
+	mock -r $RELEASE-$ARCH --uniqeext=$UNIQEEXT --resultdir=. -v --update
+done
+
+# finally
+echo "$(date -u) - mock configured for $RELEASE on $ARCH."
diff --git a/job-cfg/reproducible.yaml b/job-cfg/reproducible.yaml
index 33a5e47..a4b7f59 100644
--- a/job-cfg/reproducible.yaml
+++ b/job-cfg/reproducible.yaml
@@ -541,6 +541,12 @@
                     my_num: 1
                     op_descname: 'a Fedora 23'
                     my_shell: '/srv/jenkins/bin/reproducible_build_rpm.sh fedora-23 x86_64'
+                - 'fedora-23_x86_64':
+                    my_num: 2
+                    op_descname: 'a Fedora 23'
+                    my_shell: '/srv/jenkins/bin/reproducible_build_rpm.sh fedora-23 x86_64'
+                # when you add another fedora builder here
+                # the loop in bin/reproducible_setup_mock.sh needs to be increased too
             my_description: 'Try to reproducibly build {op_descname} package.'
             my_shell: '/srv/jenkins/bin/reproducible_build_{otherproject}_pkg.sh'
             my_timed: '* * * * *'

-- 
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