[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible debian: dashboard: don't accidentally trash the original TIMESPAN while looping

Holger Levsen holger at layer-acht.org
Thu Jan 19 13:15:58 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 0482c0af81fab771dfe596f43d4d07b5827a5613
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Thu Jan 19 14:15:21 2017 +0100

    reproducible debian: dashboard: don't accidentally trash the original TIMESPAN while looping
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_html_dashboard.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bin/reproducible_html_dashboard.sh b/bin/reproducible_html_dashboard.sh
index 4936adf..107425e 100755
--- a/bin/reproducible_html_dashboard.sh
+++ b/bin/reproducible_html_dashboard.sh
@@ -303,19 +303,20 @@ _average_builds_per_day() {
 		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) ))"
 		local DISCLAIMER=""
-		if [ $DAY_DIFFS -lt $TIMESPAN_RAW ]; then
+		local TIMESPAN="$TIMESTAN_RAW"
+		if [ $DAY_DIFFS -lt $TIMESPAN ]; then
 			# this is a new architecture, there are fewer days to compare to.
 			DISCLAIMER=" <span style=\"font-size: 0.8em;\">(in the last $DAY_DIFFS days)</span>"
-			TIMESPAN_RAW=$DAY_DIFF
+			TIMESPAN=$DAY_DIFF
 		fi
 		if [ $DAY_DIFFS -ge $MIN_DAYS ]; then
 			# find stats for since the day before $TIMESPAN_RAW days ago,
 			# since no stats exist for today yet.
-			local TIMESPAN="$(echo $TIMESPAN_RAW-1|bc)"
+			local TIMESPAN="$(echo $TIMESPAN-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)"
+			RESULT="$(echo $RESULT/$TIMESPAN|bc)"
 		else
 			# very new arch with too few resulsts to care about stats
 			RESULT=" "

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