From f4132a247910fb05d177c5da5f9e6e80f80a12aa Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Fri, 30 Oct 2009 22:18:33 +0000 Subject: [PATCH] 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 --- daklib/changes.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) 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()) - -- 2.39.5