Koji Helper module

class rebasehelper.helpers.koji_helper.KojiHelper[source]
classmethod create_session(login=False, profile='koji')[source]

Creates new Koji session and immediately logs in to a Koji hub.

Parameters:
  • login (bool) – Whether to perform a login.

  • profile (str) – Koji profile to use.

Returns:

Newly created session instance.

Return type:

koji.ClientSession

Raises:

RebaseHelperError – If login failed.

classmethod display_task_results(tasks)[source]

Prints states of Koji tasks.

Parameters:

tasks (list) – List of koji.TaskWatcher instances.

classmethod download_build(session, build_id, destination, arches)[source]

Downloads RPMs and logs of a Koji build.

Parameters:
  • session (koji.ClientSession) – Active Koji session instance.

  • build_id (str) – Koji build ID.

  • destination (str) – Path where to download files to.

  • arches (list) – List of architectures to be downloaded.

Returns:

List of downloaded RPMs and list of downloaded logs.

Return type:

tuple

Raises:

DownloadError – If download failed.

classmethod download_task_results(session, tasklist, destination)[source]

Downloads packages and logs of finished Koji tasks.

Parameters:
  • session (koji.ClientSession) – Active Koji session instance.

  • tasklist (list) – List of task IDs.

  • destination (str) – Path where to download files to.

Returns:

List of downloaded RPMs and list of downloaded logs.

Return type:

tuple

Raises:

DownloadError – If download failed.

functional: bool = True
classmethod get_build(session, package, version)[source]

Looks up Koji build of a specific version of a package.

Parameters:
  • session (koji.ClientSession) – Active Koji session instance.

  • package (str) – Package name.

  • version (str) – Package version.

Returns:

Found latest package version and Koji build ID.

Return type:

tuple

classmethod get_latest_build(session, package)[source]

Looks up latest Koji build of a package.

Parameters:
  • session (koji.ClientSession) – Active Koji session instance.

  • package (str) – Package name.

Returns:

Found latest package version and Koji build ID.

Return type:

tuple

classmethod get_old_build_info(package_name, package_version)[source]

Gets old build info from Koji.

Parameters:
  • package_name (str) – Package name from specfile.

  • package_version (str) – Package version from specfile.

Returns:

Koji build id, package version.

Return type:

tuple

classmethod get_task_url(session, task_id)[source]
classmethod upload_srpm(session, srpm)[source]

Uploads SRPM to a Koji hub.

Parameters:
  • session (koji.ClientSession) – Active Koji session instance.

  • srpm (str) – Valid path to SRPM.

Returns:

Remote path to the uploaded SRPM.

Return type:

str

Raises:

RebaseHelperError – If upload failed.

classmethod watch_koji_tasks(session, tasklist)[source]

Waits for Koji tasks to finish and prints their states.

Parameters:
  • session (koji.ClientSession) – Active Koji session instance.

  • tasklist (list) – List of task IDs.

Returns:

Dictionary mapping task IDs to their states or None if interrupted.

Return type:

dict