[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible Debian: deal gracefully if there are no build results yet

Holger Levsen holger at layer-acht.org
Thu Dec 22 20:04:21 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 a97716e1c55f1439649478047afd966a55c784e5
Author: Holger Levsen <holger at layer-acht.org>
Date:   Thu Dec 22 21:04:06 2016 +0100

    reproducible Debian: deal gracefully if there are no build results yet
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_html_dashboard.sh | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/bin/reproducible_html_dashboard.sh b/bin/reproducible_html_dashboard.sh
index 00c21d2..a82ad82 100755
--- a/bin/reproducible_html_dashboard.sh
+++ b/bin/reproducible_html_dashboard.sh
@@ -121,21 +121,26 @@ update_suite_arch_stats() {
 		OLDESTG=$(query_db "SELECT r.build_date FROM results AS r JOIN sources AS s ON r.package_id=s.id WHERE r.status = 'reproducible' AND s.suite='$SUITE' AND s.architecture='$ARCH' AND NOT date(r.build_date)>='$DATE' ORDER BY r.build_date LIMIT 1;")
 		OLDESTB=$(query_db "SELECT r.build_date FROM results AS r JOIN sources AS s ON r.package_id=s.id WHERE s.suite='$SUITE' AND s.architecture='$ARCH' AND r.status = 'unreproducible' AND NOT date(r.build_date)>='$DATE' ORDER BY r.build_date LIMIT 1;")
 		OLDESTU=$(query_db "SELECT r.build_date FROM results AS r JOIN sources AS s ON r.package_id=s.id WHERE s.suite='$SUITE' AND s.architecture='$ARCH' AND r.status = 'FTBFS' AND NOT date(r.build_date)>='$DATE' ORDER BY r.build_date LIMIT 1;")
-		DIFFG=$(query_db "SELECT (date '$DATE' - date '$OLDESTG');")
-		if [ -z $DIFFG ] ; then DIFFG=0 ; fi
-		DIFFB=$(query_db "SELECT (date '$DATE' - date '$OLDESTB');")
-		if [ -z $DIFFB ] ; then DIFFB=0 ; fi
-		DIFFU=$(query_db "SELECT (date '$DATE' - date '$OLDESTU');")
-		if [ -z $DIFFU ] ; then DIFFU=0 ; fi
+		# only if we have results…
+		if [ -n "$OLDESTG" ] ; then
+			DIFFG=$(query_db "SELECT (date '$DATE' - date '$OLDESTG');")
+			if [ -z $DIFFG ] ; then DIFFG=0 ; fi
+			DIFFB=$(query_db "SELECT (date '$DATE' - date '$OLDESTB');")
+			if [ -z $DIFFB ] ; then DIFFB=0 ; fi
+			DIFFU=$(query_db "SELECT (date '$DATE' - date '$OLDESTU');")
+			if [ -z $DIFFU ] ; then DIFFU=0 ; fi
+		fi
 		let "TOTAL=GOOD+BAD+UGLY+REST" || true # let FOO=0+0 returns error in bash...
 		if [ "$ALL" != "$TOTAL" ] ; then
 			let "UNTESTED=ALL-TOTAL"
 		else
 			UNTESTED=0
 		fi
-		query_db "INSERT INTO ${TABLE[0]} VALUES ('$DATE', '$SUITE', '$ARCH', $UNTESTED, $GOOD, $BAD, $UGLY, $REST)"
-		query_db "INSERT INTO ${TABLE[1]} VALUES ('$DATE', '$SUITE', '$ARCH', $GOOAY, $BAAY, $UGLDAY, $RESDAY)"
-		query_db "INSERT INTO ${TABLE[2]} VALUES ('$DATE', '$SUITE', '$ARCH', '$DIFFG', '$DIFFB', '$DIFFU')"
+		if [ -n "$OLDESTG" ] ; then
+			query_db "INSERT INTO ${TABLE[0]} VALUES ('$DATE', '$SUITE', '$ARCH', $UNTESTED, $GOOD, $BAD, $UGLY, $REST)"
+			query_db "INSERT INTO ${TABLE[1]} VALUES ('$DATE', '$SUITE', '$ARCH', $GOOAY, $BAAY, $UGLDAY, $RESDAY)"
+			query_db "INSERT INTO ${TABLE[2]} VALUES ('$DATE', '$SUITE', '$ARCH', '$DIFFG', '$DIFFB', '$DIFFU')"
+		fi
 		# we do 3 later and 6 is special anyway...
 		for i in 0 1 2 4 5 ; do
 			PREFIX=""

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