kojismokydingo.archives¶
Functions for gathering and transforming Koji datastructures representing RPMs and build archives
- author:
Christopher O'Brien <obriencj@gmail.com>
- license:
GPL v3
- as_pathinfo(path)[source]¶
Converts path into a PathInfo if it is not one already
- Parameters:
path (str | PathInfo) -- path basis for archives
- Return type:
PathInfo
- filter_archives(session, archives, archive_types=(), arches=())[source]¶
Given a list of archives (or RPMs dressed up like archives), return a new list of those archives which are of the given archive types.
- gather_build_archives(session, binfo, btype=None, rpmkeys=(), path=None)[source]¶
Produce a list of archive dicts associated with a build info, optionally filtered by build-type and signing keys (for RPMs). The archives will be decorated with an additional "filepath" entry, the value of which is an expanded path to the file itself.
This is very similar to the file listing that is baked into the koji buildinfo command.
Koji does not normally consider RPMs to be archives, but we will attempt to homogenize them together.
- Parameters:
session (ClientSession) -- an active koji client session
binfo (int | str | BuildInfo) -- Build info to fetch archives for
btype (str | None) -- BType to filter for. Default None for all types.
rpmkeys (Sequence[str]) -- RPM signatures to filter for, in order of preference. An empty string matches the unsigned copy. Default () for no signature filtering.
path (str | PathInfo | None) -- The root dir for the archive file paths, default None
- Raises:
NoSuchBuild -- if binfo could not be resolved
- Return type:
List[DecoratedArchiveInfo]
- gather_build_image_archives(session, binfo, path=None)[source]¶
Gathers a list of image archives for a given build_info. The archive records are augmented with an additional "filepath" entry, the value of which is an expanded path to the file itself.
- Parameters:
- Raises:
NoSuchBuild -- if binfo could not be resolved
- Return type:
List[DecoratedArchiveInfo]
- gather_build_maven_archives(session, binfo, path=None)[source]¶
Gathers a list of maven archives for a given build_info. The archive records are augmented with an additional "filepath" entry, the value of which is an expanded path to the file itself.
- Parameters:
- Raises:
NoSuchBuild -- if binfo could not be resolved
- Return type:
List[DecoratedArchiveInfo]
- gather_build_rpms(session, binfo, rpmkeys=(), path=None)[source]¶
Gathers a list of rpm dicts matching the given signature keys from the specified build, and augments them with a filepath
- Parameters:
- Raises:
NoSuchBuild -- if binfo could not be resolved
- Return type:
List[DecoratedRPMInfo]
- gather_build_win_archives(session, binfo, path=None)[source]¶
Gathers a list of Windows archives for a given build_info. The archive records are augmented with an additional "filepath" entry, the value of which is an expanded path to the file itself.
- Parameters:
- Raises:
NoSuchBuild -- if binfo could not be resolved
- Return type:
List[DecoratedArchiveInfo]
- gather_latest_archives(session, tagname, btype=None, rpmkeys=(), inherit=True, path=None)[source]¶
Gather the latest archives from a tag heirarchy. Rules for what constitutes "latest" may change slightly depending on the archive types -- specifically maven.
- Parameters:
session (ClientSession) -- an active koji client session
tagname (int | str | TagInfo) -- Name of the tag to gather archives from
btype (str | None) -- Name of the BType to gather. Default, gather all
rpmkeys (Sequence[str]) -- List of RPM signatures to filter by. Only used when fetching type of rpm or None (all).
inherit (bool) -- Follow tag inheritance, default True
path (str | PathInfo | None) -- Path prefix for archive filepaths.
- Raises:
NoSuchTag -- if specified tag doesn't exist
- Return type:
List[DecoratedArchiveInfo]
- gather_latest_image_archives(session, tagname, inherit=True, path=None)[source]¶
- gather_latest_maven_archives(session, tagname, inherit=True, path=None)[source]¶
Similar to session.getLatestMavenArchives(tagname) but augments the results to include a new "filepath" entry which will point to the matching maven artifact's file location.
- gather_latest_rpms(session, tagname, rpmkeys=(), inherit=True, path=None)[source]¶
Similar to session.getLatestRPMS(tagname) but will filter by available signatures, and augments the results to include a new "filepath" entry which will point to the matching RPM file location.
- Parameters:
session (ClientSession) -- an active koji client session
tagname (int | str | TagInfo) -- Name of the tag to search in for RPMs
rpmkeys (Sequence[str]) -- RPM signatures to filter for, in order of preference. An empty string matches the unsigned copy. Default () for no signature filtering.
inherit (bool) -- Follow tag inheritance, default True
path (str | PathInfo | None) -- The root dir for the archive file paths, default None
- Raises:
NoSuchTag -- if tagname could not be resolved to a tag info
- Return type:
List[DecoratedRPMInfo]
- gather_latest_win_archives(session, tagname, inherit=True, path=None)[source]¶
Similar to session.listTaggedArchives(tagname, type="win") but augments the results to include a new "filepath" entry which will point to the matching maven artifact's file location.
- gather_signed_rpms(session, archives, sigkeys)[source]¶
Given a list of RPM archive dicts, query the session for all the pertinent signature headers, then try and find the best matching signed copy of each RPM. An empty string at the end of sigkeys will allow an unsigned copy to be included if no signed copies match.