From b4a5f1add31bafc6170216ac5a00c9c8a6d6a026 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Tue, 13 Jan 2015 19:38:23 +0100 Subject: reproducible: use the python script to build the package pages for now this leaves a simple sh wrapper inside reproducible_common.sh to avoid changing all scripts. --- bin/reproducible_common.sh | 80 ++++++---------------------------------------- 1 file changed, 9 insertions(+), 71 deletions(-) diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh index 16eb991d..7497fe8b 100755 --- a/bin/reproducible_common.sh +++ b/bin/reproducible_common.sh @@ -327,80 +327,18 @@ link_packages() { done } -init_pkg_page() { - echo "" > ${PKG_FILE} - echo "" >> ${PKG_FILE} - echo "$1 - reproducible builds results" >> ${PKG_FILE} - echo "
$1 $2" >> ${PKG_FILE} - set_icon "$3" $5 # this sets $STATE_TARGET_NAME and $ICON - echo "\"${STATE_TARGET_NAME}" >> ${PKG_FILE} - echo "at $4: " >> ${PKG_FILE} -} - -append2pkg_page() { - echo "$1" >> ${PKG_FILE} -} - -finish_pkg_page() { - echo "reproducible builds
" >> ${PKG_FILE} - echo "" >> ${PKG_FILE} - echo "" >> ${PKG_FILE} -} - process_packages() { + string='[' + delimiter='' for PKG in $@ ; do - RESULT=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT build_date,version,status FROM source_packages WHERE name = \"$PKG\"") - BUILD_DATE=$(echo $RESULT|cut -d "|" -f1) - # version with epoch removed - EVERSION=$(echo $RESULT | cut -d "|" -f2 | cut -d ":" -f2) - # 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 - if [ ! -f ${PKG_FILE} ] || [ "$OLD_FILE" != "" ] ; then - VERSION=$(echo $RESULT | cut -d "|" -f2) - STATUS=$(echo $RESULT | cut -d "|" -f3) - MAINLINK="" - NOTES_LINK="" - if [ -f ${NOTES_PATH}/${PKG}_note.html ] ; then - NOTES_LINK=" notes " - fi - set_package_star - if [ -f "/var/lib/jenkins/userContent/buildinfo/${PKG}_${EVERSION}_amd64.buildinfo" ] ; then - STAR="has buildinfo" - touch /var/lib/jenkins/userContent/buildinfo/${PKG}_.buildinfo - fi - init_pkg_page "$PKG" "$VERSION" "$STATUS" "$BUILD_DATE" "$STAR" - append2pkg_page "${NOTES_LINK}" - if [ -f "/var/lib/jenkins/userContent/buildinfo/${PKG}_${EVERSION}_amd64.buildinfo" ] ; then - append2pkg_page " buildinfo " - MAINLINK="/buildinfo/${PKG}_${EVERSION}_amd64.buildinfo" - fi - if [ -f "/var/lib/jenkins/userContent/dbd/${PKG}_${EVERSION}.debbindiff.html" ] ; then - append2pkg_page " debbindiff " - MAINLINK="/dbd/${PKG}_${EVERSION}.debbindiff.html" - fi - RBUILD_LOG="rbuild/${PKG}_${EVERSION}.rbuild.log" - if [ -f "/var/lib/jenkins/userContent/${RBUILD_LOG}" ] ; then - SIZE=$(du -sh "/var/lib/jenkins/userContent/${RBUILD_LOG}" |cut -f1) - append2pkg_page " rbuild ($SIZE) " - if [ "$MAINLINK" = "" ] ; then - MAINLINK="/${RBUILD_LOG}" - fi - fi - append2pkg_page " PTS " - append2pkg_page " BTS " - append2pkg_page " sources " - append2pkg_page " debian/rules " - - if [ ! -z "${NOTES_LINK}" ] ; then - MAINLINK="/notes/${PKG}_note.html" - fi - finish_pkg_page "$MAINLINK" - fi + string+="${delimiter}\"${PKG}\"" + delimiter=',' done + string+=']' + CWD=$(pwd) + cd /srv/jenkins/bin + python3 -c "from reproducible_html_packages import process_packages; process_packages(${string})" + cd "$CWD" } gather_schedule_stats() { -- cgit v1.2.3-70-g09d2