]> git.decadent.org.uk Git - dak.git/blobdiff - dak/process_new.py
Merge commit 'ftpmaster/master'
[dak.git] / dak / process_new.py
index 462a2e63ae3675bcfccf227378fdd389863a4f29..9ecfcdc6bbc2ade5ca50079f3880319d7fa23756 100755 (executable)
@@ -1,9 +1,12 @@
 #!/usr/bin/env python
 # vim:set et ts=4 sw=4:
 
-# Handles NEW and BYHAND packages
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006  James Troup <james@nocrew.org>
+""" Handles NEW and BYHAND packages
 
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2001, 2002, 2003, 2004, 2005, 2006  James Troup <james@nocrew.org>
+@license: GNU General Public License version 2 or later
+"""
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
 
 ################################################################################
 
-import copy, errno, os, readline, stat, sys, time
+import copy
+import errno
+import os
+import readline
+import stat
+import sys
+import time
 import apt_pkg, apt_inst
 import examine_package
 from daklib import database
@@ -47,10 +56,10 @@ from daklib import utils
 from daklib.regexes import re_no_epoch, re_default_answer, re_isanum
 
 # Globals
-Cnf = None
+Cnf = None       #: Configuration, apt_pkg.Configuration
 Options = None
 Upload = None
-projectB = None
+projectB = None  #: database connection, pgobject
 Logger = None
 
 Priorities = None
@@ -231,6 +240,7 @@ def sort_changes(changes_files):
 class Section_Completer:
     def __init__ (self):
         self.sections = []
+        self.matches = []
         q = projectB.query("SELECT section FROM section")
         for i in q.getresult():
             self.sections.append(i[0])
@@ -252,6 +262,7 @@ class Section_Completer:
 class Priority_Completer:
     def __init__ (self):
         self.priorities = []
+        self.matches = []
         q = projectB.query("SELECT priority FROM priority")
         for i in q.getresult():
             self.priorities.append(i[0])
@@ -457,7 +468,7 @@ def edit_overrides (new):
 def edit_note(note):
     # Write the current data to a temporary file
     (fd, temp_filename) = utils.temp_filename()
-    temp_file = os.fdopen(temp_filename, 'w')
+    temp_file = os.fdopen(fd, 'w')
     temp_file.write(note)
     temp_file.close()
     editor = os.environ.get("EDITOR","vi")
@@ -505,6 +516,7 @@ def check_pkg ():
                     elif ftype == "dsc":
                         examine_package.check_dsc(changes['distribution'], f)
         finally:
+            examine_package.output_package_relations()
             sys.stdout = stdout_fd
     except IOError, e:
         if e.errno == errno.EPIPE:
@@ -725,6 +737,9 @@ def init():
             Cnf["Process-New::Options::%s" % (i)] = ""
 
     changes_files = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
+    if len(changes_files) == 0 and not Cnf.get("Process-New::Options::Comments-Dir",""):
+        changes_files = utils.get_changes_files(Cnf["Dir::Queue::New"])
+
     Options = Cnf.SubTree("Process-New::Options")
 
     if Options["Help"]:
@@ -840,7 +855,7 @@ def move_to_holding(suite, queue_dir):
        return
     Logger.log(["Moving to %s" % (suite,), Upload.pkg.changes_file])
     Upload.dump_vars(queue_dir)
-    move_to_dir(queue_dir)
+    move_to_dir(queue_dir, perms=0664)
     os.unlink(Upload.pkg.changes_file[:-8]+".dak")
 
 def _accept():