#!/bin/bash
# Copyright 2014 Holger Levsen
# released under the GPLv=2
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
# common code defining db access
. /srv/jenkins/bin/reproducible_common.sh
set +x
declare -A GOOD
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
AMOUNT=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT count(name) FROM sources")
ALLSTATES="reproducible FTBR_with_buildinfo FTBR FTBFS 404 not_for_us blacklisted"
MAINVIEW="all_abc"
ALLVIEWS="last_24h last_48h all_abc"
GOOD["all"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"reproducible\" ORDER BY build_date DESC" | xargs echo)
GOOD["last_24h"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"reproducible\" $LAST24 ORDER BY build_date DESC" | xargs echo)
GOOD["last_48h"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"reproducible\" $LAST48 ORDER BY build_date DESC" | xargs echo)
GOOD["all_abc"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"reproducible\" ORDER BY name" | xargs echo)
COUNT_GOOD=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE status = \"reproducible\"")
BAD["all"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"unreproducible\" ORDER BY build_date DESC" | xargs echo)
BAD["last_24h"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"unreproducible\" $LAST24 ORDER BY build_date DESC" | xargs echo)
BAD["last_48h"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"unreproducible\" $LAST48 ORDER BY build_date DESC" | xargs echo)
BAD["all_abc"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"unreproducible\" ORDER BY name" | xargs echo)
COUNT_BAD=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE status = \"unreproducible\"")
UGLY["all"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"FTBFS\" ORDER BY build_date DESC" | xargs echo)
UGLY["last_24h"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"FTBFS\" $LAST24 ORDER BY build_date DESC" | xargs echo)
UGLY["last_48h"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"FTBFS\" $LAST48 ORDER BY build_date DESC" | xargs echo)
UGLY["all_abc"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"FTBFS\" ORDER BY name" | xargs echo)
COUNT_UGLY=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE status = \"FTBFS\"")
SOURCELESS["all"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"404\" ORDER BY build_date DESC" | xargs echo)
SOURCELESS["all_abc"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"404\" ORDER BY name" | xargs echo)
COUNT_SOURCELESS=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE status = \"404\"" | xargs echo)
NOTFORUS["all"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"not for us\" ORDER BY build_date DESC" | xargs echo)
NOTFORUS["all_abc"]=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"not for us\" ORDER BY name" | xargs echo)
COUNT_NOTFORUS=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE status = \"not for us\"" | xargs echo)
BLACKLISTED=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name FROM source_packages WHERE status = \"blacklisted\" ORDER BY name" | xargs echo)
COUNT_BLACKLISTED=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE status = \"blacklisted\"" | xargs echo)
COUNT_TOTAL=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(name) FROM source_packages")
PERCENT_TOTAL=$(echo "scale=1 ; ($COUNT_TOTAL*100/$AMOUNT)" | bc)
PERCENT_GOOD=$(echo "scale=1 ; ($COUNT_GOOD*100/$COUNT_TOTAL)" | bc)
PERCENT_BAD=$(echo "scale=1 ; ($COUNT_BAD*100/$COUNT_TOTAL)" | bc)
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)
SPOKENTARGET["last_24h"]="packages tested in the last 24h"
SPOKENTARGET["last_48h"]="packages tested in the last 48h"
SPOKENTARGET["all_abc"]="all tested packages (sorted alphabetically)"
SPOKENTARGET["dd-list"]="maintainers of unreproducible packages"
SPOKENTARGET["stats"]="various statistics about reproducible builds"
SPOKENTARGET["notes"]="packages with notes"
SPOKENTARGET["issues"]="known issues related to reproducible builds"
SPOKENTARGET["reproducible"]="packages which built reproducibly"
SPOKENTARGET["FTBR"]="packages which failed to build reproducibly and don't create a .buildinfo file"
SPOKENTARGET["FTBR_with_buildinfo"]="packages which failed to build reproducibly and create a .buildinfo file"
SPOKENTARGET["FTBFS"]="packages which failed to build from source"
SPOKENTARGET["404"]="packages where the sources failed to downloaded"
SPOKENTARGET["not_for_us"]="packages which should not be build on 'amd64'"
SPOKENTARGET["blacklisted"]="packages which have been blacklisted"
# shop trailing slash
JENKINS_URL=${JENKINS_URL:0:-1}
#
# gather notes
#
WORKSPACE=$PWD
cd /var/lib/jenkins
if [ -d notes.git ] ; then
cd notes.git
git pull
else
git clone git://git.debian.org/git/reproducible/notes.git notes.git
fi
cd $WORKSPACE
PACKAGES_YML=/var/lib/jenkins/notes.git/packages.yml
ISSUES_YML=/var/lib/jenkins/notes.git/issues.yml
NOTES_PATH=/var/lib/jenkins/userContent/notes
ISSUES_PATH=/var/lib/jenkins/userContent/issues
mkdir -p $NOTES_PATH $ISSUES_PATH
declare -A NOTES_PACKAGE
declare -A NOTES_VERSION
declare -A NOTES_ISSUES
declare -A NOTES_BUGS
declare -A NOTES_COMMENTS
declare -A ISSUES_DESCRIPTION
declare -A ISSUES_URL
show_multi_values() {
TMPFILE=$(mktemp)
echo "$@" > $TMPFILE
while IFS= read -r p ; do
if [ "$p" = "-" ] || [ "$p" = "" ] ; then
continue
elif [ "${p:0:2}" = "- " ] ; then
p="${p:2}"
fi
echo " $PROPERTY = $p"
done < $TMPFILE
unset IFS
rm $TMPFILE
}
tag_property_loop() {
BEFORE=$1
shift
AFTER=$1
shift
TMPFILE=$(mktemp)
echo "$@" > $TMPFILE
while IFS= read -r p ; do
if [ "$p" = "-" ] || [ "$p" = "" ] ; then
continue
elif [ "${p:0:2}" = "- " ] ; then
p="${p:2}"
fi
write_page "$BEFORE"
if $BUG ; then
# turn bugs into links
p="#$p"
else
# turn URLs into links
p="$(echo $p |sed -e 's|http[s:]*//[^ ]*|\0|g')"
fi
write_page "$p"
write_page "$AFTER"
done < $TMPFILE
unset IFS
rm $TMPFILE
}
issues_loop() {
TTMPFILE=$(mktemp)
echo "$@" > $TTMPFILE
while IFS= read -r p ; do
if [ "${p:0:2}" = "- " ] ; then
p="${p:2}"
fi
write_page "
"
BETA_SIGN=false
for PKG in $PACKAGES_WITH_NOTES ; do
if [ "${NOTES_ISSUES[$PKG]}" != "" ] ; then
TTMPFILE=$(mktemp)
echo "${NOTES_ISSUES[$PKG]}" > $TTMPFILE
while IFS= read -r p ; do
if [ "${p:0:2}" = "- " ] ; then
p="${p:2}"
fi
if [ "$p" = "$1" ] ; then
write_page " ${LINKTARGET[$PKG]} "
if ! $BETA_SIGN && [ "${STAR[$PKG]}" != "" ] ; then
BETA_SIGN=true
fi
fi
done < $TTMPFILE
unset IFS
rm $TTMPFILE
fi
done
write_page "
"
write_page "
"
write_page "
"
write_page "Notes are stored in notes.git."
write_page "
"
write_page_meta_sign
write_page_footer
}
write_issues() {
touch $ISSUES_PATH/stamp
for ISSUE in ${ISSUES} ; do
PAGE=$ISSUES_PATH/${ISSUE}_issue.html
create_issue $ISSUE
done
cd $ISSUES_PATH
for FILE in *.html ; do
# if issue is older than stamp file...
if [ $FILE -ot stamp ] ; then
rm $FILE
fi
done
rm stamp
cd - > /dev/null
}
parse_issues() {
ISSUES=$(cat ${ISSUES_YML} | /srv/jenkins/bin/shyaml keys)
for ISSUE in ${ISSUES} ; do
echo " Issue = ${ISSUE}"
for PROPERTY in url description ; do
VALUE="$(cat ${ISSUES_YML} | /srv/jenkins/bin/shyaml get-value ${ISSUE}.${PROPERTY} )"
if [ "$VALUE" != "" ] ; then
case $PROPERTY in
url) ISSUES_URL[${ISSUE}]=$VALUE
echo " $PROPERTY = $VALUE"
;;
description) ISSUES_DESCRIPTION[${ISSUE}]=$VALUE
show_multi_values "$VALUE"
;;
esac
fi
done
done
}
write_notes() {
touch $NOTES_PATH/stamp
for PKG in $PACKAGES_WITH_NOTES ; do
PAGE=$NOTES_PATH/${PKG}_note.html
create_pkg_note $PKG
done
cd $NOTES_PATH
for FILE in *.html ; do
PKG_FILE=/var/lib/jenkins/userContent/rb-pkg/${FILE:0:-10}.html
# if note was removed...
if [ $FILE -ot stamp ] ; then
# cleanup old notes
rm $FILE
# force re-creation of package file if there was a note
rm ${PKG_FILE}
else
# ... else re-recreate ${PKG_FILE} if it does not contain a link to the note
grep _note.html ${PKG_FILE} > /dev/null || rm ${PKG_FILE}
fi
done
rm stamp
cd - > /dev/null
}
parse_notes() {
PACKAGES_WITH_NOTES=$(cat ${PACKAGES_YML} | /srv/jenkins/bin/shyaml keys)
for PKG in $PACKAGES_WITH_NOTES ; do
echo " Package = ${PKG}"
NOTES_PACKAGE[${PKG}]=" notes "
for PROPERTY in version issues bugs comments ; do
VALUE="$(cat ${PACKAGES_YML} | /srv/jenkins/bin/shyaml get-value ${PKG}.${PROPERTY} )"
if [ "$VALUE" != "" ] ; then
case $PROPERTY in
version) NOTES_VERSION[${PKG}]=$VALUE
echo " $PROPERTY = $VALUE"
;;
issues) NOTES_ISSUES[${PKG}]=$VALUE
show_multi_values "$VALUE"
;;
bugs) NOTES_BUGS[${PKG}]=$VALUE
show_multi_values "$VALUE"
;;
comments) NOTES_COMMENTS[${PKG}]=$VALUE
show_multi_values "$VALUE"
;;
esac
fi
done
done
}
validate_yaml() {
VALID_YAML=true
set +e
cat $1 | /srv/jenkins/bin/shyaml keys > /dev/null 2>&1 || VALID_YAML=false
cat $1 | /srv/jenkins/bin/shyaml get-values > /dev/null 2>&1 || VALID_YAML=false
set -e
echo "$1 is valid yaml: $VALID_YAML"
}
#
# end note parsing functions...
#
mkdir -p /var/lib/jenkins/userContent/rb-pkg/
write_page() {
echo "$1" >> $PAGE
}
set_icon() {
# icons taken from tango-icon-theme (0.8.90-5)
# licenced under http://creativecommons.org/licenses/publicdomain/
STATE_TARGET_NAME="$1"
case "$1" in
reproducible) ICON=weather-clear.png
;;
unreproducible|FTBR*) if [ "$2" != "" ] ; then
ICON=weather-showers-scattered.png
STATE_TARGET_NAME=FTBR_with_buildinfo
else
ICON=weather-showers.png
STATE_TARGET_NAME=FTBR
fi
;;
FTBFS) ICON=weather-storm.png
;;
404) ICON=weather-severe-alert.png
;;
not_for_us|"not for us") ICON=weather-few-clouds-night.png
STATE_TARGET_NAME="not_for_us"
;;
blacklisted) ICON=error.png
;;
*) ICON=""
esac
}
write_icon() {
# ICON and STATE_TARGET_NAME are set by set_icon()
write_page ""
}
init_pkg_page() {
echo "" > ${PKG_FILE}
echo "" >> ${PKG_FILE}
echo "$1 - reproducible builds results" >> ${PKG_FILE}
echo "
$COUNT_TOTAL packages have been attempted to be 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 packages should be reproducibly buildable!"
if [ "${1:0:3}" = "all" ] || [ "$1" = "dd-list" ] ; then
write_page " Join #debian-reproducible on OFTC to get support for making sure your packages build reproducibly too!"
fi
write_page "
"
write_page "
Other views for these build results:
"
for MY_STATE in $ALLSTATES ; do
WITH=""
if [ "$MY_STATE" = "FTBR_with_buildinfo" ] ; then
WITH="YES"
fi
set_icon $MY_STATE $WITH
write_page "
"
write_icon
write_page "
"
done
for TARGET in issues notes $ALLVIEWS dd-list stats ; do
if [ "$TARGET" = "$1" ] ; then
continue
elif [ "$TARGET" = "issues" ] || [ "$TARGET" = "stats" ]; then
SPOKEN_TARGET=$TARGET
else
SPOKEN_TARGET=${SPOKENTARGET[$TARGET]}
fi
write_page "
An underlined package is an indication that this package has a note. Visited packages are linked in green, those which have not been visited are linked in blue."
if $BETA_SIGN ; then
write_page "A β sign after a package which is unreproducible indicates that a .buildinfo file was generated."
write_page "And that means the basics for building packages reproducibly are covered."
fi
write_page "
"
}
publish_page() {
cp $PAGE /var/lib/jenkins/userContent/
if [ "$VIEW" = "$MAINVIEW" ] ; then
cp $PAGE /var/lib/jenkins/userContent/reproducible.html
fi
rm $PAGE
}
#
# actually parse the notes
#
validate_yaml ${ISSUES_YML}
validate_yaml ${PACKAGES_YML}
if $VALID_YAML ; then
parse_issues
parse_notes
process_packages ${PACKAGES_WITH_NOTES}
force_package_targets ${PACKAGES_WITH_NOTES}
write_issues
write_notes
else
echo "Warning: ${ISSUES_YML} or ${PACKAGES_YML} contains invalid yaml, please fix."
fi
#
# actually build the package pages
#
echo "Processing $COUNT_TOTAL packages... this will take a while."
BUILDINFO_SIGNS=true
process_packages ${BAD["all"]}
BUILDINFO_SIGNS=false
process_packages ${UGLY["all"]} ${GOOD["all"]} ${SOURCELESS["all"]} ${NOTFORUS["all"]} $BLACKLISTED
for VIEW in $ALLVIEWS ; do
BETA_SIGN=false
PAGE=index_${VIEW}.html
echo "Starting to write $PAGE page."
write_page_header $VIEW "Overview of reproducible builds of ${SPOKENTARGET[$VIEW]}"
if [ "${VIEW:0:3}" = "all" ] ; then
FINISH=":"
else
SHORTER_SPOKENTARGET=$(echo ${SPOKENTARGET[$VIEW]} | cut -d "(" -f1)
FINISH=", from $SHORTER_SPOKENTARGET these were:"
fi
write_page "
"
set_icon unreproducible with
write_icon
set_icon unreproducible
write_icon
write_page "$COUNT_BAD packages ($PERCENT_BAD% of $COUNT_TOTAL) failed to built reproducibly in total$FINISH "
link_packages ${BAD[$VIEW]}
write_page "
"
write_page
write_page "
"
set_icon FTBFS
write_icon
write_page "$COUNT_UGLY packages ($PERCENT_UGLY%) failed to build from source in total$FINISH "
link_packages ${UGLY[$VIEW]}
write_page "
"
if [ "${VIEW:0:3}" = "all" ] && [ $COUNT_SOURCELESS -gt 0 ] ; then
write_page "
For "
set_icon 404
write_icon
write_page "$COUNT_SOURCELESS ($PERCENT_SOURCELESS%) packages in total sources could not be downloaded: ${SOURCELESS[$VIEW]}
"
fi
if [ "${VIEW:0:3}" = "all" ] && [ $COUNT_NOTFORUS -gt 0 ] ; then
write_page "
In total there were "
set_icon not_for_us
write_icon
write_page "$COUNT_NOTFORUS ($PERCENT_NOTFORUS%) packages which are neither Architecture: 'any', 'all', 'amd64', 'linux-any', 'linux-amd64' nor 'any-amd64': ${NOTFORUS[$VIEW]}
"
fi
if [ "${VIEW:0:3}" = "all" ] && [ $COUNT_BLACKLISTED -gt 0 ] ; then
write_page "
"
set_icon blacklisted
write_icon
write_page "$COUNT_BLACKLISTED packages are blacklisted and will never be tested here: $BLACKLISTED
The following maintainers and uploaders are listed for packages which have built unreproducibly:
"
while IFS= read -r LINE ; do
if [ "${LINE:0:3}" = " " ] ; then
PACKAGE=$(echo "${LINE:3}" | cut -d " " -f1)
UPLOADERS=$(echo "${LINE:3}" | cut -d " " -f2-)
if [ "$UPLOADERS" = "$PACKAGE" ] ; then
UPLOADERS=""
fi
write_page " $PACKAGE $UPLOADERS"
else
LINE="$(echo $LINE | sed 's#\&#g ; s#<#\<#g ; s#>#\>#g')"
write_page "$LINE"
fi
done < $TMPFILE
write_page "
"
rm $TMPFILE
write_page_footer
publish_page
#
# create stats
#
# FIXME: we only do stats up until yesterday... we also could do today too but not update the db yet...
DATE=$(date -d "1 day ago" '+%Y-%m-%d')
TABLE[0]=stats_pkg_state
TABLE[1]=stats_builds_per_day
TABLE[2]=stats_builds_age
RESULT=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT datum,suite from ${TABLE[0]} WHERE datum = \"$DATE\" AND suite = \"$SUITE\"")
if [ -z $RESULT ] ; then
ALL=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(name) from sources")
GOOD=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'reproducible' AND date(build_date)<='$DATE';")
GOOAY=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'reproducible' AND date(build_date)='$DATE';")
BAD=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'unreproducible' AND date(build_date)<='$DATE';")
BAAY=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'unreproducible' AND date(build_date)='$DATE';")
UGLY=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'FTBFS' AND date(build_date)<='$DATE';")
UGLDAY=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'FTBFS' AND date(build_date)='$DATE';")
REST=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE (status != 'FTBFS' AND status != 'FTBFS' AND status != 'unreproducible' AND status != 'reproducible') AND date(build_date)<='$DATE';")
RESDAY=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE (status != 'FTBFS' AND status != 'FTBFS' AND status != 'unreproducible' AND status != 'reproducible') AND date(build_date)='$DATE';")
OLDESTG=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT build_date FROM source_packages WHERE status = 'reproducible' AND NOT date(build_date)>='$DATE' ORDER BY build_date LIMIT 1;")
OLDESTB=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT build_date FROM source_packages WHERE status = 'unreproducible' AND NOT date(build_date)>='$DATE' ORDER BY build_date LIMIT 1;")
OLDESTU=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT build_date FROM source_packages WHERE status = 'FTBFS' AND NOT date(build_date)>='$DATE' ORDER BY build_date LIMIT 1;")
DIFFG=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT julianday('$DATE') - julianday('$OLDESTG');")
if [ -z $DIFFG ] ; then DIFFG=0 ; fi
DIFFB=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT julianday('$DATE') - julianday('$OLDESTB');")
if [ -z $DIFFB ] ; then DIFFB=0 ; fi
DIFFU=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT julianday('$DATE') - julianday('$OLDESTU');")
if [ -z $DIFFU ] ; then DIFFU=0 ; fi
let "TOTAL=GOOD+BAD+UGLY+REST"
let "UNTESTED=ALL-TOTAL"
sqlite3 -init ${INIT} ${PACKAGES_DB} "INSERT INTO ${TABLE[0]} VALUES (\"$DATE\", \"$SUITE\", $UNTESTED, $GOOD, $BAD, $UGLY, $REST)"
sqlite3 -init ${INIT} ${PACKAGES_DB} "INSERT INTO ${TABLE[1]} VALUES (\"$DATE\", \"$SUITE\", $GOOAY, $BAAY, $UGLDAY, $RESDAY)"
sqlite3 -init ${INIT} ${PACKAGES_DB} "INSERT INTO ${TABLE[2]} VALUES (\"$DATE\", \"$SUITE\", \"$DIFFG\", \"$DIFFB\", \"$DIFFU\")"
fi
redo_png() {
FIELDS[0]="datum, reproducible, unreproducible, FTBFS, other, untested"
FIELDS[1]="datum, reproducible, unreproducible, FTBFS, other"
FIELDS[2]="datum, oldest_reproducible, oldest_unreproducible, oldest_FTBFS"
COLOR[0]=5
COLOR[1]=4
COLOR[2]=3
MAINLABEL[0]="Package reproducibility status"
MAINLABEL[1]="Amout of packages build each day"
MAINLABEL[2]="Age in days of oldest kind of logfile"
YLABEL[0]="Amount (total)"
YLABEL[1]="Amount (per day)"
YLABEL[2]="Age in days"
echo "${FIELDS[$i]}" > ${TABLE[$i]}.csv
sqlite3 -init ${INIT} -csv ${PACKAGES_DB} "SELECT ${FIELDS[$i]} from ${TABLE[$i]} WHERE suite = '$SUITE' ORDER BY datum" >> ${TABLE[$i]}.csv
/srv/jenkins/bin/make_graph.py ${TABLE[$i]}.csv ${TABLE[$i]}.png ${COLOR[$i]} "${MAINLABEL[$i]}" "${YLABEL[$i]}"
rm ${TABLE[$i]}.csv
mv ${TABLE[$i]}.png /var/lib/jenkins/userContent/
}
VIEW=stats
PAGE=index_${VIEW}.html
echo "Starting to write $PAGE page."
write_page_header $VIEW "Overview of ${SPOKENTARGET[$VIEW]}"
write_page "
"
set_icon reproducible
write_icon
write_page "$COUNT_GOOD packages ($PERCENT_GOOD%) successfully built reproducibly."
set_icon unreproducible with
write_icon
set_icon unreproducible
write_icon
write_page "$COUNT_BAD packages ($PERCENT_BAD%) failed to built reproducibly."
set_icon FTBFS
write_icon
write_page "$COUNT_UGLY packages ($PERCENT_UGLY%) failed to build from source.
"
write_page "
"
if [ $COUNT_SOURCELESS -gt 0 ] ; then
write_page "For "
set_icon 404
write_icon
write_page "$COUNT_SOURCELESS ($PERCENT_SOURCELESS%) packages sources could not be downloaded,"
fi
set_icon not_for_us
write_icon
write_page "$COUNT_NOTFORUS ($PERCENT_NOTFORUS%) packages which are neither Architecture: 'any', 'all', 'amd64', 'linux-any', 'linux-amd64' nor 'any-amd64' will never be build here"
write_page "and those "
set_icon blacklisted
write_icon
write_page "$COUNT_BLACKLISTED blacklisted packages neither.
"
write_page "
"
# FIXME: we don't do stats_builds_age.png yet :/
for i in 0 1 ; do
# redo pngs once a day
if [ ! -f /var/lib/jenkins/userContent/${TABLE[$i]}.png ] || [ -z $(find /var/lib/jenkins/userContent -maxdepth 1 -mtime -1 -name ${TABLE[$i]}.png) ] ; then
redo_png
fi
write_page " "
done
write_page "