#!/bin/bash # Copyright 2014-2015 Holger Levsen # released under the GPLv=2 DEBUG=false . /srv/jenkins/bin/common-functions.sh common_init "$@" # common code . /srv/jenkins/bin/reproducible_common.sh ARCHBASE=$BASE/archlinux # # analyse results to create the webpage # echo "$(date -u) - starting to analyse build results." for i in 0 1 2 3 4 ; do HTML_FTBFS[$i]=$(mktemp) done HTML_FTBR=$(mktemp -t rhtml-archlinux-XXXXXXXX) HTML_DEPWAIT=$(mktemp -t rhtml-archlinux-XXXXXXXX) for i in 0 1 2 3 4 5 6 7; do HTML_404[$i]=$(mktemp -t rhtml-archlinux-XXXXXXXX) done HTML_GOOD=$(mktemp -t rhtml-archlinux-XXXXXXXX) HTML_UNKNOWN=$(mktemp -t rhtml-archlinux-XXXXXXXX) HTML_BUFFER=$(mktemp -t rhtml-archlinux-XXXXXXXX) HTML_TARGET="" HTML_REPOSTATS=$(mktemp -t rhtml-archlinux-XXXXXXXX) for REPOSITORY in $ARCHLINUX_REPOS ; do echo "$(date -u) - starting to analyse build results for '$REPOSITORY'." TOTAL=$(cat ${ARCHLINUX_PKGS}_$REPOSITORY | sed -s "s# #\n#g" | wc -l) TESTED=0 NR_FTBFS=0 NR_FTBR=0 NR_DEPWAIT=0 NR_404=0 NR_GOOD=0 NR_UNKNOWN=0 for PKG in $(find $ARCHBASE/$REPOSITORY/* -maxdepth 1 -type d -exec basename {} \;|sort -u -f) ; do if [ -z "$(cd $ARCHBASE/$REPOSITORY/$PKG/ ; ls)" ] ; then # directory exists but is empty: package is building… echo "$(date -u ) - ignoring $PKG from '$REPOSITORY' which is building right now…" continue fi let TESTED+=1 echo " " >> $HTML_BUFFER echo " $REPOSITORY" >> $HTML_BUFFER echo " $PKG" >> $HTML_BUFFER echo " " >> $HTML_BUFFER if [ -z "$(cd $ARCHBASE/$REPOSITORY/$PKG/ ; ls *.pkg.tar.xz.html 2>/dev/null)" ] ; then if [ ! -z "$(egrep '(==> ERROR: Could not resolve all dependencies|==> ERROR: .pacman. failed to install missing dependencies)' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=$HTML_DEPWAIT let NR_DEPWAIT+=1 echo " \"depwait could not resolve dependencies" >> $HTML_BUFFER elif [ ! -z "$(egrep '(==> ERROR: Failure while downloading|==> ERROR: One or more PGP signatures could not be verified)' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_404[0]} EXTRA_REASON="" let NR_404+=1 if [ ! -z "$(grep 'SSL certificate problem: unable to get local issuer certificate' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_404[1]} EXTRA_REASON="with SSL certificate problem" elif [ ! -z "$(grep 'The requested URL returned error: 404' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_404[3]} EXTRA_REASON="with 404 - file not found" elif [ ! -z "$(grep 'The requested URL returned error: 403' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_404[2]} EXTRA_REASON="with 403 - forbidden" elif [ ! -z "$(grep 'The requested URL returned error: 500' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_404[4]} EXTRA_REASON="with 500 - internal server error" elif [ ! -z "$(grep 'The requested URL returned error: 503' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_404[5]} EXTRA_REASON="with 503 - service unavailable" elif [ ! -z "$(grep 'FAILED (unknown public key' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_404[6]} EXTRA_REASON="to verify source with PGP due to unknown public key" elif [ ! -z "$(egrep '==> ERROR: One or more PGP signatures could not be verified' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_404[7]} EXTRA_REASON="to verify source with PGP signatures" fi echo " \"404 download failed $EXTRA_REASON" >> $HTML_BUFFER elif [ ! -z "$(egrep '==> ERROR: One or more files did not pass the validity check' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_FTBFS[0]} let NR_FTBFS+=1 echo " \"ftbfs failed to verify source" >> $HTML_BUFFER elif [ ! -z "$(egrep '(==> ERROR: install file .* does not exist or is not a regular file|==> ERROR: The download program wget is not installed)' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_FTBFS[1]} let NR_FTBFS+=1 echo " \"ftbfs failed to build, requirements not met" >> $HTML_BUFFER elif [ ! -z "$(egrep '==> ERROR: A failure occurred in check' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_FTBFS[2]} let NR_FTBFS+=1 echo " \"ftbfs failed to build while running tests" >> $HTML_BUFFER elif [ ! -z "$(egrep '==> ERROR: A failure occurred in (build|package)' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_FTBFS[3]} let NR_FTBFS+=1 echo " \"ftbfs failed to build" >> $HTML_BUFFER elif [ ! -z "$(egrep 'makepkg was killed by timeout after' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then HTML_TARGET=${HTML_FTBFS[4]} let NR_FTBFS+=1 echo " \"ftbfs failed to build, killed by timeout" >> $HTML_BUFFER else echo " probably failed to build from source, please investigate" >> $HTML_BUFFER HTML_TARGET=$HTML_UNKNOWN let NR_UNKNOWN+=1 # or is it reproducible??? fi else HTML_TARGET=$HTML_FTBR let NR_FTBR+=1 for ARTIFACT in $(cd $ARCHBASE/$REPOSITORY/$PKG/ ; ls *.pkg.tar.xz.html) ; do echo " \"unreproducible ${ARTIFACT:0:-5} is unreproducible
" >> $HTML_BUFFER done fi echo " " >> $HTML_BUFFER echo " $(LANG=C TZ=UTC ls --full-time $ARCHBASE/$REPOSITORY/$PKG/build1.log | cut -d ' ' -f6 )" >> $HTML_BUFFER for LOG in build1.log build2.log ; do if [ -f $ARCHBASE/$REPOSITORY/$PKG/$LOG ] ; then echo " $LOG" >> $HTML_BUFFER else echo "  " >> $HTML_BUFFER fi done echo " " >> $HTML_BUFFER cat $HTML_BUFFER >> $HTML_TARGET rm $HTML_BUFFER > /dev/null done # prepare stats per repository PERCENT_TOTAL=$(echo "scale=1 ; ($TESTED*100/$TOTAL)" | bc) if [ $(echo $PERCENT_TOTAL/1|bc) -lt 98 ] ; then NR_TESTED="$TESTED ($PERCENT_TOTAL% of $TOTAL tested)" else NR_TESTED=$TESTED fi echo " " >> $HTML_REPOSTATS echo " $REPOSITORY$NR_TESTED" >> $HTML_REPOSTATS for i in $NR_GOOD $NR_FTBR $NR_FTBFS $NR_DEPWAIT $NR_404 $NR_UNKNOWN ; do PERCENT_i=$(echo "scale=1 ; ($i*100/$TESTED)" | bc) if [ "$PERCENT_i" != "0" ] ; then echo " $i ($PERCENT_i%)" >> $HTML_REPOSTATS else echo " $i" >> $HTML_REPOSTATS fi done echo " " >> $HTML_REPOSTATS done # # write out the actual webpage # DATE=$(date -u +'%Y-%m-%d') cd $ARCHBASE PAGE=archlinux.html echo "$(date -u) - starting to build $PAGE" cat > $PAGE <<- EOF Reproducible Arch Linux ?!

Reproducible Arch Linux?!

EOF write_page_intro 'Arch Linux' write_explaination_table 'Arch Linux' write_page " " cat $HTML_REPOSTATS >> $PAGE rm $HTML_REPOSTATS > /dev/null write_page "
repositoryall sources packagesreproducible packagesunreproducible packagespackages failing to buildpackages in depwait statepackages 404unknown state
" write_page " " for i in $HTML_UNKNOWN $(for j in 0 1 2 3 4 5 6 7 ; do echo ${HTML_404[$j]} ; done) $HTML_DEPWAIT $(for j in 0 1 2 3 4 ; do echo ${HTML_FTBFS[$j]} ; done) $HTML_FTBR $HTML_GOOD ; do cat $i >> $PAGE rm $i > /dev/null done write_page "
repositorysource packagetest resulttest date1st build log2nd build log
" write_page "
" write_page_footer 'Arch Linux' echo "$(date -u) - enjoy $REPRODUCIBLE_URL/archlinux/$PAGE"