From: Mark Hymers Date: Tue, 27 Oct 2009 10:04:35 +0000 (+0000) Subject: Merge commit 'djpig/djpig' X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=832b7e7007fae655b4850f55dd35ef95a92a5373;p=dak.git Merge commit 'djpig/djpig' Conflicts: daklib/dbconn.py Signed-off-by: Mark Hymers --- 832b7e7007fae655b4850f55dd35ef95a92a5373 diff --cc dak/process_new.py index f15a5600,7e8dd679..f01f4b91 --- a/dak/process_new.py +++ b/dak/process_new.py @@@ -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: diff --cc daklib/dbconn.py index f5a19c12,f65c67e4..8ee90768 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@@ -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)