From: Mike O'Connor Date: Fri, 13 Nov 2009 19:32:24 +0000 (+0000) Subject: dodadoda X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfb5e2fb5f3100b9b1247ea346462a49deb9d011;p=dak dodadoda Signed-off-by: Mike O'Connor --- diff --git a/dak/process_new.py b/dak/process_new.py index bb7ebc7d..dfd654c9 100755 --- a/dak/process_new.py +++ b/dak/process_new.py @@ -816,28 +816,29 @@ def lock_package(package): finally: os.unlink(path) -def changes_to_unchecked(upload, session): - """move a changes file to unchecked""" - unchecked = get_policy_queue('unchecked', session ); +def changes_to_newstage(upload, session): + """move a changes file to newstage""" + newstage = get_policy_queue('newstage', session ); -# changes.in_queue = unchecked + # changes.in_queue = newstage chg = session.query(DBChange).filter_by(changesname=os.path.basename(upload.pkg.changes_file)).one() - chg.approved_for = unchecked.policy_queue_id + chg.approved_for = newstage.policy_queue_id - for f in upload.pkg.files: + for f in chg.files: # update the changes_pending_files row - f.queue = unchecked + f.queue = newstage # actually move files - upload.move_to_queue(unchecked) + upload.move_to_queue(newstage) def _accept(upload, session): if Options["No-Action"]: return (summary, short_summary) = upload.build_summaries() -# upload.accept(summary, short_summary, targetqueue) - changes_to_unchecked(upload, session) + # upload.accept(summary, short_summary, targetqueue) + + changes_to_newstage(upload, session) def do_accept(upload, session): print "ACCEPT" diff --git a/daklib/changes.py b/daklib/changes.py index 6b776268..4d2bcfe1 100644 --- a/daklib/changes.py +++ b/daklib/changes.py @@ -204,30 +204,39 @@ class Changes(object): else: multivalues[key] = self.changes[key] - # TODO: Use ORM - session.execute( - """INSERT INTO changes - (changesname, in_queue, seen, source, binaries, architecture, version, - distribution, urgency, maintainer, fingerprint, changedby, date) - VALUES (:changesfile,:in_queue,:filetime,:source,:binary, :architecture, - :version,:distribution,:urgency,:maintainer,:fingerprint,:changedby,:date)""", - { 'changesfile': self.changes_file, - 'filetime': filetime, - 'in_queue': in_queue, - '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"]} ) + chg = DBChange() + chg.chagnesfile = self.change_file + chg.seen = filetime + chg.in_queue_id = in_queue + chg.source = self.chagnes["source"] + chg.binaries = multivalues["binary"] + chg.architecture = multivalues["architecture"] + chg.version = self.changes["version"] + chg.distribution = multivalues["distribution"] + chg.urgency = self.changes["urgency"] + chg.maintainer = self.changes["maintainer"] + chg.fingerprint = self.changes["fingerprint"] + chg.changedby = self.changes["changed-by"] + chg.date = self.changes["date"] + + session.add(chg) + + chg_files = [] + for chg_fn in self.files.keys(): + cpf = ChangePendingFile() + cpf.filename = chg_fn + cpf.size = self.files[chg_fn]['size'] + cpf.md5sum = self.files[chg_fn]['md5sum'] + + session.add(cpf) + chg_files.append(cpf) + + chg.files = chg_files session.commit() - - return session.query(DBChange).filter_by(changesname = self.changes_file).one() + chg = session.query(DBChange).filter_by(changesname = self.changes_file).one(); + + return chg def unknown_files_fields(self, name): return sorted(list( set(self.files[name].keys()) -