]> git.decadent.org.uk Git - dak.git/blobdiff - dak/show_new.py
dak/show_new.py: set examine_package.use_html before creating worker pool
[dak.git] / dak / show_new.py
index 8f72199e913892af473439e92ac9c7b29938b8ea..488005636e09c9ef17f597091b1ae440a620db1b 100755 (executable)
@@ -36,7 +36,6 @@ from daklib import utils
 from daklib.regexes import re_source_ext
 from daklib.config import Config
 from daklib import daklog
-from daklib.changesutils import *
 from daklib.dakmultiprocessing import DakProcessPool, PROC_STATUS_SUCCESS, PROC_STATUS_SIGNALRAISED
 from multiprocessing import Manager, TimeoutError
 
@@ -154,6 +153,8 @@ def html_footer():
 
 
 def do_pkg(upload_id):
+    cnf = Config()
+
     session = DBConn().session()
     upload = session.query(PolicyQueueUpload).filter_by(id=upload_id).one()
 
@@ -167,7 +168,7 @@ def do_pkg(upload_id):
     htmlfile = os.path.join(cnf['Show-New::HTMLPath'], htmlname)
 
     # Have we already processed this?
-    if False and os.path.exists(htmlfile) and \
+    if os.path.exists(htmlfile) and \
         os.stat(htmlfile).st_mtime > time.mktime(changes.created.timetuple()):
             with open(htmlfile, "r") as fd:
                 if fd.read() != timeout_str:
@@ -179,8 +180,10 @@ def do_pkg(upload_id):
     htmlfiles_to_process.append(htmlfile)
     sources.append(htmlname)
 
+    group = cnf.get('Dinstall::UnprivGroup') or None
+
     with open(htmlfile, 'w') as outfile:
-      with policy.UploadCopy(upload) as upload_copy:
+      with policy.UploadCopy(upload, group=group) as upload_copy:
         handler = policy.PolicyQueueUploadHandler(upload, session)
         missing = [ (o['type'], o['package']) for o in handler.missing_overrides() ]
         distribution = changes.distribution
@@ -246,13 +249,13 @@ def init(session):
 ################################################################################
 
 def main():
+    examine_package.use_html = True
+    pool = DakProcessPool(processes=5)
+
     session = DBConn().session()
     upload_ids = [ u.id for u in init(session) ]
     session.close()
 
-    examine_package.use_html=1
-
-    pool = DakProcessPool(processes=5)
     p = pool.map_async(do_pkg, upload_ids)
     pool.close()