]> git.decadent.org.uk Git - dak.git/blobdiff - dak/process_new.py
Use correct db_name for MD5 hash
[dak.git] / dak / process_new.py
index f33b53bace1e1d570ef544baaf72c2013335d375..55397c7dc79a4e2df577397d9262a6addb047df1 100755 (executable)
@@ -54,6 +54,7 @@ import pwd
 import apt_pkg, apt_inst
 import examine_package
 import subprocess
+import daklib.daksubprocess
 from sqlalchemy import or_
 
 from daklib.dbconn import *
@@ -124,7 +125,7 @@ def takenover_binaries(upload, missing, session):
     binaries = set([x.package for x in upload.binaries])
     for m in missing:
         if m['type'] != 'dsc':
-            binaries.remove(m['package'])
+            binaries.discard(m['package'])
     if binaries:
         source = upload.binaries[0].source.source
         suite = upload.target_suite.overridesuite or \
@@ -154,10 +155,11 @@ def print_new (upload, missing, indexed, session, file=sys.stdout):
             package = m['package']
         section = m['section']
         priority = m['priority']
+        included = "" if m['included'] else "NOT UPLOADED"
         if indexed:
-            line = "(%s): %-20s %-20s %-20s" % (index, package, priority, section)
+            line = "(%s): %-20s %-20s %-20s %s" % (index, package, priority, section, included)
         else:
-            line = "%-20s %-20s %-20s" % (package, priority, section)
+            line = "%-20s %-20s %-20s %s" % (package, priority, section, included)
         line = line.strip()
         if not m['valid']:
             line = line + ' [!]'
@@ -217,7 +219,8 @@ def edit_new (overrides, upload, session):
             type, pkg = pkg.split(':', 1)
         else:
             type = 'deb'
-        if (type, pkg) not in overrides_map:
+        o = overrides_map.get((type, pkg), None)
+        if o is None:
             utils.warn("Ignoring unknown package '%s'" % (pkg))
         else:
             if section.find('/') != -1:
@@ -230,6 +233,7 @@ def edit_new (overrides, upload, session):
                     section=section,
                     component=component,
                     priority=priority,
+                    included=o['included'],
                     ))
     return new_overrides
 
@@ -346,8 +350,11 @@ def check_pkg (upload, upload_copy, session):
     suite_name = upload.target_suite.suite_name
     handler = PolicyQueueUploadHandler(upload, session)
     missing = [(m['type'], m["package"]) for m in handler.missing_overrides(hints=missing)]
+
+    less_cmd = ("less", "-R", "-")
+    less_process = daklib.daksubprocess.Popen(less_cmd, bufsize=0, stdin=subprocess.PIPE)
     try:
-        sys.stdout = os.popen("less -R -", 'w', 0)
+        sys.stdout = less_process.stdin
         print examine_package.display_changes(suite_name, changes)
 
         source = upload.source
@@ -364,6 +371,7 @@ def check_pkg (upload, upload_copy, session):
                 print examined
 
         print examine_package.output_package_relations()
+        less_process.stdin.close()
     except IOError as e:
         if e.errno == errno.EPIPE:
             utils.warn("[examine_package] Caught EPIPE; skipping.")
@@ -372,6 +380,7 @@ def check_pkg (upload, upload_copy, session):
     except KeyboardInterrupt:
         utils.warn("[examine_package] Caught C-c; skipping.")
     finally:
+        less_process.wait()
         sys.stdout = save_stdout
 
 ################################################################################
@@ -449,7 +458,7 @@ def run_user_inspect_command(upload, upload_copy):
             changes=changes,
             )
 
-    subprocess.check_call(shell_command, shell=True)
+    daklib.daksubprocess.check_call(shell_command, shell=True)
 
 ################################################################################