diff options
-rwxr-xr-x | bin/reproducible_stats.sh | 79 |
1 files changed, 49 insertions, 30 deletions
diff --git a/bin/reproducible_stats.sh b/bin/reproducible_stats.sh index 281d20b8..c0047566 100755 --- a/bin/reproducible_stats.sh +++ b/bin/reproducible_stats.sh @@ -20,6 +20,9 @@ declare -A BAD declare -A UGLY declare -A SOURCELESS declare -A NOTFORUS +declare -A STAR +declare -A LINKTARGET +declare -A SPOKENTARGET LAST24="AND build_date > datetime('now', '-24 hours') " LAST48="AND build_date > datetime('now', '-48 hours') " SUITE=sid @@ -54,8 +57,11 @@ PERCENT_UGLY=$(echo "scale=1 ; ($COUNT_UGLY*100/$COUNT_TOTAL)" | bc) PERCENT_NOTFORUS=$(echo "scale=1 ; ($COUNT_NOTFORUS*100/$COUNT_TOTAL)" | bc) PERCENT_SOURCELESS=$(echo "scale=1 ; ($COUNT_SOURCELESS*100/$COUNT_TOTAL)" | bc) GUESS_GOOD=$(echo "$PERCENT_GOOD*$AMOUNT/100" | bc) -declare -A STAR -declare -A LINKTARGET +SPOKENTARGET["all"]="all tested packages" +SPOKENTARGET["last_24h"]="packages tested in the last 24h" +SPOKENTARGET["last_48h"]="packages tested in the last 48h" +SPOKENTARGET["dd-list"]="maintainers of unreproducible packages" + write_summary() { echo "$1" >> $SUMMARY @@ -147,39 +153,52 @@ link_packages() { done } -echo "Processing packages... this will take a while." -EXTRA_STAR=true -process_packages ${BAD["all"]} -EXTRA_STAR=false -process_packages ${UGLY["all"]} ${GOOD["all"]} - -SPOKENTARGET["all"]="all tested packages" -SPOKENTARGET["last_24h"]="packages tested in the last 24h" -SPOKENTARGET["last_48"]="packages tested in the last 48h" - -MAINVIEW="last_24h" -ALLVIEWS="all last_24h last_48h" -for VIEW in $ALLVIEWS ; do - SUMMARY=index_${VIEW}.html - echo "Starting to write $SUMMARY page." +write_summary_header() { rm -f $SUMMARY write_summary "<!DOCTYPE html><html><head>" write_summary "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />" write_summary "<link href=\"static/style.css\" type=\"text/css\" rel=\"stylesheet\" /></head>" write_summary "<body><header><h2>Statistics for reproducible builds</h2>" - if [ "$VIEW" = "$MAINVIEW" ] ; then + if [ "$1" = "$MAINVIEW" ] ; then write_summary "<p>This page is updated every three hours. Results are obtained from <a href=\"$JENKINS_URL/view/reproducible\">several build jobs running on jenkins.debian.net</a>. Thanks to <a href=\"https://www.profitbricks.com\">Profitbricks</a> for donating the virtual machine it's running on!</p>" write_summary "<p>$COUNT_TOTAL packages attempted to build so far, that's $PERCENT_TOTAL% of $AMOUNT source packages in Debian $SUITE currently. Out of these, $PERCENT_GOOD% were successful, so quite wildly guessing this roughy means about $GUESS_GOOD <a href=\"https://wiki.debian.org/ReproducibleBuilds\">packages should be reproducibly buildable!</a> Join <code>#debian-reproducible</code> on OFTC to get support for making sure your packages build reproducibly too!</p>" fi write_summary "<p>Other views for the build results:<ul>" - for TARGET in $ALLVIEWS ; do - if [ "$TARGET" = "$VIEW" ] ; then + for TARGET in $ALLVIEWS dd-list; do + if [ "$TARGET" = "$1" ] ; then continue fi write_summary "<li><a href=\"index_${TARGET}.html\">${SPOKENTARGET[$TARGET]}</a></li>" done write_summary "</ul></p>" write_summary "</header>" +} + +write_summary_footer() { + write_summary "<hr/><p><font size='-1'><a href=\"$JENKINS_URL/userContent/reproducible.html\">Static URL for this page.</a> Last modified: $(date). Copyright 2014 <a href=\"mailto:holger@layer-acht.org\">Holger Levsen</a>, GPL-2 licensed. <a href=\"https://jenkins.debian.net/userContent/about.html\">About jenkins.debian.net</a></font>" + write_summary "</p></body></html>" +} + +publish_summary() { + cp $SUMMARY /var/lib/jenkins/userContent/ + if [ "$VIEW" = "$MAINVIEW" ] ; then + cp $SUMMARY /var/lib/jenkins/userContent/reproducible.html + fi + rm $SUMMARY +} + +echo "Processing packages... this will take a while." +EXTRA_STAR=true +process_packages ${BAD["all"]} +EXTRA_STAR=false +process_packages ${UGLY["all"]} ${GOOD["all"]} + +MAINVIEW="last_24h" +ALLVIEWS="all last_24h last_48h" +for VIEW in $ALLVIEWS ; do + SUMMARY=index_${VIEW}.html + echo "Starting to write $SUMMARY page." + write_summary_header $VIEW write_summary "<p>$COUNT_BAD packages ($PERCENT_BAD% of $COUNT_TOTAL) failed to built reproducibly: <code>" link_packages ${BAD[$VIEW]} write_summary "</code></p>" @@ -200,16 +219,16 @@ for VIEW in $ALLVIEWS ; do write_summary "<p>$COUNT_GOOD packages ($PERCENT_GOOD%) successfully built reproducibly: <code>" link_packages ${GOOD[$VIEW]} write_summary "</code></p>" - write_summary "<hr/><h2>Packages which failed to build reproducibly, sorted by Maintainers: and Uploaders: fields</h2>" - write_summary "<p><pre>$(echo ${BAD[$VIEW]} | dd-list -i) </pre></p>" - write_summary "<hr/><p><font size='-1'><a href=\"$JENKINS_URL/userContent/reproducible.html\">Static URL for this page.</a> Last modified: $(date). Copyright 2014 <a href=\"mailto:holger@layer-acht.org\">Holger Levsen</a>, GPL-2 licensed. <a href=\"https://jenkins.debian.net/userContent/about.html\">About jenkins.debian.net</a></font>" - write_summary "</p></body></html>" - # publish - cp $SUMMARY /var/lib/jenkins/userContent/ - if [ "$VIEW" = "$MAINVIEW" ] ; then - cp $SUMMARY /var/lib/jenkins/userContent/reproducible.html - fi - rm $SUMMARY + write_summary_footer + publish_summary done +VIEW=dd-list +SUMMARY=index_${VIEW}.html +echo "Starting to write $SUMMARY page." +write_summary_header $VIEW +write_summary "<h2>Packages which failed to build reproducibly, sorted by Maintainers: and Uploaders: fields</h2>" +write_summary "<p><pre>$(echo ${BAD["all"]} | dd-list -i) </pre></p>" +write_summary_footer + publish_summary |