[Qa-jenkins-scm] [jenkins.debian.net] 01/08: 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 at packages.debian.org

Holger Levsen holger at moszumanska.debian.org
Fri May 29 14:25:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit b691349c5e8f74ab921d88a281245aceb42b3806
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Tue May 26 21:34:43 2015 +0200

    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 at 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 d14bc47..6a166ae 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 <URL:$REPRODUCIBLE_URL/$SUITE/$ARCH/$SRCHPACKAGE>, 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 at lists.alioth.debian.org" "$SRCPACKAGE at 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 b3aa938..b294738 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 + '")'],
 }
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list