Proxies
User interface is separated among multiple proxy classes such as ProjectProxy, BuildProxy, etc,
which provide API operations on given resource.
There are several methods available across majority (there are some corner cases where it wouldn’t make sense)
of proxies. Naturally, all methods (e.g. auth_check) from BaseProxy are available everywhere. Moreover,
proxies implement get method to get one specific object and get_list to get multiple objects that meet some
criteria (e.g. all successful builds from a project). When it makes sense, proxies also implement an edit method
that modifies an object. Exception for this is for example, a BuildProxy because it shouldn’t be possible to
change a build. Similarly, most of the proxies have a delete method except for e.g. BuildChrootProxy.
Base
-
class copr.v3.proxies.BaseProxy(config)[source]
Parent class for all other proxies
-
home()[source]
Call the Copr APIv3 base URL
-
auth_check()[source]
Call an endpoint protected by login to check whether the user auth key is valid
Project
-
class copr.v3.proxies.project.ProjectProxy(config)[source]
-
get(ownername, projectname)[source]
Return a project
Parameters: |
- ownername (str) –
- projectname (str) –
|
Returns: | Munch
|
-
get_list(ownername=None, pagination=None)[source]
Return a list of projects
Parameters: |
- ownername (str) –
- pagination –
|
Returns: | Munch
|
-
search(query, pagination=None)[source]
Return a list of projects based on fulltext search
Parameters: |
- query (str) –
- pagination –
|
Returns: | Munch
|
-
add(ownername, projectname, chroots, description=None, instructions=None, homepage=None, contact=None, additional_repos=None, unlisted_on_hp=False, enable_net=True, persistent=False, auto_prune=True, use_bootstrap_container=False, devel_mode=False, delete_after_days=None, multilib=False, module_hotfixes=False)[source]
Create a project
Parameters: |
- ownername (str) –
- projectname (str) –
- chroots (list) –
- description (str) –
- instructions (str) –
- homepage (str) –
- contact (str) –
- additional_repos (list) –
- unlisted_on_hp (bool) – project will not be shown on Copr homepage
- enable_net (bool) – if builder can access net for builds in this project
- persistent (bool) – if builds and the project are undeletable
- auto_prune (bool) – if backend auto-deletion script should be run for the project
- use_bootstrap_container (bool) – if mock bootstrap container is used to initialize the buildroot
- devel_mode (bool) – if createrepo should run automatically
- delete_after_days (int) – delete the project after the specfied period of time
- module_hotfixes (bool) – make packages from this project available
on along with packages from the active module streams.
|
Returns: | Munch
|
-
edit(ownername, projectname, chroots=None, description=None, instructions=None, homepage=None, contact=None, additional_repos=None, unlisted_on_hp=None, enable_net=None, auto_prune=None, use_bootstrap_container=None, devel_mode=None, delete_after_days=None, multilib=None, module_hotfixes=None)[source]
Edit a project
Parameters: |
- ownername (str) –
- projectname (str) –
- chroots (list) –
- description (str) –
- instructions (str) –
- homepage (str) –
- contact (str) –
- repos (list) –
- unlisted_on_hp (bool) – project will not be shown on Copr homepage
- enable_net (bool) – if builder can access net for builds in this project
- auto_prune (bool) – if backend auto-deletion script should be run for the project
- use_bootstrap_container (bool) – if mock bootstrap container is used to initialize the buildroot
- devel_mode (bool) – if createrepo should run automatically
- delete_after_days (int) – delete the project after the specfied period of time
- module_hotfixes (bool) – make packages from this project available
on along with packages from the active module streams.
|
Returns: | Munch
|
-
delete(ownername, projectname)[source]
Delete a project
Parameters: |
- ownername (str) –
- projectname (str) –
|
Returns: | Munch
|
-
fork(ownername, projectname, dstownername, dstprojectname, confirm=False)[source]
Fork a project
Parameters: |
- ownername (str) – owner of a source project
- projectname (str) – name of a source project
- dstownername (str) – owner of a destination project
- dstprojectname (str) – name of a destination project
- confirm (bool) – if forking into a existing project, this needs to be set to True,
to confirm that user is aware of that
|
Returns: | Munch
|
-
get_permissions(ownername, projectname)[source]
Get project permissions
Parameters: |
- ownername (str) – owner of the project
- projectname (str) – name of the project
|
Return Munch: | a dictionary in format
{username: {permission: state, ... }, ...} where username
identifies an existing copr user, permission is one of
admin|builder and state is one of nothing|approved|request.
|
-
set_permissions(ownername, projectname, permissions)[source]
Set (or change) permissions for a project
Parameters: |
- ownername (str) – owner of the updated project
- projectname (str) – name of the updated project
- permissions (dict) – the expected format is
{username: {permission: state, ...}, ...}
where username identifies an existing copr user, permission
is one of builder|admin and state value is one of
nothing|request|approved. It is OK to set only bulider or
only admin permission; any unspecified permission is then
(a) set to nothing (if the permission entry is newly created),
or (b) kept unchanged (if an existing permission entry is edited).
If more than one username is specified in single
set_permissions() request, the approach is to configure
all-or-nothing (any error makes the whole operation fail and
no-op).
|
-
request_permissions(ownername, projectname, permissions)[source]
Request/cancel request/drop your permissions on project
Parameters: |
- ownername (str) – owner of the requested project
- projectname (str) – name of the requested project
- permissions (dict) – the desired permissions user wants to have on
the requested copr project. The format is
{permission: bool, ...}, where permission is one of
builder|admin and bool is
(a) True for requesting the role or
(b) False for dropping the role (or for cancelling of
previous request).
|
Build
-
class copr.v3.proxies.build.BuildProxy(config)[source]
-
get(build_id)[source]
Return a build
Parameters: | build_id (int) – |
Returns: | Munch |
-
get_source_chroot(build_id)[source]
Return a source build
Parameters: | build_id (int) – |
Returns: | Munch |
-
get_source_build_config(build_id)[source]
Return a config for source build
Parameters: | build_id (int) – |
Returns: | Munch |
-
get_list(ownername, projectname, packagename=None, status=None, pagination=None)[source]
Return a list of packages
Parameters: |
- ownername (str) –
- projectname (str) –
- packagename (str) –
- status (str) –
- pagination –
|
Returns: | Munch
|
-
cancel(build_id)[source]
Cancel a build
Parameters: | build_id (int) – |
Returns: | Munch |
-
create_from_urls(ownername, projectname, urls, buildopts=None, project_dirname=None)[source]
Create builds from a list of URLs
Parameters: |
|
Returns: | Munch
|
-
create_from_url(ownername, projectname, url, buildopts=None, project_dirname=None)[source]
Create a build from URL
Parameters: |
|
Returns: | Munch
|
-
create_from_file(ownername, projectname, path, buildopts=None, project_dirname=None)[source]
Create a build from local SRPM file
Parameters: |
|
Returns: | Munch
|
-
create_from_scm(ownername, projectname, clone_url, committish='', subdirectory='', spec='', scm_type='git', source_build_method='rpkg', buildopts=None, project_dirname=None)[source]
Create a build from SCM repository
Parameters: |
- ownername (str) –
- projectname (str) –
- clone_url (str) – url to a project versioned by Git or SVN
- committish (str) – name of a branch, tag, or a git hash
- subdirectory (str) – path to a subdirectory with package content
- spec (str) – path to spec file, relative to ‘subdirectory’
- scm_type (str) –
- source_build_method (str) –
- buildopts – http://python-copr.readthedocs.io/en/latest/client_v3/build_options.html
- project_dirname (str) –
|
Returns: | Munch
|
-
create_from_pypi(ownername, projectname, pypi_package_name, pypi_package_version=None, spec_template='', python_versions=None, buildopts=None, project_dirname=None)[source]
Create a build from PyPI - https://pypi.org/
Parameters: |
- ownername (str) –
- projectname (str) –
- pypi_package_name (str) –
- pypi_package_version (str) – PyPI package version (None means “latest”)
- spec_template (str) – what pyp2rpm spec template to use
- python_versions (list) – list of python versions to build for
- buildopts – http://python-copr.readthedocs.io/en/latest/client_v3/build_options.html
- project_dirname (str) –
|
Returns: | Munch
|
-
create_from_rubygems(ownername, projectname, gem_name, buildopts=None, project_dirname=None)[source]
Create a build from RubyGems - https://rubygems.org/
Parameters: |
|
Returns: | Munch
|
-
create_from_custom(ownername, projectname, script, script_chroot=None, script_builddeps=None, script_resultdir=None, buildopts=None, project_dirname=None)[source]
Create a build from custom script.
Parameters: |
- ownername (str) –
- projectname (str) –
- script – script to execute to generate sources
- script_chroot – [optional] what chroot to use to generate
sources (defaults to fedora-latest-x86_64)
- script_builddeps – [optional] list of script’s dependencies
- script_resultdir – [optional] where script generates results
(relative to cwd)
- project_dirname (str) –
|
Returns: | Munch
|
-
delete(build_id)[source]
Delete a build
Parameters: | build_id (int) – |
Returns: | Munch |
-
delete_list(build_ids)[source]
Delete multiple builds specified by a list of their ids.
Parameters: | build_id (list[int]) – |
Returns: | Munch |
Package
-
class copr.v3.proxies.package.PackageProxy(config)[source]
-
get(ownername, projectname, packagename, with_latest_build=False, with_latest_succeeded_build=False)[source]
Return a package
Parameters: |
- ownername (str) –
- projectname (str) –
- packagename (str) –
- with_latest_build (bool) – The result will contain “builds” dictionary with the latest
submitted build of this particular package within the project
- with_latest_succeeded_build (bool) – The result will contain “builds” dictionary with
the latest successful build of this particular
package within the project.
|
Returns: | Munch
|
-
get_list(ownername, projectname, pagination=None, with_latest_build=False, with_latest_succeeded_build=False)[source]
Return a list of packages
Parameters: |
- ownername (str) –
- projectname (str) –
- pagination –
- with_latest_build (bool) – The result will contain “builds” dictionary with the latest
submitted build of this particular package within the project
- with_latest_succeeded_build (bool) – The result will contain “builds” dictionary with
the latest successful build of this particular
package within the project.
|
Returns: | Munch
|
-
add(ownername, projectname, packagename, source_type, source_dict)[source]
Add a package to a project
Parameters: |
|
Returns: | Munch
|
-
edit(ownername, projectname, packagename, source_type=None, source_dict=None)[source]
Edit a package in a project
Parameters: |
|
Returns: | Munch
|
-
reset(ownername, projectname, packagename)[source]
Reset a package configuration, meaning that previously selected source_type
for the package and also all the source configuration previously defined by
source_dict will be nulled.
Parameters: |
- ownername (str) –
- projectname (str) –
- packagename (str) –
|
Returns: | Munch
|
-
build(ownername, projectname, packagename, buildopts=None, project_dirname=None)[source]
Create a build from a package configuration
Parameters: |
|
Returns: | Munch
|
-
delete(ownername, projectname, packagename)[source]
Delete a package from a project
Parameters: |
- ownername (str) –
- projectname (str) –
- packagename (str) –
|
Returns: | Munch
|
Module
-
class copr.v3.proxies.module.ModuleProxy(config)[source]
-
build_from_url(ownername, projectname, url, branch='master', distgit=None)[source]
Build a module from a URL pointing to a modulemd YAML file
Parameters: |
- ownername (str) –
- projectname (str) –
- url (str) – URL pointing to a raw .yaml file
- branch (str) –
|
Returns: | Munch
|
-
build_from_file(ownername, projectname, path, distgit=None)[source]
Build a module from a local modulemd YAML file
Parameters: |
- ownername (str) –
- projectname (str) –
- path (str) –
|
Returns: | Munch
|
Project Chroot
-
class copr.v3.proxies.project_chroot.ProjectChrootProxy(config)[source]
-
get(ownername, projectname, chrootname)[source]
Return a configuration of a chroot in a project
Parameters: |
- ownername (str) –
- projectname (str) –
- chrootname (str) –
|
Returns: | Munch
|
-
get_build_config(ownername, projectname, chrootname)[source]
Return a build configuration of a chroot in a project
Parameters: |
- ownername (str) –
- projectname (str) –
- chrootname (str) –
|
Returns: | Munch
|
-
edit(ownername, projectname, chrootname, additional_packages=None, additional_repos=None, comps=None, delete_comps=False, with_opts=None, without_opts=None)[source]
Edit a chroot configuration in a project
Parameters: |
- ownername (str) –
- projectname (str) –
- chrootname (str) –
- additional_packages (list) – buildroot packages for the chroot
- additional_repos (list) – buildroot additional additional_repos
- comps (str) – file path to the comps.xml file
- delete_comps (bool) – if True, current comps.xml will be removed
- with_opts (list) – Mock –with option
- without_opts (list) – Mock –without option
|
Returns: | Munch
|
Build Chroot
-
class copr.v3.proxies.build_chroot.BuildChrootProxy(config)[source]
-
get(build_id, chrootname)[source]
Return a build chroot
Parameters: |
- build_id (int) –
- chrootname (str) –
|
Returns: | Munch
|
-
get_list(build_id, pagination=None)[source]
Return a list of build chroots
Parameters: |
- build_id (int) –
- chrootname (str) –
- pagination –
|
Returns: | Munch
|
-
get_build_config(build_id, chrootname)[source]
Return a build config for a build chroot
Parameters: |
- build_id (int) –
- chrootname (str) –
|
Returns: | Munch
|