]> git.decadent.org.uk Git - dak.git/commitdiff
rm.py: implement rfc822 removal format
authorLuca Falavigna <dktrkranz@debian.org>
Sun, 1 Aug 2010 15:35:01 +0000 (15:35 +0000)
committerLuca Falavigna <dktrkranz@debian.org>
Sun, 1 Aug 2010 15:35:01 +0000 (15:35 +0000)
Signed-off-by: Luca Falavigna <dktrkranz@debian.org>
config/debian/dak.conf
dak/rm.py

index 2f21c6befa1110cfa9d5c6879427ed03c6611844..98da875cf185f2af03a8bda2bd9f1a52cbd44194 100644 (file)
@@ -112,6 +112,7 @@ Rm
 
    MyEmailAddress "Debian Archive Maintenance <ftpmaster@ftp-master.debian.org>";
    LogFile "/srv/ftp.debian.org/web/removals.txt";
+   LogFile822 "/srv/ftp.debian.org/web/removals.822";
    Bcc "removed-packages@qa.debian.org";
 };
 
index d7697fa426a0bd510aeb47d1921aa90fa33bb10c..2d502e08418f501352bb404aadb5633d9504c367 100755 (executable)
--- 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