diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2015-01-13 19:38:23 +0100 |
---|---|---|
committer | Mattia Rizzolo <mattia@mapreri.org> | 2015-01-13 19:41:09 +0100 |
commit | b4a5f1add31bafc6170216ac5a00c9c8a6d6a026 (patch) | |
tree | 8031e7fa8d0af4d527d1983779ee182a02af90cc | |
parent | 90af1395504e7d853a5b984106598af046ec15ac (diff) | |
download | jenkins.debian.net-b4a5f1add31bafc6170216ac5a00c9c8a6d6a026.tar.xz |
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.
-rwxr-xr-x | bin/reproducible_common.sh | 80 |
1 files 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 "<!DOCTYPE html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />" > ${PKG_FILE} - echo "<link href=\"../static/style.css\" type=\"text/css\" rel=\"stylesheet\" />" >> ${PKG_FILE} - echo "<title>$1 - reproducible builds results</title></head>" >> ${PKG_FILE} - echo "<body><table class=\"head\"><tr><td><span style=\"font-size:1.2em;\">$1</span> $2" >> ${PKG_FILE} - set_icon "$3" $5 # this sets $STATE_TARGET_NAME and $ICON - echo "<a href=\"/index_${STATE_TARGET_NAME}.html\" target=\"_parent\"><img src=\"/userContent/static/$ICON\" alt=\"${STATE_TARGET_NAME} icon\" /></a>" >> ${PKG_FILE} - echo "<span style=\"font-size:0.9em;\">at $4:</span> " >> ${PKG_FILE} -} - -append2pkg_page() { - echo "$1" >> ${PKG_FILE} -} - -finish_pkg_page() { - echo "</td><td style=\"text-align:right; font-size:0.9em;\"><a href=\"/reproducible.html\" target=\"_parent\">reproducible builds</a></td></tr></table>" >> ${PKG_FILE} - echo "<iframe name=\"main\" src=\"$1\" width=\"100%\" height=\"98%\" frameborder=\"0\">" >> ${PKG_FILE} - echo "<p>Your browser does not support iframes. Use a different one or follow the links above.</p>" >> ${PKG_FILE} - echo "</iframe>" >> ${PKG_FILE} - echo "</body></html>" >> ${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=" <a href=\"/notes/${PKG}_note.html\" target=\"main\">notes</a> " - 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 " <a href=\"/buildinfo/${PKG}_${EVERSION}_amd64.buildinfo\" target=\"main\">buildinfo</a> " - MAINLINK="/buildinfo/${PKG}_${EVERSION}_amd64.buildinfo" - fi - if [ -f "/var/lib/jenkins/userContent/dbd/${PKG}_${EVERSION}.debbindiff.html" ] ; then - append2pkg_page " <a href=\"/dbd/${PKG}_${EVERSION}.debbindiff.html\" target=\"main\">debbindiff</a> " - 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 " <a href=\"/${RBUILD_LOG}\" target=\"main\">rbuild ($SIZE)</a> " - if [ "$MAINLINK" = "" ] ; then - MAINLINK="/${RBUILD_LOG}" - fi - fi - append2pkg_page " <a href=\"https://packages.qa.debian.org/${PKG}\" target=\"main\">PTS</a> " - append2pkg_page " <a href=\"https://bugs.debian.org/src:${PKG}\" target=\"main\">BTS</a> " - append2pkg_page " <a href=\"https://sources.debian.net/src/${PKG}/\" target=\"main\">sources</a> " - append2pkg_page " <a href=\"https://sources.debian.net/src/${PKG}/${VERSION}/debian/rules\" target=\"main\">debian/rules</a> " - - 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() { |