From: Luca Falavigna Date: Sun, 1 Aug 2010 15:35:01 +0000 (+0000) Subject: rm.py: implement rfc822 removal format X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07f3f331e6af450db938463ee04d8cf25bdf6531;p=dak rm.py: implement rfc822 removal format Signed-off-by: Luca Falavigna --- diff --git a/config/debian/dak.conf b/config/debian/dak.conf index 2f21c6be..98da875c 100644 --- a/config/debian/dak.conf +++ b/config/debian/dak.conf @@ -112,6 +112,7 @@ Rm MyEmailAddress "Debian Archive Maintenance "; LogFile "/srv/ftp.debian.org/web/removals.txt"; + LogFile822 "/srv/ftp.debian.org/web/removals.822"; Bcc "removed-packages@qa.debian.org"; }; diff --git a/dak/rm.py b/dak/rm.py index d7697fa4..2d502e08 100755 --- a/dak/rm.py +++ b/dak/rm.py @@ -44,6 +44,7 @@ import os import sys import apt_pkg import apt_inst +from re import sub from daklib.config import Config from daklib.dbconn import * @@ -505,6 +506,37 @@ def main (): logfile.write("----------------------------------------------\n") logfile.flush() + # Do the same in rfc822 format + logfile822 = utils.open_file(cnf["Rm::LogFile822"], 'a') + logfile822.write("Date: %s\n" % date) + logfile822.write("Ftpmaster: %s\n" % whoami) + logfile822.write("Suite: %s\n" % suites_list) + sources = [] + binaries = [] + for package in summary.split("\n"): + for row in package.split("\n"): + element = row.split("|") + if len(element) == 3: + if element[2].find("source") > 0: + sources.append("%s_%s" % tuple(elem.strip(" ") for elem in element[:2])) + element[2] = sub("source\s?,?", "", element[2]).strip(" ") + if len(element[2]): + binaries.append("%s_%s [%s]" % tuple(elem.strip(" ") for elem in element)) + if len(sources): + logfile822.write("Sources:\n") + for source in sources: + logfile822.write(" %s\n" % source) + if len(binaries): + logfile822.write("Binaries:\n") + for binary in binaries: + logfile822.write(" %s\n" % binary) + logfile822.write("Reason: %s\n" % (Options["Reason"])) + if Options["Done"]: + logfile822.write("Bug: %s\n" % (Options["Done"])) + logfile822.write("\n") + logfile822.flush() + logfile822.close() + dsc_type_id = get_override_type('dsc', session).overridetype_id deb_type_id = get_override_type('deb', session).overridetype_id