dak.transitions

Display, edit and check the release manager’s transition file.

@contact: Debian FTP Master <ftpmaster@debian.org> @copyright: 2008 Joerg Jaspert <joerg@debian.org> @license: GNU General Public License version 2 or later

Module Attributes

Cnf

Configuration, apt_pkg.Configuration

Options

Parsed CommandLine arguments

Functions

check_transitions(transitions)

Check if the defined transitions still apply and remove those that no longer do.

edit_transitions()

Edit the defined transitions.

get_info(trans, source, expected, rm, ...)

Print information about a single transition.

init()

Initialize.

load_transitions(trans_file)

Parse a transition yaml file and check it for validity.

lock_file(f)

Lock a file

main()

Prepare the work to be done, do basic checks.

temp_transitions_file(transitions)

Open a temporary file and dump the current transitions into it, so users can edit them.

transition_info(transitions)

Print information about all defined transitions.

usage([exit_code])

write_transitions(from_trans)

Update the active transitions file safely.

write_transitions_from_file(from_file)

We have a file we think is valid; if we're using sudo, we invoke it here, otherwise we just parse the file and call write_transitions

dak.transitions.Cnf = None

Configuration, apt_pkg.Configuration

dak.transitions.Options = None

Parsed CommandLine arguments

dak.transitions.check_transitions(transitions)[source]

Check if the defined transitions still apply and remove those that no longer do. @note: Asks the user for confirmation first unless -a has been set.

dak.transitions.edit_transitions()[source]

Edit the defined transitions.

dak.transitions.get_info(trans: str, source: str, expected: str, rm: str, reason: str, packages: Iterable[str]) str[source]

Print information about a single transition.

Parameters:
  • trans – Transition name

  • source – Source package

  • expected – Expected version in testing

  • rm – Responsible release manager (RM)

  • reason – Reason

  • packages – list of blocked packages

dak.transitions.init()[source]

Initialize. Sets up database connection, parses commandline arguments.

Warning

This function may run within sudo

dak.transitions.load_transitions(trans_file: str) Optional[dict][source]

Parse a transition yaml file and check it for validity.

Warning

This function may run within sudo

Parameters:

trans_file – filename to parse

Returns:

validated dictionary of transition entries or None if validation fails, empty string if reading trans_file returned something else than a dict

dak.transitions.lock_file(f)[source]

Lock a file

Warning

This function may run within sudo

dak.transitions.main()[source]

Prepare the work to be done, do basic checks.

Warning

This function may run within sudo

dak.transitions.temp_transitions_file(transitions: dict) str[source]

Open a temporary file and dump the current transitions into it, so users can edit them.

Parameters:

transitions – current defined transitions

Returns:

path of newly created tempfile

Note

file is unlinked by caller, but fd is never actually closed. We need the chmod, as the file is (most possibly) copied from a sudo-ed script and would be unreadable if it has default mkstemp mode

dak.transitions.transition_info(transitions: dict)[source]

Print information about all defined transitions. Calls get_info() for every transition and then tells user if the transition is still ongoing or if the expected version already hit testing.

Parameters:

transitions – defined transitions

dak.transitions.usage(exit_code=0)[source]
dak.transitions.write_transitions(from_trans: dict) None[source]

Update the active transitions file safely. This function takes a parsed input file (which avoids invalid files or files that may be be modified while the function is active) and ensure the transitions file is updated atomically to avoid locks.

Warning

This function may run within sudo

Parameters:

from_trans – transitions dictionary, as returned by load_transitions()

dak.transitions.write_transitions_from_file(from_file: str) None[source]

We have a file we think is valid; if we’re using sudo, we invoke it here, otherwise we just parse the file and call write_transitions

Warning

This function usually runs within sudo

Parameters:

from_file – filename of a transitions file