X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fchanges.py;h=0fc21cb39d59b5f1326d0fdedc2be8570b4979c6;hb=f0d2550d84696caafb8e850aec533108f792ff41;hp=59c7da17d15da775e7a3e4d843f4f643e3894210;hpb=32dc9d52c53207a6524ecf63ac7866435ae40374;p=dak.git diff --git a/daklib/changes.py b/daklib/changes.py index 59c7da17..0fc21cb3 100755 --- a/daklib/changes.py +++ b/daklib/changes.py @@ -173,6 +173,49 @@ class Changes(object): return summary + def remove_known_changes(self, session=None): + if session is None: + session = DBConn().session() + privatetrans = True + + session.query(KnownChange).filter(changesfile=self.changes_file).delete() + + if privatetrans: + session.commit() + session.close() + def add_known_changes(self, queue, session=None): + cnf = Config() + + if session is None: + session = DBConn().session() + privatetrans = True + + dirpath = cnf["Dir::Queue::%s" % (queue) ] + changesfile = os.path.join(dirpath, self.changes_file) + filetime = datetime.datetime.fromtimestamp(os.path.getctime(changesfile)) + + 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,:changedby,:date)""", + { 'changesfile':changesfile, + '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"]} ) + + if privatetrans: + session.commit() + session.close() def load_dot_dak(self, changesfile): """ @@ -191,8 +234,8 @@ class Changes(object): self.dsc_files.update(p.load()) next_obj = p.load() - if type(next_obj) is DictType: - self.pkg.orig_files.update(next_obj) + if isinstance(next_obj, dict): + self.orig_files.update(next_obj) else: # Auto-convert old dak files to new format supporting # multiple tarballs