backend.helpers

backend.helpers.pyconffile(filename)[source]

Load python file as configuration file, inspired by python-flask “from_pyfile()

backend.helpers.cmd_debug(cmd, rc, out, err, log)[source]
backend.helpers.run_cmd(cmd, shell=False)[source]

Runs given command in a subprocess.

cmd: list(str) or str if shell==True
command to be executed and its arguments
shell: bool
if the command should be interpreted by shell
munch.Munch(stdout, stderr, returncode)
executed cmd, standard output, error output, and the return code
backend.helpers.wait_log(log, reason="I don't know why.", timeout=5)[source]

We need to wait a while, this should happen only when copr converges to boot-up/restart/..

class backend.helpers.SortedOptParser(usage=None, option_list=None, option_class=<class 'optparse.Option'>, version=None, conflict_handler='error', description=None, formatter=None, add_help_option=True, prog=None, epilog=None)[source]

Optparser which sorts the options by opt before outputting –help

format_help(formatter=None)[source]
backend.helpers._get_conf(cp, section, option, default, mode=None)[source]

To make returning items from config parser less irritating

Parameters:mode – convert obtained value, possible modes: - None (default): do nothing - “bool” or “boolean” - “int” - “float”
class backend.helpers.BackendConfigReader(config_file=None, ext_opts=None)[source]
read()[source]
_read_unsafe()[source]
backend.helpers.get_auto_createrepo_status(front_url, username, projectname)[source]
backend.helpers.get_persistent_status(front_url, username, projectname)[source]
backend.helpers.get_auto_prune_status(front_url, username, projectname)[source]
backend.helpers.register_build_result(opts=None, failed=False)[source]

Remember fails to redis. Successful build resets counter to zero.

Parameters:
  • opts – BackendConfig, when opts not provided default config location will be used
  • failed (boolean) – failure flag
  • origin (str) – name of component produced failure, default: builder
backend.helpers.get_redis_connection(opts)[source]

Creates redis client object using backend config

Return type:StrictRedis
backend.helpers.format_tb(ex, ex_traceback)[source]
class backend.helpers.RedisPublishHandler(rc, who, level=0)[source]
emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

backend.helpers.get_redis_logger(opts, name, who)[source]
backend.helpers.create_file_logger(name, filepath, fmt=None)[source]
backend.helpers.utc_now()[source]
Return datetime.datetime:
 Current utc datetime with specified timezone
backend.helpers.silent_remove(filename)[source]
backend.helpers.get_backend_opts()[source]
backend.helpers.ensure_dir_exists(path, log)[source]
backend.helpers.get_chroot_arch(chroot)[source]
backend.helpers.local_file_logger(name, path, fmt)[source]
backend.helpers.pkg_name_evr(srpm_path)[source]

Queries a package for its name and evr (epoch:version-release)

backend.helpers.format_filename(name, version, release, epoch, arch, zero_epoch=False)[source]