X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Ftransitions.py;h=3a1e2c8259cb841313fc12944df121d8c4d78916;hb=ca08a2fab86fdcb63f297c8ab8425e01b1176bba;hp=90d2f620bbc4c74854dbb91903fd2bb418509f90;hpb=cd5b29ddfd8de263c085f494b9573d683913f6f3;p=dak.git diff --git a/dak/transitions.py b/dak/transitions.py index 90d2f620..3a1e2c82 100755 --- a/dak/transitions.py +++ b/dak/transitions.py @@ -66,14 +66,15 @@ def init(): Cnf = utils.get_conf() - Arguments = [('h',"help","Edit-Transitions::Options::Help"), + Arguments = [('a',"automatic","Edit-Transitions::Options::Automatic"), + ('h',"help","Edit-Transitions::Options::Help"), ('e',"edit","Edit-Transitions::Options::Edit"), ('i',"import","Edit-Transitions::Options::Import", "HasArg"), ('c',"check","Edit-Transitions::Options::Check"), ('s',"sudo","Edit-Transitions::Options::Sudo"), ('n',"no-action","Edit-Transitions::Options::No-Action")] - for i in ["help", "no-action", "edit", "import", "check", "sudo"]: + for i in ["automatic", "help", "no-action", "edit", "import", "check", "sudo"]: if not Cnf.has_key("Edit-Transitions::Options::%s" % (i)): Cnf["Edit-Transitions::Options::%s" % (i)] = "" @@ -107,6 +108,7 @@ Options: -i, --import check and import transitions from file -c, --check check the transitions file, remove outdated entries -S, --sudo use sudo to update transitions file + -a, --automatic don't prompt (only affects check). -n, --no-action don't do anything (only affects check)""" sys.exit(exit_code) @@ -389,7 +391,7 @@ def edit_transitions(): def check_transitions(transitions): """ Check if the defined transitions still apply and remove those that no longer do. - @note: Asks the user for confirmation first. + @note: Asks the user for confirmation first unless -a has been set. """ to_dump = 0 @@ -403,7 +405,7 @@ def check_transitions(transitions): # Will be None if nothing is in testing. current = database.get_suite_version(source, "testing") - print_info(trans, source, expected, t["rm"], t["reason"], t["packages"]) + print get_info(trans, source, expected, t["rm"], t["reason"], t["packages"]) if current == None: # No package in testing @@ -432,6 +434,8 @@ def check_transitions(transitions): if Options["no-action"]: answer="n" + elif Options["automatic"]: + answer="y" else: answer = utils.our_raw_input(prompt).lower() @@ -456,7 +460,7 @@ def check_transitions(transitions): ################################################################################ -def print_info(trans, source, expected, rm, reason, packages): +def get_info(trans, source, expected, rm, reason, packages): """ Print information about a single transition. @@ -479,21 +483,20 @@ def print_info(trans, source, expected, rm, reason, packages): @param packages: list of blocked packages """ - print """Looking at transition: %s + return """Looking at transition: %s Source: %s New Version: %s Responsible: %s Description: %s Blocked Packages (total: %d): %s """ % (trans, source, expected, rm, reason, len(packages), ", ".join(packages)) - return ################################################################################ def transition_info(transitions): """ Print information about all defined transitions. - Calls L{print_info} for every transition and then tells user if the transition is + Calls L{get_info} for every transition and then tells user if the transition is still ongoing or if the expected version already hit testing. @type transitions: dict @@ -507,7 +510,7 @@ def transition_info(transitions): # Will be None if nothing is in testing. current = database.get_suite_version(source, "testing") - print_info(trans, source, expected, t["rm"], t["reason"], t["packages"]) + print get_info(trans, source, expected, t["rm"], t["reason"], t["packages"]) if current == None: # No package in testing