X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fprocess_new.py;h=e052af49a1909ee1d7f249251dffab4afa9d3be2;hb=67b6abb95803ccd67d999f5f0174310776927534;hp=de01787926ab82e7bfc6b6dfbaef208037808ea9;hpb=f710ee2fdb567fe4bd942664a91ac7bd78ba9e6f;p=dak.git diff --git a/dak/process_new.py b/dak/process_new.py index de017879..e052af49 100755 --- a/dak/process_new.py +++ b/dak/process_new.py @@ -77,43 +77,13 @@ Sections = None ################################################################################ def recheck(upload, session): - files = upload.pkg.files - - cnf = Config() - for f in files.keys(): - # The .orig.tar.gz can disappear out from under us is it's a - # duplicate of one in the archive. - if not files.has_key(f): - continue - # Check that the source still exists - if files[f]["type"] == "deb": - source_version = files[f]["source version"] - source_package = files[f]["source package"] - if not upload.pkg.changes["architecture"].has_key("source") \ - and not upload.source_exists(source_package, source_version, upload.pkg.changes["distribution"].keys()): - source_epochless_version = re_no_epoch.sub('', source_version) - dsc_filename = "%s_%s.dsc" % (source_package, source_epochless_version) - found = 0 - for q in ["Accepted", "Embargoed", "Unembargoed", "Newstage"]: - if cnf.has_key("Dir::Queue::%s" % (q)): - if os.path.exists(cnf["Dir::Queue::%s" % (q)] + '/' + dsc_filename): - found = 1 - if not found: - upload.rejects.append("no source found for %s %s (%s)." % (source_package, source_version, f)) - - # Version and file overwrite checks - if files[f]["type"] == "deb": - upload.check_binary_against_db(f, session) - elif files[f]["type"] == "dsc": - upload.check_source_against_db(f, session) - upload.check_dsc_against_db(f, session) - + upload.recheck() if len(upload.rejects) > 0: answer = "XXX" if Options["No-Action"] or Options["Automatic"] or Options["Trainee"]: answer = 'S' - print "REJECT\n" + upload.rejects.join("\n"), + print "REJECT\n%s" % '\n'.join(upload.rejects) prompt = "[R]eject, Skip, Quit ?" while prompt.find(answer) == -1: @@ -124,7 +94,7 @@ def recheck(upload, session): answer = answer[:1].upper() if answer == 'R': - upload.do_reject(manual=0, reject_message=upload.rejects.join("\n")) + upload.do_reject(manual=0, reject_message='\n'.join(upload.rejects)) os.unlink(upload.pkg.changes_file[:-8]+".dak") return 0 elif answer == 'S': @@ -695,7 +665,7 @@ def do_new(upload, session): try: check_daily_lock() done = add_overrides (new, upload, session) - Logger.log([utils.getusername(), "NEW ACCEPT: %s" % (upload.pkg.changes_file)]) + Logger.log(["NEW ACCEPT: %s" % (upload.pkg.changes_file)]) except CantGetLockError: print "Hello? Operator! Give me the number for 911!" print "Dinstall in the locked area, cant process packages, come back later" @@ -704,11 +674,12 @@ def do_new(upload, session): elif answer == 'E' and not Options["Trainee"]: new = edit_overrides (new, upload, session) elif answer == 'M' and not Options["Trainee"]: + upload.pkg.remove_known_changes() aborted = upload.do_reject(manual=1, reject_message=Options["Manual-Reject"], note=get_new_comments(changes.get("source", ""), session=session)) if not aborted: - Logger.log([utils.getusername(), "NEW REJECT: %s" % (upload.pkg.changes_file)]) + Logger.log(["NEW REJECT: %s" % (upload.pkg.changes_file)]) os.unlink(upload.pkg.changes_file[:-8]+".dak") done = 1 elif answer == 'N': @@ -717,7 +688,7 @@ def do_new(upload, session): elif answer == 'P' and not Options["Trainee"]: prod_maintainer(get_new_comments(changes.get("source", ""), session=session), upload) - Logger.log([utils.getusername(), "NEW PROD: %s" % (upload.pkg.changes_file)]) + Logger.log(["NEW PROD: %s" % (upload.pkg.changes_file)]) elif answer == 'R' and not Options["Trainee"]: confirm = utils.our_raw_input("Really clear note (y/N)? ").lower() if confirm == "y": @@ -791,12 +762,12 @@ def do_byhand(upload, session): done = 1 for f in byhand: del files[f] - Logger.log([utils.getusername(), "BYHAND ACCEPT: %s" % (upload.pkg.changes_file)]) + Logger.log(["BYHAND ACCEPT: %s" % (upload.pkg.changes_file)]) except CantGetLockError: print "Hello? Operator! Give me the number for 911!" print "Dinstall in the locked area, cant process packages, come back later" elif answer == 'M': - Logger.log([utils.getusername(), "BYHAND REJECT: %s" % (upload.pkg.changes_file)]) + Logger.log(["BYHAND REJECT: %s" % (upload.pkg.changes_file)]) upload.do_reject(manual=1, reject_message=Options["Manual-Reject"]) os.unlink(upload.pkg.changes_file[:-8]+".dak") done = 1 @@ -850,7 +821,7 @@ def _accept(upload): if Options["No-Action"]: return (summary, short_summary) = upload.build_summaries() - upload.accept(summary, short_summary, targetdir=Config()["Dir::Queue::Newstage"]) + upload.accept(summary, short_summary, targetqueue) os.unlink(upload.pkg.changes_file[:-8]+".dak") def do_accept(upload): @@ -859,24 +830,15 @@ def do_accept(upload): if not Options["No-Action"]: (summary, short_summary) = upload.build_summaries() - if cnf.FindB("Dinstall::SecurityQueueHandling"): - upload.dump_vars(cnf["Dir::Queue::Embargoed"]) - upload.move_to_dir(cnf["Dir::Queue::Embargoed"]) - upload.queue_build("embargoed", cnf["Dir::Queue::Embargoed"]) - # Check for override disparities - upload.Subst["__SUMMARY__"] = summary - else: - # Just a normal upload, accept it... - _accept(upload) - -def check_status(files): - new = byhand = 0 - for f in files.keys(): - if files[f]["type"] == "byhand": - byhand = 1 - elif files[f].has_key("new"): - new = 1 - return (new, byhand) + if cnf.FindB("Dinstall::SecurityQueueHandling"): + upload.dump_vars(cnf["Dir::Queue::Embargoed"]) + upload.move_to_queue(get_policy_queue('embargoed')) + upload.queue_build("embargoed", cnf["Dir::Queue::Embargoed"]) + # Check for override disparities + upload.Subst["__SUMMARY__"] = summary + else: + # Just a normal upload, accept it... + _accept(upload) def do_pkg(changes_file, session): u = Upload() @@ -884,7 +846,7 @@ def do_pkg(changes_file, session): u.update_subst() cnf = Config() - bcc = "X-DAK: dak process-new\nX-Katie: lisa $Revision: 1.31 $" + bcc = "X-DAK: dak process-new" if cnf.has_key("Dinstall::Bcc"): u.Subst["__BCC__"] = bcc + "\nBcc: %s" % (cnf["Dinstall::Bcc"]) else: @@ -926,7 +888,7 @@ def end(): if accept_count > 1: sets = "sets" sys.stderr.write("Accepted %d package %s, %s.\n" % (accept_count, sets, utils.size_type(int(accept_bytes)))) - Logger.log([utils.getusername(), "total",accept_count,accept_bytes]) + Logger.log(["total",accept_count,accept_bytes]) if not Options["No-Action"] and not Options["Trainee"]: Logger.close() @@ -936,6 +898,10 @@ def end(): def main(): global Options, Logger, Sections, Priorities + print "NO NEW PROCESSING CURRENTLY AVAILABLE" + print "(Go and do something more interesting)" + sys.exit(0) + cnf = Config() session = DBConn().session()