Package coprs :: Module helpers
[hide private]
[frames] | no frames]

Module helpers

source code

Classes [hide private]
  CounterStatType
  EnumType
  PermissionEnum
  ActionTypeEnum
  BackendResultEnum
  RoleEnum
  StatusEnum
  BuildSourceEnum
  FailTypeEnum
  JSONEncodedDict
Represents an immutable structure as a json-encoded string.
  Paginator
  Serializer
  RedisConnectionProvider
  StringLiteral
Teach SA how to literalize various things.
  LiteralDialect
Functions [hide private]
 
generate_api_token(size=30)
Generate a random string used as token to access the API remotely.
source code
 
chroot_to_branch(chroot)
Get a git branch name from chroot.
source code
 
branch_to_os_version(branch) source code
 
splitFilename(filename)
Pass in a standard style rpm fullname
source code
 
parse_package_name(pkg)
Parse package name from possibly incomplete nvra string.
source code
 
generate_repo_url(mock_chroot, url)
Generates url with build results for .repo file.
source code
 
fix_protocol_for_backend(url)
Ensure that url either has http or https protocol according to the option in app config "ENFORCE_PROTOCOL_FOR_BACKEND_URL"
source code
 
fix_protocol_for_frontend(url)
Ensure that url either has http or https protocol according to the option in app config "ENFORCE_PROTOCOL_FOR_FRONTEND_URL"
source code
 
get_redis_connection()
Creates connection to redis, now we use default instance at localhost, no config needed
source code
 
dt_to_unixtime(dt)
Converts datetime to unixtime :param dt: DateTime instance :rtype: float
source code
 
string_dt_to_unixtime(dt_string)
Converts datetime to unixtime from string :param dt_string: datetime string :rtype: str
source code
 
is_ip_from_builder_net(ip)
Checks is ip is owned by the builders network :param str ip: IPv4 address :return bool: True
source code
 
str2bool(v) source code
 
copr_url(view, copr, **kwargs)
Examine given copr and generate proper URL for the `view`
source code
 
url_for_copr_view(view, group_view, copr, **kwargs) source code
 
literal_query(statement)
NOTE: This is entirely insecure.
source code
 
stream_template(template_name, **context) source code
 
generate_repo_name(repo_url)
based on url, generate repo name
source code
 
pre_process_repo_url(chroot, repo_url)
Expands variables and sanitize repo url to be used for mock config
source code
 
generate_build_config(copr, chroot_id)
Return dict with proper build config contents
source code
Variables [hide private]
  REPO_DL_STAT_FMT = 'repo_dl_stat::{copr_user}@{copr_project_na...
  CHROOT_REPO_MD_DL_STAT_FMT = 'chroot_repo_metadata_dl_stat:hse...
  CHROOT_RPMS_DL_STAT_FMT = 'chroot_rpms_dl_stat:hset::{copr_use...
  PROJECT_RPMS_DL_STAT_FMT = 'project_rpms_dl_stat:hset::{copr_u...
  PY3 = False
  int_type = (<type 'int'>, <type 'long'>)
  str_type = (<type 'str'>, <type 'unicode'>)
  __package__ = 'coprs'
Function Details [hide private]

generate_api_token(size=30)

source code 
Generate a random string used as token to access the API
remotely.

:kwarg: size, the size of the token to generate, defaults to 30
    chars.
:return: a string, the API token for the user.

chroot_to_branch(chroot)

source code 

Get a git branch name from chroot. Follow the fedora naming standard.

splitFilename(filename)

source code 

Pass in a standard style rpm fullname

Return a name, version, release, epoch, arch, e.g.:

   foo-1.0-1.i386.rpm returns foo, 1.0, 1, i386
   1:bar-9-123a.ia64.rpm returns bar, 9, 123a, 1, ia64

generate_repo_url(mock_chroot, url)

source code 

Generates url with build results for .repo file. No checks if copr or mock_chroot exists.

copr_url(view, copr, **kwargs)

source code 

Examine given copr and generate proper URL for the `view`

Values of `username/group_name` and `coprname` are automatically passed as the first two URL parameters,
and therefore you should *not* pass them manually.

Usage:
  copr_url("coprs_ns.foo", copr)
  copr_url("coprs_ns.foo", copr, arg1='bar', arg2='baz)

literal_query(statement)

source code 

NOTE: This is entirely insecure. DO NOT execute the resulting strings.


Variables Details [hide private]

REPO_DL_STAT_FMT

Value:
'repo_dl_stat::{copr_user}@{copr_project_name}:{copr_name_release}'

CHROOT_REPO_MD_DL_STAT_FMT

Value:
'chroot_repo_metadata_dl_stat:hset::{copr_user}@{copr_project_name}:{c\
opr_chroot}'

CHROOT_RPMS_DL_STAT_FMT

Value:
'chroot_rpms_dl_stat:hset::{copr_user}@{copr_project_name}:{copr_chroo\
t}'

PROJECT_RPMS_DL_STAT_FMT

Value:
'project_rpms_dl_stat:hset::{copr_user}@{copr_project_name}'