]> git.decadent.org.uk Git - dak.git/blobdiff - dak/process_policy.py
Merge remote branch 'ansgar/auditpackages'
[dak.git] / dak / process_policy.py
index 83ee19b55df3232b426eacd997c31c4a4cc3e8bb..3f237f626b506b5cb929c4fc4ede505530cc748f 100755 (executable)
@@ -54,7 +54,7 @@ def do_comments(dir, srcqueue, opref, npref, line, fn, session):
     for comm in [ x for x in os.listdir(dir) if x.startswith(opref) ]:
         lines = open("%s/%s" % (dir, comm)).readlines()
         if len(lines) == 0 or lines[0] != line + "\n": continue
-        changes_files = [ x for x in os.listdir(".") if x.startswith(comm[7:]+"_")
+        changes_files = [ x for x in os.listdir(".") if x.startswith(comm[len(opref):]+"_")
                                 and x.endswith(".changes") ]
         changes_files = sort_changes(changes_files, session)
         for f in changes_files:
@@ -65,9 +65,6 @@ def do_comments(dir, srcqueue, opref, npref, line, fn, session):
                 continue
             fn(f, srcqueue, "".join(lines[1:]), session)
 
-        if len(changes_files) and not Options["No-Action"]:
-            store_changelog(changes_files[0], srcqueue)
-
         if opref != npref and not Options["No-Action"]:
             newcomm = npref + comm[len(opref):]
             os.rename("%s/%s" % (dir, comm), "%s/%s" % (dir, newcomm))
@@ -116,21 +113,6 @@ def comment_reject(changes_file, srcqueue, comments, session):
 
 ################################################################################
 
-def store_changelog(changes_file, srcqueue):
-    Cnf = Config()
-    u = Upload()
-    u.pkg.changes_file = os.path.join(Cnf['Dir::Queue::Newstage'], changes_file)
-    u.load_changes(u.pkg.changes_file)
-    u.update_subst()
-    query = """INSERT INTO changelogs (source, version, suite, changelog)
-               VALUES (:source, :version, :suite, :changelog)"""
-    session = DBConn().session()
-    session.execute(query, {'source': u.pkg.changes['source'], 'version': u.pkg.changes['version'], \
-                    'suite': srcqueue.queue_name, 'changelog': u.pkg.changes['changes']})
-    session.commit()
-
-################################################################################
-
 def main():
     global Options, Logger
 
@@ -159,8 +141,8 @@ def main():
 
     if not Options["No-Action"]:
         try:
-            Logger = daklog.Logger(cnf, "process-policy")
-        except CantOpenError, e:
+            Logger = daklog.Logger("process-policy")
+        except CantOpenError as e:
             Logger = None
 
     # Find policy queue
@@ -176,6 +158,7 @@ def main():
     # The comments stuff relies on being in the right directory
     os.chdir(pq.path)
     do_comments(commentsdir, pq, "ACCEPT.", "ACCEPTED.", "OK", comment_accept, session)
+    do_comments(commentsdir, pq, "ACCEPTED.", "ACCEPTED.", "OK", comment_accept, session)
     do_comments(commentsdir, pq, "REJECT.", "REJECTED.", "NOTOK", comment_reject, session)