From d47dc035b62f55afc65327c68a9285b7003053a7 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sat, 11 Oct 2014 14:00:49 +0200 Subject: reproducible: cleanup old notes, improve logic to recreate notes and package files --- TODO | 4 ---- bin/reproducible_stats.sh | 25 +++++++++++++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index 7be85541..d57432d8 100644 --- a/TODO +++ b/TODO @@ -111,10 +111,6 @@ See link:https://jenkins.debian.net/userContent/about.html["about jenkins.debian *** scheduler and builder jobs are started after * bugs -** when notes are removed the navigation pages are not updated... -*** always create notes + navi pages if note exist -*** check if package has a note which is older than navi page -> delete note -*** modify packages.yml locally to test... ** add note about notes on every page which has them... * CSS/HTML diff --git a/bin/reproducible_stats.sh b/bin/reproducible_stats.sh index e2730299..ae41ba15 100755 --- a/bin/reproducible_stats.sh +++ b/bin/reproducible_stats.sh @@ -90,7 +90,6 @@ 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 mkdir -p $NOTES_PATH -rm -f $NOTES_PATH/*.html declare -A NOTES_PACKAGE declare -A NOTES_VERSION @@ -222,6 +221,7 @@ create_pkg_note() { } parse_notes() { + touch $NOTES_PATH/stamp PACKAGES_WITH_NOTES=$(cat ${PACKAGES_YML} | /srv/jenkins/bin/shyaml keys) for PKG in $PACKAGES_WITH_NOTES ; do echo " Package = ${PKG}" @@ -248,6 +248,22 @@ parse_notes() { NOTE=$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 } validate_yaml() { @@ -348,11 +364,11 @@ process_packages() { if $BUILDINFO_SIGNS && [ -f "/var/lib/jenkins/userContent/buildinfo/${PKG}_${EVERSION}_amd64.buildinfo" ] ; then STAR[$PKG]="β" # used to be a star... fi - # only build $PKG pages if they don't exist or are older than $BUILD_DATE + # only build $PKG pages if they don't exist or are older than $BUILD_DATE or have a note PKG_FILE="/var/lib/jenkins/userContent/rb-pkg/${PKG}.html" OLD_FILE=$(find $(dirname ${PKG_FILE}) -name $(basename ${PKG_FILE}) ! -newermt "$BUILD_DATE" 2>/dev/null || true) - # if no package file exists, or is older than last build_date or if a note exist... - if [ ! -f ${PKG_FILE} ] || [ "$OLD_FILE" != "" ] || [ "${NOTES_PACKAGE[${PKG}]}" != "" ] ; then + # if no package file exists, or is older than last build_date + if [ ! -f ${PKG_FILE} ] || [ "$OLD_FILE" != "" ] ; then VERSION=$(echo $RESULT | cut -d "|" -f2) STATUS=$(echo $RESULT | cut -d "|" -f3) MAINLINK="" @@ -458,6 +474,7 @@ publish_summary() { } echo "Processing $COUNT_TOTAL packages... this will take a while." +process_packages ${PACKAGES_WITH_NOTES} BUILDINFO_SIGNS=true process_packages ${BAD["all"]} BUILDINFO_SIGNS=false -- cgit v1.2.3-70-g09d2