]> git.decadent.org.uk Git - dak.git/commitdiff
dodadoda
authorMike O'Connor <stew@ries.debian.org>
Fri, 13 Nov 2009 19:32:24 +0000 (19:32 +0000)
committerMike O'Connor <stew@ries.debian.org>
Fri, 13 Nov 2009 19:32:24 +0000 (19:32 +0000)
Signed-off-by: Mike O'Connor <stew@ries.debian.org>
dak/process_new.py
daklib/changes.py

index bb7ebc7d664d4e2ea6412eaea82410b0d313b140..dfd654c978950cc419c83db00da9fe3bac612908 100755 (executable)
@@ -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"
index 6b7762681e8febb39b8531363e4261124c7eec79..4d2bcfe181ce193fadd84ac8f883046ae092840e 100644 (file)
@@ -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()) -