From 84640e4619e6e57191450a1e261acea4f5bec99e Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sat, 19 Dec 2015 12:40:27 +0100 Subject: reproducible archlinux+rpms: refactor --- bin/reproducible_html_archlinux.sh | 43 +++++++++++++++++++------------------- bin/reproducible_html_rpms.sh | 21 ++++++++++--------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/bin/reproducible_html_archlinux.sh b/bin/reproducible_html_archlinux.sh index 1774127b..82e6b4a0 100755 --- a/bin/reproducible_html_archlinux.sh +++ b/bin/reproducible_html_archlinux.sh @@ -45,7 +45,8 @@ for REPOSITORY in $ARCHLINUX_REPOS ; do 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 + ARCHLINUX_PKG_PATH=$ARCHBASE/$REPOSITORY/$PKG + if [ -z "$(cd $ARCHLINUX_PKG_PATH ; ls)" ] ; then # directory exists but is empty: package is building… echo "$(date -u ) - ignoring $PKG from '$REPOSITORY' which is building right now…" continue @@ -55,59 +56,59 @@ for REPOSITORY in $ARCHLINUX_REPOS ; do 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: failed to prepare transaction \(conflicting dependencies\)' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then + if [ -z "$(cd $ARCHLINUX_PKG_PATH/ ; ls *.pkg.tar.xz.html 2>/dev/null)" ] ; then + if [ ! -z "$(egrep '^error: failed to prepare transaction \(conflicting dependencies\)' $ARCHLINUX_PKG_PATH/build1.log)" ] ; then HTML_TARGET=${HTML_DEPWAIT[0]} let NR_DEPWAIT+=1 echo " \"depwait could not resolve dependencies as there are conflicts" >> $HTML_BUFFER - elif [ ! -z "$(egrep '(==> ERROR: Could not resolve all dependencies|==> ERROR: .pacman. failed to install missing dependencies)' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then + elif [ ! -z "$(egrep '(==> ERROR: Could not resolve all dependencies|==> ERROR: .pacman. failed to install missing dependencies)' $ARCHLINUX_PKG_PATH/build1.log)" ] ; then HTML_TARGET=${HTML_DEPWAIT[1]} 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 + elif [ ! -z "$(egrep '(==> ERROR: Failure while downloading|==> ERROR: One or more PGP signatures could not be verified)' $ARCHLINUX_PKG_PATH/build1.log)" ] ; then HTML_TARGET=${HTML_404[0]} EXTRA_REASON="" let NR_404+=1 - if [ ! -z "$(grep 'FAILED (unknown public key' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then + if [ ! -z "$(grep 'FAILED (unknown public key' $ARCHLINUX_PKG_PATH/build1.log)" ] ; then HTML_TARGET=${HTML_404[6]} EXTRA_REASON="to verify source with PGP due to unknown public key" - elif [ ! -z "$(grep 'The requested URL returned error: 404' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then + elif [ ! -z "$(grep 'The requested URL returned error: 404' $ARCHLINUX_PKG_PATH/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 + elif [ ! -z "$(grep 'The requested URL returned error: 403' $ARCHLINUX_PKG_PATH/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 + elif [ ! -z "$(grep 'The requested URL returned error: 500' $ARCHLINUX_PKG_PATH/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 + elif [ ! -z "$(grep 'The requested URL returned error: 503' $ARCHLINUX_PKG_PATH/build1.log)" ] ; then HTML_TARGET=${HTML_404[5]} EXTRA_REASON="with 503 - service unavailable" - elif [ ! -z "$(egrep '==> ERROR: One or more PGP signatures could not be verified' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then + elif [ ! -z "$(egrep '==> ERROR: One or more PGP signatures could not be verified' $ARCHLINUX_PKG_PATH/build1.log)" ] ; then HTML_TARGET=${HTML_404[7]} EXTRA_REASON="to verify source with PGP signatures" - elif [ ! -z "$(grep 'SSL certificate problem: unable to get local issuer certificate' $ARCHBASE/$REPOSITORY/$PKG/build1.log)" ] ; then + elif [ ! -z "$(grep 'SSL certificate problem: unable to get local issuer certificate' $ARCHLINUX_PKG_PATH/build1.log)" ] ; then HTML_TARGET=${HTML_404[1]} EXTRA_REASON="with SSL certificate problem" 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 + elif [ ! -z "$(egrep '==> ERROR: One or more files did not pass the validity check' $ARCHLINUX_PKG_PATH/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 + elif [ ! -z "$(egrep '(==> ERROR: install file .* does not exist or is not a regular file|==> ERROR: The download program wget is not installed)' $ARCHLINUX_PKG_PATH/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 + elif [ ! -z "$(egrep '==> ERROR: A failure occurred in check' $ARCHLINUX_PKG_PATH/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 + elif [ ! -z "$(egrep '==> ERROR: A failure occurred in (build|package)' $ARCHLINUX_PKG_PATH/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 + elif [ ! -z "$(egrep 'makepkg was killed by timeout after' $ARCHLINUX_PKG_PATH/build1.log)" ] ; then HTML_TARGET=${HTML_FTBFS[4]} let NR_FTBFS+=1 echo " \"ftbfs failed to build, killed by timeout" >> $HTML_BUFFER @@ -120,15 +121,15 @@ for REPOSITORY in $ARCHLINUX_REPOS ; do else HTML_TARGET=$HTML_FTBR let NR_FTBR+=1 - for ARTIFACT in $(cd $ARCHBASE/$REPOSITORY/$PKG/ ; ls *.pkg.tar.xz.html) ; do + for ARTIFACT in $(cd $ARCHLINUX_PKG_PATH/ ; 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 + echo " $(LANG=C TZ=UTC ls --full-time $ARCHLINUX_PKG_PATH/build1.log | cut -d ' ' -f6 )" >> $HTML_BUFFER for LOG in build1.log build2.log ; do - if [ -f $ARCHBASE/$REPOSITORY/$PKG/$LOG ] ; then - get_filesize $ARCHBASE/$REPOSITORY/$PKG/$LOG + if [ -f $ARCHLINUX_PKG_PATH/$LOG ] ; then + get_filesize $ARCHLINUX_PKG_PATH/$LOG echo " $LOG ($SIZE)" >> $HTML_BUFFER else echo "  " >> $HTML_BUFFER diff --git a/bin/reproducible_html_rpms.sh b/bin/reproducible_html_rpms.sh index cf16c6d9..d14e0720 100755 --- a/bin/reproducible_html_rpms.sh +++ b/bin/reproducible_html_rpms.sh @@ -36,7 +36,8 @@ NR_GOOD=0 NR_UNKNOWN=0 TOTAL=$(cat ${RPM_PKGS}_$RELEASE | sed -s "s# #\n#g" | wc -l) for PKG in $(find $RPMBASE/$RELEASE/$ARCH/* -maxdepth 1 -type d -exec basename {} \;|sort -u -f) ; do - if [ -z "$(cd $RPMBASE/$RELEASE/$ARCH/$PKG/ ; ls)" ] ; then + RPM_PKG_PATH=$RPMBASE/$RELEASE/$ARCH/$PKG + if [ -z "$(cd $RPM_PKG_PATH/ ; ls)" ] ; then # directory exists but is empty: package is building… echo "$(date -u ) - ignoring $PKG from '$RELEASE' ($ARCH) which is building right now…" continue @@ -45,20 +46,20 @@ for PKG in $(find $RPMBASE/$RELEASE/$ARCH/* -maxdepth 1 -type d -exec basename { echo " " >> $HTML_BUFFER echo " $PKG" >> $HTML_BUFFER echo " " >> $HTML_BUFFER - if [ -z "$(cd $RPMBASE/$RELEASE/$ARCH/$PKG/ ; ls *.rpm.html 2>/dev/null)" ] ; then - if [ ! -z "$(egrep '^DEBUG: Error: No Package found for' $RPMBASE/$RELEASE/$ARCH/$PKG/build1.log)" ] ; then + if [ -z "$(cd $RPM_PKG_PATH/ ; ls *.rpm.html 2>/dev/null)" ] ; then + if [ ! -z "$(egrep '^DEBUG: Error: No Package found for' $RPM_PKG_PATH/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' $RPMBASE/$RELEASE/$ARCH/$PKG/build1.log)" ] ; then + elif [ ! -z "$(egrep '==> ERROR: Failure while downloading' $RPM_PKG_PATH/build1.log)" ] ; then HTML_TARGET=$HTML_404 let NR_404+=1 echo " \"404 failed to download source" >> $HTML_BUFFER - elif [ ! -z "$(egrep '^ERROR: Command failed. See logs for output.' $RPMBASE/$RELEASE/$ARCH/$PKG/build1.log)" ] ; then + elif [ ! -z "$(egrep '^ERROR: Command failed. See logs for output.' $RPM_PKG_PATH/build1.log)" ] ; then HTML_TARGET=$HTML_FTBFS let NR_FTBFS+=1 echo " \"ftbfs failed to build" >> $HTML_BUFFER - elif [ ! -z "$(egrep 'mock was killed by timeout after' $RPMBASE/$RELEASE/$ARCH/$PKG/build1.log)" ] ; then + elif [ ! -z "$(egrep 'mock was killed by timeout after' $RPM_PKG_PATH/build1.log)" ] ; then HTML_TARGET=$HTML_FTBFS let NR_FTBFS+=1 echo " \"ftbfs killed by timeout" >> $HTML_BUFFER @@ -71,15 +72,15 @@ for PKG in $(find $RPMBASE/$RELEASE/$ARCH/* -maxdepth 1 -type d -exec basename { else HTML_TARGET=$HTML_FTBR let NR_FTBR+=1 - for ARTIFACT in $(cd $RPMBASE/$RELEASE/$ARCH/$PKG/ ; ls *.rpm.html) ; do + for ARTIFACT in $(cd $RPM_PKG_PATH/ ; ls *.rpm.html) ; do echo " \"unreproducible ${ARTIFACT:0:-5} is unreproducible
" >> $HTML_BUFFER done fi echo " " >> $HTML_BUFFER - echo " $(LANG=C TZ=UTC ls --full-time $RPMBASE/$RELEASE/$ARCH/$PKG/build1.log | cut -d ' ' -f6 )" >> $HTML_BUFFER + echo " $(LANG=C TZ=UTC ls --full-time $RPM_PKG_PATH/build1.log | cut -d ' ' -f6 )" >> $HTML_BUFFER for LOG in build1.log build2.log ; do - if [ -f $RPMBASE/$RELEASE/$ARCH/$PKG/$LOG ] ; then - get_filesize $RPMBASE/$RELEASE/$ARCH/$PKG/$LOG + if [ -f $RPM_PKG_PATH/$LOG ] ; then + get_filesize $RPM_PKG_PATH/$LOG echo " $LOG ($SIZE)" >> $HTML_BUFFER else echo "  " >> $HTML_BUFFER -- cgit v1.2.3-70-g09d2