[Qa-jenkins-scm] [jenkins.debian.net] 03/03: reproducible archlinux: refactor, only start schroot session if repositories need to be updated

Holger Levsen holger at moszumanska.debian.org
Fri Dec 11 13:44:12 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 caf339a8a53f630bd90f51ca734eaab0e19586ea
Author: Holger Levsen <holger at layer-acht.org>
Date:   Fri Dec 11 14:43:53 2015 +0100

    reproducible archlinux: refactor, only start schroot session if repositories need to be updated
---
 bin/reproducible_build_archlinux_pkg.sh | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/bin/reproducible_build_archlinux_pkg.sh b/bin/reproducible_build_archlinux_pkg.sh
index 64b5c3e..5bc2087 100755
--- a/bin/reproducible_build_archlinux_pkg.sh
+++ b/bin/reproducible_build_archlinux_pkg.sh
@@ -42,19 +42,29 @@ handle_remote_error() {
 update_archlinux_repositories() {
 	# every 2 days we check for new archlinux packages in all tested repositories
 	touch -d "$(date -d '2 days ago' '+%Y-%m-%d') 00:00 UTC" $DUMMY
-	local SESSION="archlinux-scheduler-$RANDOM"
-	schroot --begin-session --session-name=$SESSION -c jenkins-reproducible-archlinux
+	local NEED_UPDATE=false
 	local REPO
 	for REPO in $ARCHLINUX_REPOS ; do
 		if [ ! -f ${ARCHLINUX_PKGS}_$REPO ] || [ $DUMMY -nt ${ARCHLINUX_PKGS}_$REPO ] ; then
-			echo "$(date -u ) - updating list of available packages in repository '$REPO'."
-			schroot --run-session -c $SESSION --directory /var/abs/$REPO -- ls -1|sort -R|xargs echo > ${ARCHLINUX_PKGS}_$REPO
-			echo "$(date -u ) - these packages in repository '$REPO' are known to us:"
-			cat ${ARCHLINUX_PKGS}_$REPO
+			NEED_UPDATE=true
 		fi
 	done
-	schroot --end-session -c $SESSION
 	rm $DUMMY > /dev/null
+	if $NEED_UPDATE ; then
+		local SESSION="archlinux-scheduler-$RANDOM"
+		schroot --begin-session --session-name=$SESSION -c jenkins-reproducible-archlinux
+		for REPO in $ARCHLINUX_REPOS ; do
+			if [ ! -f ${ARCHLINUX_PKGS}_$REPO ] || [ $DUMMY -nt ${ARCHLINUX_PKGS}_$REPO ] ; then
+				echo "$(date -u ) - updating list of available packages in repository '$REPO'."
+				schroot --run-session -c $SESSION --directory /var/abs/$REPO -- ls -1|sort -R|xargs echo > ${ARCHLINUX_PKGS}_$REPO
+				echo "$(date -u ) - these packages in repository '$REPO' are known to us:"
+				cat ${ARCHLINUX_PKGS}_$REPO
+			fi
+		done
+		schroot --end-session -c $SESSION
+	else
+		echo "$(date -u ) - repositories recent enough, no update needed."
+	fi
 }
 
 choose_package() {

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