kojismokydingo.sift.tags

Koji Smoky Dingo - Sifty Dingo filtering for Koji Tags

This module provides sieves for filtering through koji tag info dicts.

author:

Christopher O'Brien <obriencj@gmail.com>

license:

GPL v3

class ArchSieve(sifter, *tokens)[source]

Bases: MatcherSieve

usage: (arch [ARCH...])

If no ARCH patterns are specified, matches tags which have any architectures at all.

If ARCH patterns are specified, then only matches tags which have an architecture that matches any of the given patterns.

check(session, taginfo)[source]

Override to return True if the predicate matches the given info dict.

This is used by the default run implementation in a filter. Only the info dicts which return True from this method will be included in the results.

Parameters:

info -- The info dict to be checked.

name = 'arch'
prep(session, taginfos)[source]

Override if some bulk pre-loading operations are necessary.

This is used by the default run implementation to allow bulk operations to be performed over the entire set of info dicts to be filtered, rather than one at a time in the check method

class BuildTagSieve(sifter, *tokens)[source]

Bases: TargetSieve

usage: (build-tag [TARGET...])

If no TARGET is specified, then matches tags which are used as the build tag for any target.

If any TARGET patterns are specified, then matches tags which are used as the build tag for a target with a name matching any of the patterns.

name = 'build-tag'
prep_targets(session, tagids)[source]
class CompareLatestSieve(sifter, pkgname, op='>=', ver='0')[source]

Bases: Sieve

usage: (compare-latest PKG [OP VER])

If OP and VER are not specified, matches tags which have any build of the given package name as latest.

If OP and VER are specified, matches tags which have the a latest build of the given package name which compare correctly. If tag doesn't have any build of the given package name, it will not match.

check(session, taginfo)[source]

Override to return True if the predicate matches the given info dict.

This is used by the default run implementation in a filter. Only the info dicts which return True from this method will be included in the results.

Parameters:

info -- The info dict to be checked.

name = 'compare-latest'
prep(session, taginfos)[source]

Override if some bulk pre-loading operations are necessary.

This is used by the default run implementation to allow bulk operations to be performed over the entire set of info dicts to be filtered, rather than one at a time in the check method

class DestTagSieve(sifter, *tokens)[source]

Bases: TargetSieve

usage: (dest-tag [TARGET...])

If no TARGET is specified, then matches tags which are used as the destination tag for any target.

If any TARGET patterns are specified, then matches tags which are used as the destination tag for a target with a name matching any of the patterns.

name = 'dest-tag'
prep_targets(session, tagids)[source]
class ExactArchSieve(sifter, *tokens)[source]

Bases: SymbolSieve

usage: (exact-arch [ARCH...])

If no ARCH names are specified, matches only tags which have no architectures.

If ARCH names are specified, they must be specified as symbols. Only matches tags which have the exact same set of architectures.

check(session, taginfo)[source]

Override to return True if the predicate matches the given info dict.

This is used by the default run implementation in a filter. Only the info dicts which return True from this method will be included in the results.

Parameters:

info -- The info dict to be checked.

get_info_cache(tinfo)[source]

Gets a cache dict from the sifter using the name of this sieve and the sifter's designated key for the given info dict. The default sifter key will get the "id" value from the info dict.

The same cache dict will be returned for this info dict until the sifter has its reset method invoked.

name = 'exact-arch'
class GroupPkgSieve(sifter, group, pkg, *pkgs, require_all=False)[source]

Bases: SymbolSieve, CacheMixin

usage: (group-pkg GROUP PKG [PKG...] [require_all: False])

Matches tags which have the given install group, which also contains any of the given PKG names

check(session, taginfo)[source]

Override to return True if the predicate matches the given info dict.

This is used by the default run implementation in a filter. Only the info dicts which return True from this method will be included in the results.

Parameters:

info -- The info dict to be checked.

name = 'group-pkg'
prep(session, taginfos)[source]

Override if some bulk pre-loading operations are necessary.

This is used by the default run implementation to allow bulk operations to be performed over the entire set of info dicts to be filtered, rather than one at a time in the check method

class GroupSieve(sifter, group, *groups)[source]

Bases: SymbolSieve, CacheMixin

usage: (group GROUP [GROUP...])

Matches tags which have any of the given install groups configured. Honors inheritance.

check(session, taginfo)[source]

Override to return True if the predicate matches the given info dict.

This is used by the default run implementation in a filter. Only the info dicts which return True from this method will be included in the results.

Parameters:

info -- The info dict to be checked.

name = 'group'
prep(session, taginfos)[source]

Override if some bulk pre-loading operations are necessary.

This is used by the default run implementation to allow bulk operations to be performed over the entire set of info dicts to be filtered, rather than one at a time in the check method

class HasAncestorSieve(sifter, *tokens)[source]

Bases: InheritanceSieve

usage: (has-ancestor [TAG...]) alias: (inherits-from [TAG...])

If no TAG patterns are specified, matches tags which have any parents.

If TAG patterns are specified, matches tags which have a parent at any depth matching any of the given patterns.

aliases: Sequence[str] = ['inherits-from']
name = 'has-ancestor'
prep_inheritance(session, tagids)[source]
class HasChildSieve(sifter, *tokens)[source]

Bases: InheritanceSieve

usage: (has-child [TAG...]) alias: (parent-of [TAG...])

If no TAG patterns are specified, matches tags which are the direct parent to any other tag.

If TAG patterns are specified, matches tags which are the direct parent to any tag matching any of the given patterns.

aliases: Sequence[str] = ['parent-of']
name = 'has-child'
prep_inheritance(session, tagids)[source]
class HasDescendantSieve(sifter, *tokens)[source]

Bases: InheritanceSieve

usage: (has-descendant [TAG...]) alias: (inherited-by [TAG...])

If no TAG patterns are specified, matches tags which are inherited by any other tag.

If TAG patterns are specified, matches tags which are inherited by any tag matching any of the patterns, at any depth.

aliases: Sequence[str] = ['inherited-by']
name = 'has-descendant'
prep_inheritance(session, tagids)[source]
class HasParentSieve(sifter, *tokens)[source]

Bases: InheritanceSieve

usage: (has-parent [TAG...]) alias: (child-of [TAG...])

If no TAG patterns are specified, matches tags which have any parents.

If TAG patterns are specified, matchs tags which have any direct parent matching any of the given patterns.

aliases: Sequence[str] = ['child-of']
name = 'has-parent'
prep_inheritance(session, tagids)[source]
class LatestSieve(sifter, *exprs)[source]

Bases: NVRSieve

usage: (latest [NVR...])

If no NVR is specified, matches tags which have any builds tagged in them or inherited from parent tags.

If NVR is specified, matches tags which have any of the given builds as the latest inherited build of the relevant package name. Each NVR must be valid a reference to a build in this koji instance, or a NoSuchBuild exception will be raised.

name = 'latest'
prep_count(session, tagids)[source]
prep_tagged(session, pkgname, tagids)[source]
class LockedSieve(sifter)[source]

Bases: Sieve

usage: (locked)

Matches tags which have been locked

check(session, taginfo)[source]

Override to return True if the predicate matches the given info dict.

This is used by the default run implementation in a filter. Only the info dicts which return True from this method will be included in the results.

Parameters:

info -- The info dict to be checked.

name = 'locked'
class NameSieve(sifter, *exprs)[source]

Bases: ItemSieve

Usage: (name NAME [NAME...])

filters for dict infos whose name matches any of the given NAME matchers.

field = 'name'
name = 'name'
class PermissionSieve(sifter, *tokens)[source]

Bases: MatcherSieve

usage: (permission [PERM...])`

If no PERM is specified, then matches tags which have any non-None permission set.

If any PERM patters are specified, then matches tags which have any of the listed permissions set.

check(session, taginfo)[source]

Override to return True if the predicate matches the given info dict.

This is used by the default run implementation in a filter. Only the info dicts which return True from this method will be included in the results.

Parameters:

info -- The info dict to be checked.

name = 'permission'
class PkgAllowedSieve(sifter, pkgname, *pkgnames)[source]

Bases: PkgListSieve

usage: (pkg-allowed PKG [PKG...])

Matches tags which have a package listing with any of the given PKG contained therein and not blocked, honoring inheritance.

check(session, taginfo)[source]

Override to return True if the predicate matches the given info dict.

This is used by the default run implementation in a filter. Only the info dicts which return True from this method will be included in the results.

Parameters:

info -- The info dict to be checked.

name = 'pkg-allowed'
class PkgBlockedSieve(sifter, pkgname, *pkgnames)[source]

Bases: PkgListSieve

usage: (pkg-blocked PKG [PKG...])

Matches tags which have a package listing with any of the given PKG contained therein and blocked, honoring inheritance.

check(session, taginfo)[source]

Override to return True if the predicate matches the given info dict.

This is used by the default run implementation in a filter. Only the info dicts which return True from this method will be included in the results.

Parameters:

info -- The info dict to be checked.

name = 'pkg-blocked'
class PkgUnlistedSieve(sifter, pkgname, *pkgnames)[source]

Bases: PkgListSieve

usage: (pkg-unlisted PKG [PKG...])

Matches tags which have no package listing (neither allowed nor blocked) for any of the given PKG names. Honors inheritance.

check(session, taginfo)[source]

Override to return True if the predicate matches the given info dict.

This is used by the default run implementation in a filter. Only the info dicts which return True from this method will be included in the results.

Parameters:

info -- The info dict to be checked.

name = 'pkg-unlisted'
class TaggedSieve(sifter, *exprs)[source]

Bases: NVRSieve

usage: (tagged [NVR...])

If no NVR is specified, matches tags which have any builds tagged in them.

If NVR is specified, matches tags which have any of the given builds tagged in them. Each NVR must be a valid reference to a build in this koji instance, or a NoSuchBuild exception will be raised.

name = 'tagged'
prep_count(session, tagids)[source]
prep_tagged(session, pkgname, tagids)[source]
sift_tagnames(session, src_str, names, params=None)[source]
Parameters:
  • session (ClientSession) -- an active koji client session

  • src_str (str) -- sieve expressions source

  • names (Iterable[str | int]) -- list of tag names to load and filter

  • params (Dict[str, str] | None) -- sieve parameters

Returns:

mapping of flags to matching tag info dicts

Return type:

Dict[str, List[TagInfo]]

sift_tags(session, src_str, tag_infos, params=None)[source]
Parameters:
  • session (ClientSession) -- an active koji client session

  • src_str (str) -- sieve expressions source

  • build_infos -- list of tag info dicts to filter

  • params (Dict[str, str] | None) -- sieve parameters

  • tag_infos (Iterable[TagInfo])

Returns:

mapping of flags to matching tag info dicts

Return type:

Dict[str, List[TagInfo]]

tag_info_sieves()[source]

A new list containing the default tag-info sieve classes.

This function is used by tag_info_sifter when creating its Sifter instance.

Return type:

List[Type[Sieve]]

tag_info_sifter(source, params=None)[source]

Create a Sifter from the source using the default tag-info Sieves.

Parameters:
  • source (str) -- sieve expressions source

  • params (Dict[str, str] | None) -- sieve parameters

Return type:

Sifter