[Qa-jenkins-scm] [jenkins.debian.net] 01/02: reproducible debian: html_dashboard: automatically adapt the stats about average builds per day in case of new architectures

Holger Levsen holger at layer-acht.org
Thu Jan 19 12:21:38 UTC 2017


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 a23cbd52bb7273f45eeff6b68e1e5a9af116fe52
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Thu Jan 19 11:39:54 2017 +0100

    reproducible debian: html_dashboard: automatically adapt the stats about average builds per day in case of new architectures
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_html_dashboard.sh | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/bin/reproducible_html_dashboard.sh b/bin/reproducible_html_dashboard.sh
index 57fa09c..c5d19e3 100755
--- a/bin/reproducible_html_dashboard.sh
+++ b/bin/reproducible_html_dashboard.sh
@@ -342,20 +342,22 @@ write_build_performance_stats() {
 	done
 	write_page "</tr><tr><td class=\"left\">packages tested on average per day in the last $TIMESPAN_VERBOSE</td>"
 	for ARCH in ${ARCHS} ; do
-		if [ "$ARCH" = "arm64" ] ; then
-			TIMESPAN_RAW="14"
-			local ARM64_DISCLAIMER=" <span style=\"font-size:0.8em;\">(in the last 2 weeks)</span>"
-		else
-			TIMESPAN_RAW="28"
-			local ARM64_DISCLAIMER=""
+		local OLDEST_BUILD="$(query_db "SELECT build_date FROM stats_build WHERE architecture='$ARCH' ORDER BY build_date ASC LIMIT 1")"
+		local DAY_DIFFS="$(( ($(date -d "$DATE" +%s) - $(date -d "$OLDEST_BUILD" +%s)) / (60*60*24) ))"
+		if [ $DAY_DIFFS -lt $TIMESPAN_RAW ]; then
+			# this is a new architecture, there are fewer days to compare to.
+			local DISCLAIMER=" <span style=\"font-size: 0.8em;\">(in the last $DAY_DIFFS days)</span>"
+			TIMESPAN_RAW=$DAY_DIFF
 		fi
 		local TIMESPAN="$(echo $TIMESPAN_RAW-1|bc)"
 		local TIMESPAN_DATE=$(date '+%Y-%m-%d %H:%M' -d "- $TIMESPAN days")
 
 		RESULT=$(query_db "SELECT COUNT(r.build_date) FROM stats_build AS r WHERE r.build_date > '$TIMESPAN_DATE' AND r.architecture='$ARCH'")
 		RESULT="$(echo $RESULT/$TIMESPAN_RAW|bc)"
-		write_page "<td>$RESULT$ARM64_DISCLAIMER</td>"
+		write_page "<td>${RESULT}${DISCLAIMER:-}</td>"
 	done
+
+
 	local TIMESPAN_VERBOSE="3 months"
 	local TIMESPAN_RAW="91"
 	# Find stats for 91 days since yesterday, no stats exist for today

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