]> git.decadent.org.uk Git - dak.git/commitdiff
Merge commit 'djpig/djpig'
authorMark Hymers <mhy@debian.org>
Tue, 27 Oct 2009 10:04:35 +0000 (10:04 +0000)
committerMark Hymers <mhy@debian.org>
Tue, 27 Oct 2009 10:04:35 +0000 (10:04 +0000)
Conflicts:
daklib/dbconn.py

Signed-off-by: Mark Hymers <mhy@debian.org>
1  2 
dak/process_new.py
daklib/dbconn.py

index f15a56003f67ae82e5ec347328d94bdae8100125,7e8dd679efc55e160aea97d652ca1b5f8b9444b0..f01f4b91b1278e6549963da4c2fb1359aa2289a6
@@@ -1067,61 -1076,58 +1076,58 @@@ def end()
  
  ################################################################################
  
- def comment_accept(changes_file, comments):
-     Upload.pkg.changes_file = changes_file
-     Upload.init_vars()
-     Upload.update_vars()
-     Upload.update_subst()
-     files = Upload.pkg.files
+ def main():
+     global Options, Logger, Sections, Priorities
  
-     if not recheck():
-         return # dak wants to REJECT, crap
+     cnf = Config()
+     session = DBConn().session()
 -    
 +
-     (new, byhand) = check_status(files)
-     if not new and not byhand:
-         do_accept()
+     Arguments = [('a',"automatic","Process-New::Options::Automatic"),
+                  ('h',"help","Process-New::Options::Help"),
+                  ('C',"comments-dir","Process-New::Options::Comments-Dir", "HasArg"),
+                  ('m',"manual-reject","Process-New::Options::Manual-Reject", "HasArg"),
+                  ('t',"trainee","Process-New::Options::Trainee"),
+                  ('n',"no-action","Process-New::Options::No-Action")]
  
- ################################################################################
+     for i in ["automatic", "help", "manual-reject", "no-action", "version", "comments-dir", "trainee"]:
+         if not cnf.has_key("Process-New::Options::%s" % (i)):
+             cnf["Process-New::Options::%s" % (i)] = ""
  
- def comment_reject(changes_file, comments):
-     Upload.pkg.changes_file = changes_file
-     Upload.init_vars()
-     Upload.update_vars()
-     Upload.update_subst()
+     changes_files = apt_pkg.ParseCommandLine(cnf.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"])
  
-     if not recheck():
-         pass # dak has its own reasons to reject as well, which is fine
+     Options = cnf.SubTree("Process-New::Options")
+     if Options["Help"]:
+         usage()
  
-     reject(comments)
-     print "REJECT\n" + reject_message,
      if not Options["No-Action"]:
-         Upload.do_reject(0, reject_message)
-         os.unlink(Upload.pkg.changes_file[:-8]+".dak")
+         try:
+             Logger = daklog.Logger(cnf, "process-new")
+         except CantOpenError, e:
+             Options["Trainee"] = "True"
  
- ################################################################################
+     Sections = Section_Completer(session)
+     Priorities = Priority_Completer(session)
+     readline.parse_and_bind("tab: complete")
  
- def main():
-     changes_files = init()
-     if len(changes_files) > 50:
+     if len(changes_files) > 1:
          sys.stderr.write("Sorting changes...\n")
-     changes_files = sort_changes(changes_files)
+     changes_files = sort_changes(changes_files, session)
  
      # Kill me now? **FIXME**
-     Cnf["Dinstall::Options::No-Mail"] = ""
-     bcc = "X-DAK: dak process-new\nX-Katie: lisa $Revision: 1.31 $"
-     if Cnf.has_key("Dinstall::Bcc"):
-         Upload.Subst["__BCC__"] = bcc + "\nBcc: %s" % (Cnf["Dinstall::Bcc"])
-     else:
-         Upload.Subst["__BCC__"] = bcc
-     commentsdir = Cnf.get("Process-New::Options::Comments-Dir","")
-     if commentsdir:
-         if changes_files != []:
-             sys.stderr.write("Can't specify any changes files if working with comments-dir")
-             sys.exit(1)
-         do_comments(commentsdir, "ACCEPT.", "ACCEPTED.", "OK", comment_accept)
-         do_comments(commentsdir, "REJECT.", "REJECTED.", "NOTOK", comment_reject)
-     else:
+     cnf["Dinstall::Options::No-Mail"] = ""
+ #     commentsdir = cnf.get("Process-New::Options::Comments-Dir","")
+ #     if commentsdir:
+ #        if changes_files != []:
+ #            sys.stderr.write("Can't specify any changes files if working with comments-dir")
+ #            sys.exit(1)
+ #        do_comments(commentsdir, "ACCEPT.", "ACCEPTED.", "OK", comment_accept)
+ #        do_comments(commentsdir, "REJECT.", "REJECTED.", "NOTOK", comment_reject)
+ #     else:
+     if True:
          for changes_file in changes_files:
              changes_file = utils.validate_changes_file_arg(changes_file, 0)
              if not changes_file:
index f5a19c1236442360ca57b7b867eed9f24f5f5003,f65c67e447843ab961f368cdb36e1ff28cd5ecd1..8ee9076874d09a0d785924cb4bf3eb891e9b41b9
@@@ -165,10 -155,9 +165,10 @@@ class Archive(object)
  
  __all__.append('Archive')
  
 +@session_wrapper
  def get_archive(archive, session=None):
      """
-     returns database id for given c{archive}.
+     returns database id for given C{archive}.
  
      @type archive: string
      @param archive: the name of the arhive
@@@ -1904,8 -2142,13 +1904,8 @@@ def get_suite(suite, session=None)
      generated if not supplied)
  
      @rtype: Suite
-     @return: Suite object for the requested suite name (None if not presenT)
+     @return: Suite object for the requested suite name (None if not present)
 -
      """
 -    privatetrans = False
 -    if session is None:
 -        session = DBConn().session()
 -        privatetrans = True
  
      q = session.query(Suite).filter_by(suite_name=suite)