Package dak :: Module transitions
[hide private]
[frames] | no frames]

Module transitions

source code

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

Functions [hide private]
 
init()
Initialize.
source code
 
usage(exit_code=0) source code
dict or None
load_transitions(trans_file)
Parse a transition yaml file and check it for validity.
source code
 
lock_file(f)
Lock a file
source code
 
write_transitions(from_trans)
Update the active transitions file safely.
source code
 
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
source code
string
temp_transitions_file(transitions)
Open a temporary file and dump the current transitions into it, so users can edit them.
source code
 
edit_transitions()
Edit the defined transitions.
source code
 
check_transitions(transitions)
Check if the defined transitions still apply and remove those that no longer do.
source code
 
get_info(trans, source, expected, rm, reason, packages)
Print information about a single transition.
source code
 
transition_info(transitions)
Print information about all defined transitions.
source code
 
main()
Prepare the work to be done, do basic checks.
source code
Variables [hide private]
  Cnf = None
Configuration, apt_pkg.Configuration
  Options = None
Parsed CommandLine arguments

Imports: os, subprocess, sys, time, errno, fcntl, tempfile, apt_pkg, utils, TransitionsError, re_broken_package, yaml


Function Details [hide private]

init()

source code 

Initialize. Sets up database connection, parses commandline arguments.

Attention: This function may run within sudo

load_transitions(trans_file)

source code 

Parse a transition yaml file and check it for validity.

Parameters:
  • trans_file (string) - filename to parse
Returns: dict or None
validated dictionary of transition entries or None if validation fails, empty string if reading trans_file returned something else than a dict

Attention: This function may run within sudo

lock_file(f)

source code 

Lock a file

Attention: This function may run within sudo

write_transitions(from_trans)

source code 

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.

Parameters:

Attention: This function may run within sudo

write_transitions_from_file(from_file)

source code 

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

Parameters:
  • from_file (filename) - filename of a transitions file

Attention: This function usually runs within sudo

temp_transitions_file(transitions)

source code 

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

Parameters:
  • transitions (dict) - current defined transitions
Returns: string
path of newly created tempfile

Note: NB: 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

check_transitions(transitions)

source code 

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.

get_info(trans, source, expected, rm, reason, packages)

source code 

Print information about a single transition.

Parameters:
  • trans (string) - Transition name
  • source (string) - Source package
  • expected (string) - Expected version in testing
  • rm (string) - Responsible RM
  • reason (string) - Reason
  • packages (list) - list of blocked packages

transition_info(transitions)

source code 

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 (dict) - defined transitions

main()

source code 

Prepare the work to be done, do basic checks.

Attention: This function may run within sudo