Warning
Legacy client is obsolete, please use Client version 3 instead. This document describes the migration process.
CoprClient¶
-
class
copr.client.client.
CoprClient
(username=None, login=None, token=None, copr_url=None, no_config=False)[source]¶ Main interface to the copr service
- Variables
username (unicode) – username used by default for all requests
login (unicode) – user login, used for identification
token (unicode) – copr api token
copr_url (unicode) – used as copr projects root
- Could be created:
directly
using static method
CoprClient.create_from_file_config()
-
static
create_from_file_config
(filepath=None, ignore_error=False)[source]¶ Creates Copr client using the information from the config file.
- Parameters
filepath (
str
) – specifies config location, default: “~/.config/copr”ignore_error (bool) – When true creates default Client without credentionals
- Return type
-
get_build_details
(build_id, projectname=None, username=None)[source]¶ Returns build details.
- Parameters
build_id (int) – Build identifier
projectname – [optional] Copr project name
username – [optional] Copr project owner
- Returns
CoprResponse
with additional fields:handle:
BuildHandle
text fields: “project”, “owner”, “status”, “results”,
”submitted_on”, “started_on”, “ended_on”, “built_pkgs”, “src_pkg”, “src_version”
-
cancel_build
(build_id, projectname=None, username=None)[source]¶ Cancels build. Auth required. If build can’t be canceled do nothing.
- Parameters
build_id (int) – Build identifier
projectname – [optional] Copr project name
username – [optional] Copr project owner
- Returns
CoprResponse
with additional fields:handle:
BuildHandle
text fields: “status”
-
create_new_build
(projectname, pkgs, username=None, timeout=None, memory=None, chroots=None, background=False, progress_callback=None)[source]¶ Creates new build
- Parameters
projectname – name of Copr project (without user namespace)
pkgs – list of packages to include in build
username – [optional] use alternative username
timeout – [optional] build timeout
memory – [optional] amount of required memory for build process
chroots – [optional] build only with given chroots
background – [optional] mark the build as a background job.
progress_callback – [optional] a function that received a
MultipartEncoderMonitor instance for each chunck of uploaded data
- Returns
CoprResponse
with additional fields:builds_list: list of
BuildWrapper
-
get_project_details
(projectname, username=None)[source]¶ Returns project details
- Parameters
projectname – Copr projectname
username – [optional] use alternative username
- Returns
CoprResponse
with additional fields:text fields: “description”, “instructions”, “last_modified”,
”name”
chroots: list of
ProjectChrootWrapper
-
delete_project
(projectname, username=None)[source]¶ Deletes the entire project. Auth required.
- Parameters
projectname – Copr projectname
username – [optional] use alternative username
- Returns
CoprResponse
with additional fields:text fields: “message”
-
create_project
(username, projectname, chroots, description=None, instructions=None, repos=None, initial_pkgs=None, disable_createrepo=None, unlisted_on_hp=False, enable_net=True, persistent=False, auto_prune=True, use_bootstrap_container=None)[source]¶ Creates a new copr project Auth required.
- Parameters
projectname – User or group name
projectname – Copr project name
chroots – List of target chroots
description – [optional] Project description
instructions – [optional] Instructions for end users
disable_createrepo – [optional] disables automatic repo meta-data regeneration, “true”/”false” string
unlisted_on_hp – [optional] Project will not be shown on COPR HP
enable_net – [optional] If builder can access net for builds in this project
persistent – [optional] If builds and the project are undeletable
auto_prune – [optional] If backend auto-deletion script should be run for the project
use_bootstrap_container – [optional] If mock bootstrap container is used to initialize the buildroot
- Returns
CoprResponse
with additional fields:handle:
ProjectHandle
text fields: “message”
-
modify_project
(projectname, username=None, description=None, instructions=None, repos=None, disable_createrepo=None, unlisted_on_hp=None, enable_net=None, auto_prune=None, use_bootstrap_container=None, chroots=None)[source]¶ Modifies main project configuration. Auth required.
- Parameters
projectname – Copr project name
username – [optional] use alternative username
description – [optional] project description
instructions – [optional] instructions for end users
repos – [optional] list of additional repos to be used during the build process
repos – [optional] list of additional repos to be used during
disable_createrepo – [optional] disables automatic repo meta-data regeneration
unlisted_on_hp – [optional] Project will not be shown on COPR HP
enable_net – [optional] If builder can access net for builds in this project
auto_prune – [optional] If backend auto-deletion script should be run for the project
use_bootstrap_container – [optional] If mock bootstrap container is used to initialize the buildroot
chroots – [optional] list of chroots that should be enabled in the project. When not
None
, selected chroots will be enabled while current chroots will not remain enabled if they are not specified.
- Returns
CoprResponse
with additional fields:handle:
ProjectHandle
text fields: “buildroot_pkgs”
-
get_projects_list
(username=None)[source]¶ Returns list of projects created by the user
- Parameters
username – [optional] use alternative username
- Returns
CoprResponse
with additional fields:projects_list: list of
ProjectWrapper
-
get_project_chroot_details
(projectname, chrootname, username=None)[source]¶ Returns details of chroot used in project
- Parameters
projectname – Copr project name
chrootname – chroot name
username – [optional] use alternative username
- Returns
CoprResponse
with additional fields:handle:
ProjectChrootHandle
text fields: “buildroot_pkgs”
-
modify_project_chroot_details
(projectname, chrootname, pkgs=None, username=None)[source]¶ @deprecated to edit_chroot Modifies chroot used in project
- Parameters
projectname – Copr project name
chrootname – chroot name
username – [optional] use alternative username
- Returns
CoprResponse
with additional fields:handle:
ProjectChrootHandle
text fields: “buildroot_pkgs”
-
search_projects
(query)[source]¶ Search projects by substring
- Parameters
query – substring to search
- Returns
CoprResponse
with additional fields:projects_list: list of
ProjectWrapper