pkgcore.ebuild.keywording module¶
Resolving a keywording or stabilization request against a repo.
A request is a list of package specs, each with the arches it asks for, in the form Gentoo’s arch teams use:
=dev-libs/foo-1.2.3 amd64 x86 # stabilize this exact version
dev-libs/bar ~ppc64 # keyword any suitable version
Three keyword sentinels are understood: ALL_KEYWORDS expands to the
arches the package could plausibly be requested for, SAME_KEYWORDS
repeats the line above, and NO_KEYWORDS skips the line.
match_packages() turns that into concrete packages and arches. It knows
nothing about where the request came from; pkgcore.bugzilla.Bug.match_packages()
is the binding for one that came off a bug.
- exception pkgcore.ebuild.keywording.KeywordNoMatch[source]¶
Bases:
PackageMatchExceptionA keyword isn’t known to the repo, or a sentinel can’t be resolved
- exception pkgcore.ebuild.keywording.KeywordNoneLeft[source]¶
Bases:
PkgcoreExceptionNo keywords were given and there are none left to suggest.
Deliberately not a
PackageMatchException: the request is fine, it simply has nothing to do, and a caller reporting broken requests must not treat this as one.
- exception pkgcore.ebuild.keywording.KeywordNotSpecified(packages: Iterable[str], message: str = '')[source]¶
Bases:
PackageMatchExceptionSome packages were left without keywords
- class pkgcore.ebuild.keywording.KeywordRequest(pkg: package, keywords: list[str])[source]¶
Bases:
NamedTupleA matched package and the arches requested for it
- exception pkgcore.ebuild.keywording.PackageInvalid[source]¶
Bases:
PackageMatchExceptionA spec isn’t one this kind of request may carry
- exception pkgcore.ebuild.keywording.PackageListDoneAlready[source]¶
Bases:
PackageListEmptyNothing was left because every package is keyworded already
- exception pkgcore.ebuild.keywording.PackageListEmpty[source]¶
Bases:
PackageMatchExceptionNothing was left to act on
- exception pkgcore.ebuild.keywording.PackageMatchException[source]¶
Bases:
PkgcoreExceptionThe request can’t be resolved as written.
Callers routinely catch this broadly to report a request as unusable, which is why
KeywordNoneLeftdeliberately sits outside it.
- exception pkgcore.ebuild.keywording.PackageNoMatch[source]¶
Bases:
PackageMatchExceptionA spec parses but matches nothing in the repo
- pkgcore.ebuild.keywording.can_stabilize_allarches(repo: UnconfiguredTree, requests: Iterable[tuple[package, Iterable[str]]]) bool[source]¶
Whether every package already has a stable version on every arch asked for.
That is the precondition for one arch team stabilizing on behalf of all of them: nobody is being asked to take on an arch they never had.
- Parameters:
repo – repo to look for the packages’ other versions in
requests – packages paired with the arches asked for
- Returns:
whether an all-arches stabilization is permissible
- pkgcore.ebuild.keywording.filter_prefix_keywords(keywords: Iterable[str]) list[str][source]¶
Drop prefix keywords, e.g.
x86-macosor*-fbsd
- pkgcore.ebuild.keywording.match_packages(repo: UnconfiguredTree, requested: Iterable[tuple[atom, Sequence[str]]], *, stable: bool, cc_arches: Sequence[str] = (), only_new: bool = False, filter_arch: Iterable[str] = (), allarches: bool = False) Iterator[KeywordRequest][source]¶
Match
requestedspecs againstrepo, yielding packages and arches.- Parameters:
repo – repo to resolve the specs against
requested – each package spec paired with the keywords written for it, in order, since
SAME_KEYWORDSrefers to the line abovestable – select stabilization semantics: only
=specs are allowed, andALL_KEYWORDSmeans “arches stable elsewhere” rather than “arches keyworded elsewhere”cc_arches – the arches the request is addressed to. A line with no keywords of its own inherits them; a line with keywords is narrowed to them, and one left with nothing is skipped
only_new – drop the arches the package already carries
filter_arch – keep only the arches listed
allarches – re-add every candidate arch on top of
filter_arch, for an all-arches stabilization
- Returns:
the matched packages, each with the arches to request for it
- Raises:
PackageMatchException – if the request can’t be resolved
KeywordNoneLeft – if nothing was specified and nothing is left
- pkgcore.ebuild.keywording.select_best_version(matches: Iterable[package]) package | None[source]¶
Pick the version a request without an exact one should act on.
The newest keyworded version wins; failing that the newest non-live one, since a live ebuild is never what a keywording request means.
- Parameters:
matches – candidate packages, in any order
- Returns:
the version to act on, or None if there were no candidates
- pkgcore.ebuild.keywording.suggested_keywords(repo: UnconfiguredTree, pkg: package, *, stable: bool) frozenset[str][source]¶
The arches
ALL_KEYWORDSexpands to forpkg.Stabilizing, that is the arches already stable on some other version and
~archon this one. Keywording, it is the arches present on some other version and missing here. Prefix keywords are never suggested.- Parameters:
repo – repo to look for the package’s other versions in
pkg – the version the request names
stable – whether the request is a stabilization
- Returns:
the arches to request, unordered