diff options
-rwxr-xr-x | bin/reproducible_html_graphs.sh | 127 |
1 files changed, 67 insertions, 60 deletions
diff --git a/bin/reproducible_html_graphs.sh b/bin/reproducible_html_graphs.sh index 319b5d28..83eb281d 100755 --- a/bin/reproducible_html_graphs.sh +++ b/bin/reproducible_html_graphs.sh @@ -68,36 +68,40 @@ if [ -z $RESULT ] ; then fi gather_meta_stats() { - META_LIST=$(cat /srv/reproducible-results/meta_pkgsets/${META_PKGSET[$1]}.pkgset) - if [ ! -z "$META_LIST" ] ; then - META_WHERE="" - for PKG in $META_LIST ; do - if [ -z "$META_WHERE" ] ; then - META_WHERE="name in ('$PKG'" - else - META_WHERE="$META_WHERE, '$PKG'" - fi - done - META_WHERE="$META_WHERE)" + if [ -f /srv/reproducible-results/meta_pkgsets/${META_PKGSET[$1]}.pkgset ] ; then + META_LIST=$(cat /srv/reproducible-results/meta_pkgsets/${META_PKGSET[$1]}.pkgset) + if [ ! -z "$META_LIST" ] ; then + META_WHERE="" + for PKG in $META_LIST ; do + if [ -z "$META_WHERE" ] ; then + META_WHERE="name in ('$PKG'" + else + META_WHERE="$META_WHERE, '$PKG'" + fi + done + META_WHERE="$META_WHERE)" + else + META_WHERE="name = 'meta-name-does-not-exist'" + fi + COUNT_META_GOOD=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'reproducible' AND date(build_date)<='$DATE' AND $META_WHERE;") + COUNT_META_BAD=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'unreproducible' AND date(build_date)<='$DATE' AND $META_WHERE;") + COUNT_META_UGLY=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'FTBFS' AND date(build_date)<='$DATE' AND $META_WHERE;") + COUNT_META_REST=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE (status != 'FTBFS' AND status != 'unreproducible' AND status != 'reproducible') AND date(build_date)<='$DATE' AND $META_WHERE;") + META_GOOD=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT name from source_packages WHERE status = 'reproducible' AND date(build_date)<='$DATE' AND $META_WHERE;") + META_BAD=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT name from source_packages WHERE status = 'unreproducible' AND date(build_date)<='$DATE' AND $META_WHERE;") + META_UGLY=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT name from source_packages WHERE status = 'FTBFS' AND date(build_date)<='$DATE' AND $META_WHERE;") + META_REST=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT name NAME from source_packages WHERE (status != 'FTBFS' AND status != 'unreproducible' AND status != 'reproducible') AND date(build_date)<='$DATE' AND $META_WHERE;") else - META_WHERE="name = 'meta-name-does-not-exist'" + META_RESULT=false fi - COUNT_META_GOOD=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'reproducible' AND date(build_date)<='$DATE' AND $META_WHERE;") - COUNT_META_BAD=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'unreproducible' AND date(build_date)<='$DATE' AND $META_WHERE;") - COUNT_META_UGLY=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE status = 'FTBFS' AND date(build_date)<='$DATE' AND $META_WHERE;") - COUNT_META_REST=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT count(status) from source_packages WHERE (status != 'FTBFS' AND status != 'unreproducible' AND status != 'reproducible') AND date(build_date)<='$DATE' AND $META_WHERE;") - META_GOOD=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT name from source_packages WHERE status = 'reproducible' AND date(build_date)<='$DATE' AND $META_WHERE;") - META_BAD=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT name from source_packages WHERE status = 'unreproducible' AND date(build_date)<='$DATE' AND $META_WHERE;") - META_UGLY=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT name from source_packages WHERE status = 'FTBFS' AND date(build_date)<='$DATE' AND $META_WHERE;") - META_REST=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT name NAME from source_packages WHERE (status != 'FTBFS' AND status != 'unreproducible' AND status != 'reproducible') AND date(build_date)<='$DATE' AND $META_WHERE;") } for i in $(seq 1 ${#META_PKGSET[@]}) ; do - META_LIST=$(cat /srv/reproducible-results/meta_pkgsets/${META_PKGSET[$i]}.pkgset) RESULT=$(sqlite3 -init ${INIT} ${PACKAGES_DB} "SELECT datum,meta_pkg,suite from ${TABLE[6]} WHERE datum = \"$DATE\" AND suite = \"$SUITE\" AND meta_pkg = \"${META_PKGSET[$i]}\"") if [ -z $RESULT ] ; then + META_RESULT=true gather_meta_stats $i - sqlite3 -init ${INIT} ${PACKAGES_DB} "INSERT INTO ${TABLE[6]} VALUES (\"$DATE\", \"$SUITE\", \"${META_PKGSET[$i]}\", $COUNT_META_GOOD, $COUNT_META_BAD, $COUNT_META_UGLY, $COUNT_META_REST)" + ! $META_RESULT || sqlite3 -init ${INIT} ${PACKAGES_DB} "INSERT INTO ${TABLE[6]} VALUES (\"$DATE\", \"$SUITE\", \"${META_PKGSET[$i]}\", $COUNT_META_GOOD, $COUNT_META_BAD, $COUNT_META_UGLY, $COUNT_META_REST)" touch -d "$DATE 00:00" ${TABLE[6]}_${META_PKGSET[$i]}.png fi done @@ -247,50 +251,53 @@ PAGE=index_${VIEW}.html echo "$(date) - starting to write $PAGE page." write_page_header $VIEW "Overview of ${SPOKENTARGET[$VIEW]}" for i in $(seq 1 ${#META_PKGSET[@]}) ; do + META_RESULT=true gather_meta_stats $i # FIXME: this ignores unknown packages... - MAINLABEL[6]="Package reproducibility status for ${META_PKGSET[$i]} packages" - YLABEL[6]="Amount (${META_PKGSET[$i]} packages)" - PNG=${TABLE[6]}_${META_PKGSET[$i]}.png - # redo pngs once a day - if [ ! -f /var/lib/jenkins/userContent/$PNG ] || [ -z $(find /var/lib/jenkins/userContent -maxdepth 1 -mtime +0 -name $PNG) ] ; then - # FIXME: call redo_png differently here.. sux - redo_png 6 $PNG ${META_PKGSET[$i]} - fi - write_page "<p><a href=\"/userContent/$PNG\"><img src=\"/userContent/$PNG\" class=\"graph\" alt=\"${MAINLABEL[6]}\"></a>" - write_page "<br />The package set '${META_PKGSET[$i]}' consists of: <br />" - set_icon reproducible - write_icon - write_page "$COUNT_META_GOOD packages successfully built reproducibly:" - force_package_targets $META_GOOD - link_packages $META_GOOD - write_page "<br />" - set_icon unreproducible with - write_icon - write_page "$COUNT_META_BAD packages failed to built reproducibly:" - force_package_targets $META_BAD - link_packages $META_BAD - write_page "<br />" - if [ $COUNT_META_UGLY -gt 0 ] ; then - set_icon FTBFS + if $META_RESULT ; then + MAINLABEL[6]="Package reproducibility status for ${META_PKGSET[$i]} packages" + YLABEL[6]="Amount (${META_PKGSET[$i]} packages)" + PNG=${TABLE[6]}_${META_PKGSET[$i]}.png + # redo pngs once a day + if [ ! -f /var/lib/jenkins/userContent/$PNG ] || [ -z $(find /var/lib/jenkins/userContent -maxdepth 1 -mtime +0 -name $PNG) ] ; then + # FIXME: call redo_png differently here.. sux + redo_png 6 $PNG ${META_PKGSET[$i]} + fi + write_page "<p><a href=\"/userContent/$PNG\"><img src=\"/userContent/$PNG\" class=\"graph\" alt=\"${MAINLABEL[6]}\"></a>" + write_page "<br />The package set '${META_PKGSET[$i]}' consists of: <br />" + set_icon reproducible write_icon - write_page "$COUNT_META_UGLY packages failed to build from source:" - force_package_targets $META_UGLY - link_packages $META_UGLY + write_page "$COUNT_META_GOOD packages successfully built reproducibly:" + force_package_targets $META_GOOD + link_packages $META_GOOD write_page "<br />" - fi - if [ $COUNT_META_REST -gt 0 ] ; then - set_icon not_for_us - write_icon - set_icon blacklisted + set_icon unreproducible with write_icon - set_icon 404 - write_icon - write_page "$COUNT_META_REST packages are either blacklisted, not for us or cannot be downloaded:" - force_package_targets $META_REST - link_packages $META_REST + write_page "$COUNT_META_BAD packages failed to built reproducibly:" + force_package_targets $META_BAD + link_packages $META_BAD write_page "<br />" + if [ $COUNT_META_UGLY -gt 0 ] ; then + set_icon FTBFS + write_icon + write_page "$COUNT_META_UGLY packages failed to build from source:" + force_package_targets $META_UGLY + link_packages $META_UGLY + write_page "<br />" + fi + if [ $COUNT_META_REST -gt 0 ] ; then + set_icon not_for_us + write_icon + set_icon blacklisted + write_icon + set_icon 404 + write_icon + write_page "$COUNT_META_REST packages are either blacklisted, not for us or cannot be downloaded:" + force_package_targets $META_REST + link_packages $META_REST + write_page "<br />" + fi + write_page "</p>" fi - write_page "</p>" done write_page_footer publish_page |