[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible Arch Linux: use grep -c instead of bash arithmetics

Holger Levsen holger at layer-acht.org
Sun Nov 26 21:29:47 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 796529191a5253b1ec41f77c066706156c4e0dcf
Author: Holger Levsen <holger at layer-acht.org>
Date:   Sun Nov 26 21:29:41 2017 +0000

    reproducible Arch Linux: use grep -c instead of bash arithmetics
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_html_archlinux.sh | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/bin/reproducible_html_archlinux.sh b/bin/reproducible_html_archlinux.sh
index 25fb8e8..fda6125 100755
--- a/bin/reproducible_html_archlinux.sh
+++ b/bin/reproducible_html_archlinux.sh
@@ -60,32 +60,27 @@ for REPOSITORY in $ARCHLINUX_REPOS ; do
 			echo "$(date -u ) - ignoring $PKG from '$REPOSITORY' which is building in $ARCHLINUX_PKG_PATH right now…"
 			continue
 		fi
-		let TESTED+=1
 		if [ -f $ARCHLINUX_PKG_PATH/pkg.state ] ; then
 			STATE="$(cat $ARCHLINUX_PKG_PATH/pkg.state 2>&1)"
 			case $STATE in
-				GOOD)		let NR_GOOD+=1
-						HTML_TARGET=$HTML_GOOD
+				GOOD)		HTML_TARGET=$HTML_GOOD
 						;;
-				FTBR)		let NR_FTBR+=1
-						HTML_TARGET=$HTML_FTBR
+				FTBR)		HTML_TARGET=$HTML_FTBR
 						;;
-				FTBFS*)		let NR_FTBFS+=1
-						SUBSTATE=$(echo $STATE | cut -d "_" -f2)
+				FTBFS*)		SUBSTATE=$(echo $STATE | cut -d "_" -f2)
 						HTML_TARGET=${HTML_FTBFS[$SUBSTATE]}
 						;;
-				404*)		let NR_404+=1
-						SUBSTATE=$(echo $STATE | cut -d "_" -f2)
+				404*)		SUBSTATE=$(echo $STATE | cut -d "_" -f2)
 						HTML_TARGET=${HTML_404[$SUBSTATE]}
 						;;
-				DEPWAIT*)	let NR_DEPWAIT+=1
-						SUBSTATE=$(echo $STATE | cut -d "_" -f2)
+				DEPWAIT*)	SUBSTATE=$(echo $STATE | cut -d "_" -f2)
 						HTML_TARGET=${HTML_DEPWAIT[$SUBSTATE]}
 						;;
-				UNKNOWN)	let NR_UNKNOWN+=1
-						HTML_TARGET=$HTML_UNKNOWN
+				UNKNOWN)	HTML_TARGET=$HTML_UNKNOWN
+						;;
+				*)		echo "Unknown state for $ARCHLINUX_PKG_PATH: $STATE"
+						exit 1
 						;;
-				*)		exit 1 ;;
 			esac
 			cat $ARCHLINUX_PKG_PATH/pkg.html >> $HTML_TARGET
 		else
@@ -222,6 +217,13 @@ for REPOSITORY in $ARCHLINUX_REPOS ; do
 
 	done
 	# prepare stats per repository
+	TESTED=$(cat $ARCHBASE/$REPOSITORY/*/pkg.state | grep -c ^)
+	NR_GOOD=$(cat $ARCHBASE/$REPOSITORY/*/pkg.state | grep -c GOOD)
+	NR_FTBR=$(cat $ARCHBASE/$REPOSITORY/*/pkg.state | grep -c FTBR)
+	NR_FTBFS=$(cat $ARCHBASE/$REPOSITORY/*/pkg.state | grep -c FTBFS)
+	NR_DEPWAIT=$(cat $ARCHBASE/$REPOSITORY/*/pkg.state | grep -c DEPWAIT)
+	NR_404=$(cat $ARCHBASE/$REPOSITORY/*/pkg.state | grep -c 404)
+	NR_UNKNOWN=$(cat $ARCHBASE/$REPOSITORY/*/pkg.state | grep -c UNKNOWN)
 	PERCENT_TOTAL=$(echo "scale=1 ; ($TESTED*100/$TOTAL)" | bc)
 	if [ $(echo $PERCENT_TOTAL/1|bc) -lt 99 ] ; then
 		NR_TESTED="$TESTED <span style=\"font-size:0.8em;\">(tested $PERCENT_TOTAL% of $TOTAL)</span>"

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