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¶
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, ... }, ...}whereusernameidentifies an existing copr user,permissionis one ofadmin|builderand state is one ofnothing|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, ...}, ...}whereusernameidentifies an existing copr user,permissionis one ofbuilder|adminandstatevalue is one ofnothing|request|approved. It is OK to set onlybulideror onlyadminpermission; any unspecifiedpermissionis then (a) set tonothing(if the permission entry is newly created), or (b) kept unchanged (if an existing permission entry is edited). If more than oneusernameis specified in singleset_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, ...}, wherepermissionis one ofbuilder|adminandboolis (a)Truefor requesting the role or (b)Falsefor dropping the role (or for cancelling of previous request).
-
Build¶
-
class
copr.v3.proxies.build.BuildProxy(config)[source]¶ -
-
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
-
create_from_urls(ownername, projectname, urls, buildopts=None, project_dirname=None)[source]¶ Create builds from a list of URLs
Parameters: - ownername (str) –
- projectname (str) –
- urls (list) –
- buildopts – http://python-copr.readthedocs.io/en/latest/client_v3/build_options.html
- project_dirname (str) –
Returns: Munch
-
create_from_url(ownername, projectname, url, buildopts=None, project_dirname=None)[source]¶ Create a build from URL
Parameters: - ownername (str) –
- projectname (str) –
- url (str) –
- buildopts – http://python-copr.readthedocs.io/en/latest/client_v3/build_options.html
- project_dirname (str) –
Returns: Munch
-
create_from_file(ownername, projectname, path, buildopts=None, project_dirname=None)[source]¶ Create a build from local SRPM file
Parameters: - ownername (str) –
- projectname (str) –
- path (str) –
- buildopts – http://python-copr.readthedocs.io/en/latest/client_v3/build_options.html
- project_dirname (str) –
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: - ownername (str) –
- projectname (str) –
- gem_name (str) –
- buildopts – http://python-copr.readthedocs.io/en/latest/client_v3/build_options.html
- project_dirname (str) –
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
-
Package¶
-
class
copr.v3.proxies.package.PackageProxy(config)[source]¶ -
get(ownername, projectname, packagename)[source]¶ Return a package
Parameters: - ownername (str) –
- projectname (str) –
- packagename (str) –
Returns: Munch
-
get_list(ownername, projectname, pagination=None)[source]¶ Return a list of packages
Parameters: - ownername (str) –
- projectname (str) –
- pagination –
Returns: Munch
-
add(ownername, projectname, packagename, source_type, source_dict)[source]¶ Add a package to a project
Parameters: - ownername (str) –
- projectname (str) –
- packagename (str) –
- source_type (str) – http://python-copr.readthedocs.io/en/latest/client_v3/package_source_types.html
- source_dict (dict) – http://python-copr.readthedocs.io/en/latest/client_v3/package_source_types.html
Returns: Munch
-
edit(ownername, projectname, packagename, source_type=None, source_dict=None)[source]¶ Edit a package in a project
Parameters: - ownername (str) –
- projectname (str) –
- packagename (str) –
- source_type – http://python-copr.readthedocs.io/en/latest/client_v3/package_source_types.html
- source_dict (dict) – http://python-copr.readthedocs.io/en/latest/client_v3/package_source_types.html
Returns: Munch
-
reset(ownername, projectname, packagename)[source]¶ Reset a package configuration, meaning that previously selected
source_typefor the package and also all the source configuration previously defined bysource_dictwill 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: - ownername (str) –
- projectname (str) –
- packagename (str) –
- buildopts – http://python-copr.readthedocs.io/en/latest/client_v3/build_options.html
- project_dirname (str) –
Returns: Munch
-
Module¶
-
class
copr.v3.proxies.module.ModuleProxy(config)[source]¶
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
-