From 8ccd470b94215a0b30d4f2879e76fef5e1c81d3a Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sun, 28 Sep 2014 14:08:17 +0200 Subject: reproducible: actually include statistics in the stats page --- bin/reproducible_build.sh | 23 +++++++++++++++-------- bin/reproducible_stats.sh | 11 ++++++++--- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index e5f9ba6d..ed77c280 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -19,14 +19,19 @@ fi PACKAGES_DB=/var/lib/jenkins/reproducible.db if [ ! -f $PACKAGES_DB ] ; then sqlite3 $PACKAGES_DB ' - CREATE TABLE source_packages - (name TEXT NOT NULL, - version TEXT NOT NULL, - status TEXT NOT NULL - CHECK (status IN ("FTBFS","reproducible","unreproducible","404")), - build_date TEXT NOT NULL, - diffp_path TEXT, - PRIMARY KEY (name))' + CREATE TABLE source_packages + (name TEXT NOT NULL, + version TEXT NOT NULL, + status TEXT NOT NULL + CHECK (status IN ("FTBFS","reproducible","unreproducible","404")), + build_date TEXT NOT NULL, + diffp_path TEXT, + PRIMARY KEY (name))' + sqlite3 $PACKAGES_DB ' + CREATE TABLE source_stats + (suite TEXT NOT NULL, + amount INTEGER NOT NULL, + PRIMARY KEY (suite))' fi # 30 seconds timeout when trying to get a lock INIT=/var/lib/jenkins/reproducible.init @@ -44,6 +49,8 @@ if [[ $1 =~ ^-?[0-9]+$ ]] ; then curl http://ftp.de.debian.org/debian/dists/sid/main/source/Sources.xz > $TMPFILE AMOUNT=$1 PACKAGES=$(xzcat $TMPFILE | grep "^Package" | cut -d " " -f2 | egrep -v "linux$"| sort -R | head -$AMOUNT | xargs echo) + P_IN_SOURCES=$(xzcat $TMPFILE | grep "^Package" | cut -d " " -f2 | wc -l) + sqlite3 -init $INIT $PACKAGES_DB "REPLACE INTO source_stats VALUES (\"sid\", \"${P_IN_SOURCES}\")" rm $TMPFILE else PACKAGES="$@" diff --git a/bin/reproducible_stats.sh b/bin/reproducible_stats.sh index dde556fc..21d54dfe 100755 --- a/bin/reproducible_stats.sh +++ b/bin/reproducible_stats.sh @@ -13,6 +13,8 @@ if [ ! -f $PACKAGES_DB ] ; then exit 1 fi +SUITE=sid +AMOUNT=$(sqlite3 $PACKAGES_DB "SELECT amount FROM source_stats WHERE suite = \"$SUITE\"" | xargs echo) GOOD=$(sqlite3 $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"reproducible\" ORDER BY name" | xargs echo) COUNT_GOOD=$(sqlite3 $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE status = \"reproducible\"") BAD=$(sqlite3 $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"unreproducible\" ORDER BY build_date DESC" | xargs echo) @@ -22,6 +24,9 @@ COUNT_UGLY=$(sqlite3 $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE SOURCELESS=$(sqlite3 $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"404\" ORDER BY build_date DESC" | xargs echo) COUNT_SOURCELESS=$(sqlite3 $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE status = \"404\"" | xargs echo) COUNT_TOTAL=$(sqlite3 $PACKAGES_DB "SELECT COUNT(name) FROM source_packages") +PERCENT_TOTAL=$(echo "scale=3 ; ($COUNT_TOTAL*100/$AMOUNT)" | bc) +PERCENT_GOOD=$(echo "scale=3 ; ($COUNT_GOOD*100/$COUNT_TOTAL)" | bc) +PERCENT_BAD=$(echo "scale=3 ; ($COUNT_BAD*100/$COUNT_TOTAL)" | bc) htmlecho() { echo "$1" >> index.html @@ -31,7 +36,8 @@ rm index.html htmlecho "" > index.html htmlecho "

Simple statistics for reproducible builds

" htmlecho "

Results were obtaining by several jobs running on jenkins.debian.net.

" -htmlecho "

$COUNT_BAD packages failed to built reproducibly: " +htmlecho "

$COUNT_TOTAL packages attempted to build so far, out of $AMOUNT in $SUITE currently. That's $PERCENT_TOTAL%!

" +htmlecho "

$COUNT_BAD packages ($PERCENT_BAD%) failed to built reproducibly: " for PKG in $BAD ; do VERSION=$(sqlite3 $PACKAGES_DB "SELECT version FROM source_packages WHERE name = \"$PKG\"") htmlecho "$PKG " @@ -40,8 +46,7 @@ htmlecho "

" htmlecho htmlecho "

$COUNT_UGLY packages failed to build from source: ${UGLY}

" htmlecho "

$COUNT_SOURCELESS packages which don't exist in sid and need investigation: $SOURCELESS

" -htmlecho "

$COUNT_TOTAL packages attempted to build in total.

" -htmlecho "

$COUNT_GOOD packages successfully built reproducibly: ${GOOD}

" +htmlecho "

$COUNT_GOOD packages ($PERCENT_GOOD%) successfully built reproducibly: ${GOOD}

" htmlecho "
Static URL for this page. Last modified: $(date)" htmlecho "

" -- cgit v1.2.3-70-g09d2