From b691349c5e8f74ab921d88a281245aceb42b3806 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Tue, 26 May 2015 21:34:43 +0200 Subject: reproducible: add another flag to the db, "notify_maintainer" to indicate that any status change on this package should be mailed to the maintainers. Also teach the build script how to handle that, emailing $pkgname@packages.debian.org --- bin/reproducible_build.sh | 10 +++++++++- bin/reproducible_db_maintenance.py | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index d14bc478..6a166aec 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -119,6 +119,13 @@ update_db_and_html() { if [ -z "$VERSION" ] ; then VERSION="None" fi + local OLD_STATUS=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT status FROM results WHERE package_id='${SRCPKGID}'") + # notification for changing status + if [ "$OLD_STATUS" != "$STATUS" ] && [ "$NOTIFY_MAINTAINER" -eq 1 ]; then + echo "More information on , feel free to reply to this email to get more help." | \ + mail -s "Reproducibly of package $SRCPACKAGE changed: $OLD_STATUS → $STATUS" \ + -a "From: reproducible-builds@lists.alioth.debian.org" "$SRCPACKAGE@packages.debian.org" + fi sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration) VALUES ('${SRCPKGID}', '$VERSION', '$STATUS', '$DATE', '$DURATION')" if [ ! -z "$DURATION" ] ; then # this happens when not 404 and not_for_us sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration) VALUES ('${SRCPACKAGE}', '${VERSION}', '${SUITE}', '${ARCH}', '${STATUS}', '${DATE}', '${DURATION}')" @@ -305,7 +312,7 @@ call_debbindiff() { } choose_package () { - local RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT s.suite, s.id, s.name, sch.date_scheduled, sch.save_artifacts, sch.notify FROM schedule AS sch JOIN sources AS s ON sch.package_id=s.id WHERE sch.date_build_started = '' ORDER BY date_scheduled LIMIT 1") + local RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT s.suite, s.id, s.name, sch.date_scheduled, sch.save_artifacts, sch.notify, s.notify_maintainer FROM schedule AS sch JOIN sources AS s ON sch.package_id=s.id WHERE sch.date_build_started = '' ORDER BY date_scheduled LIMIT 1") SUITE=$(echo $RESULT|cut -d "|" -f1) SRCPKGID=$(echo $RESULT|cut -d "|" -f2) SRCPACKAGE=$(echo $RESULT|cut -d "|" -f3) @@ -321,6 +328,7 @@ choose_package () { SCHEDULED_DATE=$(echo $RESULT|cut -d "|" -f4) SAVE_ARTIFACTS=$(echo $RESULT|cut -d "|" -f5) NOTIFY=$(echo $RESULT|cut -d "|" -f6) + NOTIFY_MAINTAINER=$(echo $RESULT|cut -d "|" -f7) if [ -z "$RESULT" ] ; then echo "No packages scheduled, sleeping 30m." sleep 30m diff --git a/bin/reproducible_db_maintenance.py b/bin/reproducible_db_maintenance.py index b3aa9385..b2947384 100755 --- a/bin/reproducible_db_maintenance.py +++ b/bin/reproducible_db_maintenance.py @@ -373,6 +373,9 @@ schema_updates = { date_request INTEGER NOT NULL)''', 'ALTER TABLE schedule ADD COLUMN scheduler TEXT', 'INSERT INTO rb_schema VALUES ("13", "' + now + '")'], + 14: [ # column to enable mail notification to maintainers + 'ALTER TABLE sources ADD COLUMN notify_maintainer INTEGER NOT NULL DEFAULT 0', + 'INSERT INTO rb_schema VALUES ("14", "' + now + '")'], } -- cgit v1.2.3-70-g09d2