summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2014-09-28 14:08:17 +0200
committerHolger Levsen <holger@layer-acht.org>2014-09-28 14:08:17 +0200
commit8ccd470b94215a0b30d4f2879e76fef5e1c81d3a (patch)
treec5b4af6df2ec612c29af41f7b64811d3fe872516
parent2682abe670d0794f40c6ebbf129bb69a0147887d (diff)
downloadjenkins.debian.net-8ccd470b94215a0b30d4f2879e76fef5e1c81d3a.tar.xz
reproducible: actually include statistics in the stats page
-rwxr-xr-xbin/reproducible_build.sh23
-rwxr-xr-xbin/reproducible_stats.sh11
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 "<html><body>" > index.html
htmlecho "<h2>Simple statistics for reproducible builds</h2>"
htmlecho "<p>Results were obtaining by <a href=\"$JENKINS_URL/view/reproducible\">several jobs running on jenkins.debian.net</a>.</p>"
-htmlecho "<p>$COUNT_BAD packages failed to built reproducibly: <code>"
+htmlecho "<p>$COUNT_TOTAL packages attempted to build so far, out of $AMOUNT in $SUITE currently. That's $PERCENT_TOTAL%!</p>"
+htmlecho "<p>$COUNT_BAD packages ($PERCENT_BAD%) failed to built reproducibly: <code>"
for PKG in $BAD ; do
VERSION=$(sqlite3 $PACKAGES_DB "SELECT version FROM source_packages WHERE name = \"$PKG\"")
htmlecho "<a href=\"$JENKINS_URL/userContent/diffp/${PKG}_${VERSION}.diffp\">$PKG </a> "
@@ -40,8 +46,7 @@ htmlecho "</code></p>"
htmlecho
htmlecho "<p>$COUNT_UGLY packages failed to build from source: <code>${UGLY}</code></p>"
htmlecho "<p>$COUNT_SOURCELESS packages which don't exist in sid and need investigation: <code>$SOURCELESS<code></p>"
-htmlecho "<p>$COUNT_TOTAL packages attempted to build in total.</p>"
-htmlecho "<p>$COUNT_GOOD packages successfully built reproducibly: <code>${GOOD}</code></p>"
+htmlecho "<p>$COUNT_GOOD packages ($PERCENT_GOOD%) successfully built reproducibly: <code>${GOOD}</code></p>"
htmlecho "<hr><font size='-1'><a href=\"$JENKINS_URL/userContent/diffp.html\">Static URL for this page.</a> Last modified: $(date)</font>"
htmlecho "</p></body></html>"