Classes¶
KojiWrapperBase¶
Provides common functionality for classes in this module which wrap a connection to koji, manage the session, and provide convenience methods for interacting with the koji api.
- class koji_wrapper.base.KojiWrapperBase(url='', topurl='', profile='', user_config='', session=None, logger=None)[source]¶
Bases:
objectBase Koji Wrapper object
This class provides the common functionality to wrap a connection to koji, manage the session and simple convenience methods for interacting with the koji api.
- archives(**kwargs)[source]¶
This method wraps koji client method listArchives
- Parameters
**kwargs – Any valid named parameter accepted by the koji client method listArchives:
- Returns
list of archives from koji
- build(nvr)[source]¶
This method wraps the koji client method getBuild:
- Parameters
nvr – nvr of the desired build
- Returns
build object from koji
- login()[source]¶
Method to log the client in. This can be used directly if desired, but is more intended to be called by a decorator as needed when an api method is called and reports that it requires the client to be logged in.
- Returns
True or False
- property profile¶
This is the profile koji should use to configure a client.
This is a specific server, and there should be a config file specified in one of the standard locations koji looks:
/etc/koji.conf
/etc/koji.conf.d
~/.koji/config.d
- Parameters
profile – profile name of the koji-compliant hub to use
- rpms(**kwargs)[source]¶
This method wraps the koji client method listRPMs
- Parameters
**kwargs – Any valid named parameter accepted by the koji client method listRPMs:
- Returns
list of matching rpms from koji
- property session¶
This property exposes koji.ClientSession used by wrapper
Makes sure the object has a koji.ClientSession to use. It can be passed an existing KojiWrapper object, koji.ClientSession object, or None. In the first two cases, the existing session will be reused. In the case of None, a new ClientSession will be created using the url param, if present. When not present, if a profile and/or config are specified, those will be used to configure the ClientSession object.
- Parameters
newsession – koji.ClientSession object to use
- Raises
koji.ConfigurationError – In the case of a bad configuration, the client is not created, and this error is returned.
- property topurl¶
Url of the package repository to use
- Type
param topurl
- property url¶
Url of the koji-compliant hub to use
- Type
param url
- property user_config¶
This would be used in the case where you have custom user config.
The file can be in any readable location specified by the user, and can point to a directory or a specific file.
- Parameters
user_config – user_config file/path to be merged with profile or used in place of the profile if not installed in the system location.
KojiTag¶
KojiTag Module
- class koji_wrapper.tag.KojiTag(tag=None, nvr_blacklist=None, blacklist=None, **kwargs)[source]¶
Bases:
koji_wrapper.wrapper.KojiWrapperClass to work with and gather koji tag information
- property blacklist¶
blacklist to limit results.
- Type
param blacklist
- builds(**kwargs)[source]¶
This method wraps the koji client method listTagged:
- Parameters
**kwargs – Any valid named parameter accepted by the koji client method listTagged:
- Returns
list of matching tagged build objects from koji
- builds_by_attribute(attribute)[source]¶
Return a list of the specified attribute, extracted from the list of tagged builds. For instance, you may call with ‘nvr’ to get back the list of NVRs in your build list. Throws a KeyError if you request an attribute that does not exist in the build objects.
- Parameters
attribute – Any attribute (or key) from a build object, such as ‘nvr’, ‘name’, etc.
- Returns
a list of strings
- Raises
KeyError – if attribute passed is invalid
- builds_by_attribute_and_label(attribute, label, match)[source]¶
Return a list of the specified attribute, filtered by matching labels, extracted from the list of tagged builds. For instance, you may call with ‘nvr’, ‘name’, ‘foo’ to get back the list of NVRs in your build list for items with a name of ‘foo’. Throws a KeyError if you request an attribute that does not exist in the build objects.
- Parameters
attribute – Any attribute (or key) from a build object, such as ‘nvr’, ‘name’, etc.
label – Any label (or key) from a build object, which you wish to use to filter your results, such as ‘nvr’, ‘name’, etc.
match – Value you are looking to match for the label that was passed in.
- Returns
a list of strings
- Raises
KeyError – if attribute passed is invalid
- property nvr_blacklist¶
nvr_blacklist to limit results.
- Type
param nvr_blacklist
- property tag¶
tag to filter results with.
- Type
param tag
- property tagged_list¶
tagged_list of builds.
- Type
param tagged_list
KojiWrapper¶
Wraps a connection to koji, managing the session, and providing convenience methods for interacting with the koji api.
- class koji_wrapper.wrapper.KojiWrapper(**kwargs)[source]¶
Bases:
koji_wrapper.base.KojiWrapperBase- file_types(nvr, types=['image'])[source]¶
- Parameters
nvr – nvr of the desired build
types – list of koji archive types. This is currently any of: ‘maven’, ‘win’, or ‘image’
- Returns
list of file types of given build
- srpm_url(nvr=None)[source]¶
- Parameters
nvr – reference to the rpm of the desired package. This may be any of:
int ID
string N-V-R.A
string N-V-R.A@location
map containing ‘name’, ‘version’, ‘release’, and ‘arch’ (and optionally ‘location’)
- Returns
srpm url for a given nvr
Submodules¶
koji_wrapper.util¶
Collection of utility methods