From: Frank Lichtenheld Date: Fri, 30 Oct 2009 22:18:33 +0000 (+0000) Subject: changes: fix known_changes handling of parsed changes files X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4132a247910fb05d177c5da5f9e6e80f80a12aa;p=dak changes: fix known_changes handling of parsed changes files 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 --- diff --git a/daklib/changes.py b/daklib/changes.py index 269417f9..596b7461 100755 --- a/daklib/changes.py +++ b/daklib/changes.py @@ -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()) -