]> git.decadent.org.uk Git - dak.git/blobdiff - dak/process_accepted.py
Merge branch 'psycopg2' into content_generation
[dak.git] / dak / process_accepted.py
index a25c391fc374f9d286d8e515ecf74adfa64e9684..07258018bb13426ca3394670096de2948df1194e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Installs Debian packages from queue/accepted into the pool
+""" Installs Debian packages from queue/accepted into the pool """
 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006  James Troup <james@nocrew.org>
 
 # This program is free software; you can redistribute it and/or modify
 ###############################################################################
 
 import errno, fcntl, os, sys, time, re
-import apt_pkg
+import apt_pkg, tarfile, commands
 from daklib import database
 from daklib import logging
 from daklib import queue
 from daklib import utils
 from daklib.dak_exceptions import *
+from daklib.regexes import re_default_answer, re_issource, re_fdnic
 
 ###############################################################################
 
@@ -96,8 +97,10 @@ class Urgency_Log:
         else:
             os.unlink(self.log_filename)
 
+
 ###############################################################################
 
+
 def reject (str, prefix="Rejected: "):
     global reject_message
     if str:
@@ -220,7 +223,7 @@ def action ():
 
     while prompt.find(answer) == -1:
         answer = utils.our_raw_input(prompt)
-        m = queue.re_default_answer.match(prompt)
+        m = re_default_answer.match(prompt)
         if answer == "":
             answer = m.group(1)
         answer = answer[:1].upper()
@@ -371,6 +374,13 @@ def install ():
                 suite_id = database.get_suite_id(suite)
                 projectB.query("INSERT INTO bin_associations (suite, bin) VALUES (%d, currval('binaries_id_seq'))" % (suite_id))
 
+            # insert contents into the database
+            contents = utils.generate_contents_information(file)
+            q = projectB.query("SELECT currval('binaries_id_seq')")
+            bin_id = int(q.getresult()[0][0])
+            for file in contents:
+                database.insert_content_path(bin_id, file)
+
     # If the .orig.tar.gz is in a legacy directory we need to poolify
     # it, so that apt-get source (and anything else that goes by the
     # "Directory:" field in the Sources.gz file) works.
@@ -433,7 +443,6 @@ def install ():
         utils.copy(pkg.changes_file, Cnf["Dir::Root"] + dest)
     for dest in copy_dot_dak.keys():
         utils.copy(Upload.pkg.changes_file[:-8]+".dak", dest)
-
     projectB.query("COMMIT WORK")
 
     # Move the .changes into the 'done' directory
@@ -538,11 +547,11 @@ def stable_install (summary, short_summary):
     for newfile in files.keys():
         if files[newfile]["type"] == "deb":
             new_changelog.write("stable/%s/binary-%s/%s\n" % (files[newfile]["component"], files[newfile]["architecture"], newfile))
-        elif utils.re_issource.match(newfile):
+        elif re_issource.match(newfile):
             new_changelog.write("stable/%s/source/%s\n" % (files[newfile]["component"], newfile))
         else:
             new_changelog.write("%s\n" % (newfile))
-    chop_changes = queue.re_fdnic.sub("\n", changes["changes"])
+    chop_changes = re_fdnic.sub("\n", changes["changes"])
     new_changelog.write(chop_changes + '\n\n')
     if os.access(changelog_filename, os.R_OK) != 0:
         changelog = utils.open_file(changelog_filename)