[Qa-jenkins-scm] [jenkins.debian.net] 01/01: only run apt-get install if update_jdn.sh has changed

Holger Levsen holger at layer-acht.org
Mon Jun 20 21:51:29 UTC 2016


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 0e6b358c425631e166721d710c8eefbf16a1e4d3
Author: Holger Levsen <holger at layer-acht.org>
Date:   Mon Jun 20 23:50:50 2016 +0200

    only run apt-get install if update_jdn.sh has changed
---
 update_jdn.sh | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/update_jdn.sh b/update_jdn.sh
index e11179c..43d42ba 100755
--- a/update_jdn.sh
+++ b/update_jdn.sh
@@ -14,10 +14,20 @@ TMPFILE=$(mktemp)
 # which allows one to specify --flush-cache or --ignore-cache
 JJB="jenkins-job-builder $@"
 
+# so we can later run some commands only if $0 has been updated…
+if [ ! -f $STAMP ] && [ $BASEDIR/$0 -nt $STAMP ] ;
+	UPTODATE=false
+else
+	UPTODATE=true
+fi
+
+
 explain() {
 	echo "$HOSTNAME: $1"
 }
 
+
+
 echo "--------------------------------------------"
 explain "$(date) - begin deployment update."
 
@@ -363,25 +373,25 @@ if [ -f /etc/debian_version ] ; then
 			MASTERDEBS=""
 		fi
 		sudo apt-get update
-		sudo apt-get install $DEBS $MASTERDEBS
-		sudo apt-get install -t jessie-backports \
+		$UP2DATE || sudo apt-get install $DEBS $MASTERDEBS
+		$UP2DATE || sudo apt-get install -t jessie-backports \
 				pbuilder lintian || echo "this should only fail on the first install"
 		#		botch
 		# we need mock from bpo to build current fedora
 		if [ "$HOSTNAME" = "profitbricks-build3-amd64" ] || [ "$HOSTNAME" = "profitbricks-build4-amd64" ] || [ "$HOSTNAME" = "jenkins" ] ; then
-			sudo apt-get install -t jessie-backports mock \
+			$UP2DATE || sudo apt-get install -t jessie-backports mock \
 				|| echo "this should only fail on the first install"
 		fi
 		# for varying kernels
 		# we use bpo kernels on pb-build5+6 (and i386 kernel on pb-build2-i386)
 		if [ "$HOSTNAME" = "profitbricks-build5-amd64" ] || [ "$HOSTNAME" = "profitbricks-build6-i386" ]; then
-			sudo apt-get install -t jessie-backports linux-image-amd64 || echo "this should only fail on the first install"
+			$UP2DATE || sudo apt-get install -t jessie-backports linux-image-amd64 || echo "this should only fail on the first install"
 		fi
 		# only needed on the main node
 		if [ "$HOSTNAME" = "jenkins-test-vm" ] ; then
-			sudo apt-get install -t jessie-backports jenkins-job-builder || echo "this should only fail on the first install"
+			$UP2DATE || sudo apt-get install -t jessie-backports jenkins-job-builder || echo "this should only fail on the first install"
 		elif [ "$HOSTNAME" = "jenkins" ] ; then
-			sudo apt-get install -t jessie-backports ffmpeg libav-tools python3-popcon jenkins-job-builder
+			$UP2DATE || sudo apt-get install -t jessie-backports ffmpeg libav-tools python3-popcon jenkins-job-builder
 		fi
 		explain "packages installed."
 	else

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