]> git.decadent.org.uk Git - dak.git/commitdiff
changes: fix known_changes handling of parsed changes files
authorFrank Lichtenheld <djpig@debian.org>
Fri, 30 Oct 2009 22:18:33 +0000 (22:18 +0000)
committerFrank Lichtenheld <djpig@debian.org>
Fri, 30 Oct 2009 22:18:33 +0000 (22:18 +0000)
Some fields in the changes file are stored as dicts, so handle
them correctly here where we only want the string.

Signed-off-by: Frank Lichtenheld <djpig@debian.org>
daklib/changes.py

index 269417f960df8e6576ac3faf6e7b1570c8f7cb02..596b74618b85bfd9adef2579f8724b528bfd6ca7 100755 (executable)
@@ -197,24 +197,31 @@ class Changes(object):
 
         self.mark_missing_fields()
 
+        multivalues = {}
+        for key in ("distribution", "architecture", "binary"):
+            if isinstance(self.changes[key], dict):
+                multivalues[key] = ", ".join(self.changes[key].keys())
+            else:
+                multivalues[key] = self.changes[key].keys()
+
         session.execute(
             """INSERT INTO known_changes
               (changesname, seen, source, binaries, architecture, version,
               distribution, urgency, maintainer, fingerprint, changedby, date)
               VALUES (:changesfile,:filetime,:source,:binary, :architecture,
               :version,:distribution,:urgency,:maintainer,:fingerprint,:changedby,:date)""",
-              { 'changesfile':self.changes_file,
-                'filetime':filetime,
-                'source':self.changes["source"],
-                'binary':self.changes["binary"],
-                'architecture':self.changes["architecture"],
-                'version':self.changes["version"],
-                'distribution':self.changes["distribution"],
-                'urgency':self.changes["urgency"],
-                'maintainer':self.changes["maintainer"],
-                'fingerprint':self.changes["fingerprint"],
-                'changedby':self.changes["changed-by"],
-                'date':self.changes["date"]} )
+              { 'changesfile':  self.changes_file,
+                'filetime':     filetime,
+                'source':       self.changes["source"],
+                'binary':       multivalues["binary"],
+                'architecture': multivalues["architecture"],
+                'version':      self.changes["version"],
+                'distribution': multivalues["distribution"],
+                'urgency':      self.changes["urgency"],
+                'maintainer':   self.changes["maintainer"],
+                'fingerprint':  self.changes["fingerprint"],
+                'changedby':    self.changes["changed-by"],
+                'date':         self.changes["date"]} )
 
     def unknown_files_fields(self, name):
         return sorted(list( set(self.files[name].keys()) -