llvm_snapshot_builder

llvm_snapshot_builder provides classes to interact with Copr.

Subpackages

Submodules

Package Contents

Classes

CoprActionBuildAllPackages

Builds everyting for the given chroots and creates optimal Copr batches.

CoprActionBuildPackages

Builds a list of packages for the given chroots in the order they are given.

CoprActionCancelBuilds

Cancels builds with particular states.

CoprActionDeleteBuilds

Deletes builds with particular states.

CoprActionDeleteProject

Attempts to delete the project if it exists and cancels builds before.

CoprActionForkProject

Forks the project from the given source into the target project.

CoprActionCreatePackages

Make or edits packages in a copr project.

CoprActionCreateProject

Make or edits a project

CoprActionProjectExists

Checks if a project exists.

CoprAction

The base class for all actions.

CoprActionRegenerateRepos

Regenerates the repositories for the given project.

CoprBuildWalkerMixin

Allows you to walk over each build filtered by state and chroot.

CoprClientMixin

Any class that needs a copr client property can derive from this class

CoprPackageBuilderMixin

The base class for package building Actions in Copr

CoprProjectRef

CoprProjectRef is a reference to a Copr project by ownername and projectname.

Attributes

__version__

llvm_snapshot_builder.__version__
class llvm_snapshot_builder.CoprActionBuildAllPackages(proj: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], chroots: list[str] = None, timeout: int = None, **kwargs)[source]

Bases: llvm_snapshot_builder.mixins.client_mixin.CoprClientMixin, llvm_snapshot_builder.mixins.package_builder_mixin.CoprPackageBuilderMixin, llvm_snapshot_builder.actions.action.CoprAction

Builds everyting for the given chroots and creates optimal Copr batches. See https://docs.pagure.org/copr.copr/user_documentation.html#build-batches.

NOTE: We kick-off builds for each chroot individually so that an x86_64 build doesn’t have to wait for a potentially slower s390x build.

run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprActionBuildPackages(proj: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], package_names: list[str] = None, chroots: list[str] = None, wait_on_build_id: int = None, timeout: int = None, **kwargs)[source]

Bases: llvm_snapshot_builder.actions.action.CoprAction, llvm_snapshot_builder.mixins.client_mixin.CoprClientMixin, llvm_snapshot_builder.mixins.package_builder_mixin.CoprPackageBuilderMixin

Builds a list of packages for the given chroots in the order they are given.

NOTE: We kick-off builds for each chroot individually so that an x86_64 build doesn’t have to wait for a potentially slower s390x build.

run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprActionCancelBuilds(states: list[str] = None, **kwargs)[source]

Bases: llvm_snapshot_builder.actions.action.CoprAction, llvm_snapshot_builder.mixins.client_mixin.CoprClientMixin, llvm_snapshot_builder.mixins.build_walker_mixin.CoprBuildWalkerMixin

Cancels builds with particular states.

cancel_states

states to cancel

Type:

list

cancel_states = ['pending', 'waiting', 'running', 'importing']
run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprActionDeleteBuilds(states: list[str] = None, **kwargs)[source]

Bases: llvm_snapshot_builder.actions.action.CoprAction, llvm_snapshot_builder.mixins.client_mixin.CoprClientMixin, llvm_snapshot_builder.mixins.build_walker_mixin.CoprBuildWalkerMixin

Deletes builds with particular states.

delete_states

states to cancel

Type:

list

delete_states = ['pending', 'waiting', 'running', 'importing']
run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprActionDeleteProject(proj: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], **kwargs)[source]

Bases: llvm_snapshot_builder.actions.action.CoprAction, llvm_snapshot_builder.mixins.client_mixin.CoprClientMixin

Attempts to delete the project if it exists and cancels builds before.

run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprActionForkProject(source: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], target: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], **kwargs)[source]

Bases: llvm_snapshot_builder.actions.action.CoprAction, llvm_snapshot_builder.mixins.client_mixin.CoprClientMixin

Forks the project from the given source into the target project.

run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprActionCreatePackages(proj: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], packagenames: list[str] = None, update: bool = False, **kwargs)[source]

Bases: llvm_snapshot_builder.actions.action.CoprAction, llvm_snapshot_builder.mixins.client_mixin.CoprClientMixin

Make or edits packages in a copr project. NOTE: This doesn’t build the packages!

default_package_names

the default packages to create/edit if not specified

Type:

list[str]

default_package_names = ['python-lit', 'llvm', 'compiler-rt', 'lld', 'clang', 'mlir', 'libomp']
run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprActionCreateProject(proj: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], description: str = '', instructions: str = '', chroots: list[str] = None, delete_after_days: int = 0, update: bool = False, **kwargs)[source]

Bases: llvm_snapshot_builder.actions.action.CoprAction, llvm_snapshot_builder.mixins.client_mixin.CoprClientMixin

Make or edits a project

default_chroots

The default chroots to use for the project when creating

Type:

list

runtime_dependencies

List of external repositories (== dependencies, specified as baseurls) that will be automatically enabled together with this project repository.

Type:

list

default_chroots = ['fedora-rawhide-x86_64']
runtime_dependencies = 'https://download.copr.fedorainfracloud.org/results/%40fedora-llvm-team/llvm-compat-packages/fedor...'
run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprActionProjectExists(proj: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], **kwargs)[source]

Bases: llvm_snapshot_builder.actions.action.CoprAction, llvm_snapshot_builder.mixins.client_mixin.CoprClientMixin

Checks if a project exists.

run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprAction(**kwargs)[source]

Bases: abc.ABC

The base class for all actions.

abstract run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprActionRegenerateRepos(proj: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], **kwargs)[source]

Bases: llvm_snapshot_builder.mixins.client_mixin.CoprClientMixin, llvm_snapshot_builder.actions.action.CoprAction

Regenerates the repositories for the given project. NOTE: The regeneration of repository data is not finished when this function returns.

run() bool[source]

Runs the action.

class llvm_snapshot_builder.CoprBuildWalkerMixin(proj: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], chroots: list[str] = None, states: list[str] = None, **kwargs)[source]

Allows you to walk over each build filtered by state and chroot. Make sure you use CoprClientMixin as well.

property filtered_build_ids: list[str]

Returns the filtered build IDs

walk_builds(func: Callable[Ellipsis, bool] = None) bool[source]

Walks over every filtered build and optionally (if given) calls func with the current build object. When func returns False, the walk_builds function stops returns False as well.

Along the way, this function populates the filtered_build_ids property with the builds that were filtered. This can be used for copr operations that can handle multiple build ids.

class llvm_snapshot_builder.CoprClientMixin(client: CoprClientMixin = None, **kwargs)[source]

Any class that needs a copr client property can derive from this class

property client

Property for getting the copr client. Upon first call of this function, the client is instantiated.

__make_client() copr.v3.Client

Instatiates the copr client. Make sure to use the “client” property for accessing the client and creating it.

If the environment contains COPR_URL, COPR_LOGIN, COPR_TOKEN, and COPR_USERNAME, we’ll try to create a Copr client from those environment variables; otherwise, A Copr API client is created from the config file in ~/.config/copr. See https://copr.fedorainfracloud.org/api/ for how to create such a file.

class llvm_snapshot_builder.CoprPackageBuilderMixin(**kwargs)[source]

The base class for package building Actions in Copr

default_build_timeout

the default build timeout in seconds

Type:

int

adjust_chroot(proj: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], chroot: str)[source]

Adjusts the chroot to have –with=snapshot_build and llvm-snapshot-builder package installed.

Keyword Arguments:
  • for (proj -- the project to adjust the chroot) –

  • adjust (chroot -- the chroot to) –

build(proj: Union[llvm_snapshot_builder.copr_project_ref.CoprProjectRef, str], package_name: str, chroots: list[str], build_after_id: int = None, timeout: int = None)[source]

Builds a package in Copr

Parameters:
  • proj (CoprProjectRef) – the project to build in

  • package_name (str) – the package to build

  • chroots (list[str]) – the chroots to build in

  • build_after_id (int) – the build to build after

  • timeout (int) – the build timeout in seconds

Raises:

CoprRequestException – if the build could not be created

class llvm_snapshot_builder.CoprProjectRef(owner_project: Union[str, CoprProjectRef], **kwargs)[source]

CoprProjectRef is a reference to a Copr project by ownername and projectname.

property owner: str

Returns the ownername that references this project

property name: str

Returns the projectname that references this project

property ref: str

Returns the ownername/projectname string

__str__()[source]

Returns the ownername/projectname string