StableKeywordsCheck: detect packages using stable keywords#769
StableKeywordsCheck: detect packages using stable keywords#769falbrechtskirchinger wants to merge 2 commits intopkgcore:masterfrom
Conversation
Add an optional check to scan for packages using stable keywords. This is useful for overlays like ::guru, which require that all packages be keyworded unstable. Signed-off-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
7342501 to
41bd9a7
Compare
thesamesam
left a comment
There was a problem hiding this comment.
It looks reasonable to me.
arthurzam
left a comment
There was a problem hiding this comment.
Please handle those comments. Sorry for long delay
| class StableKeywords(results.PackageResult, results.Error): | ||
| """Package uses stable keywords.""" |
There was a problem hiding this comment.
not a good result name and description - what does it even mean? A developer that gets such error won't understand it's reason.
There was a problem hiding this comment.
Fair point. Does DisallowedStableKeywords sound reasonable to you? If yes, I'd rename stable_keywords to disallowed_stable (mirroring unstable_only).
I've renamed the check, but want to avoid renaming the test data more than once.
Signed-off-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
|
I've renamed the check to I've also added ignored categories ( Pending a final decision on the name, I will rename/regenerate the test data, rebase, and reword the commits. As I mentioned, the check is based on class DisallowedStableKeywordsCheck(OptionalCheck):
"""Scan for packages using stable keywords in repositories where they are not allowed."""
known_results = frozenset({DisallowedStableKeywords})
# acct-group and acct-user eclasses define KEYWORDS
# See https://bugs.gentoo.org/342185
ignored_categories = frozenset({"acct-group", "acct-user"})
def feed(self, pkg):
if pkg.category in self.ignored_categories:
return
arches = {k for k in pkg.keywords if not k.startswith(('~', '-'))}
if not arches:
return
yield DisallowedStableKeywords(arches, pkg=pkg)No addons, and no use of package restrictions. |
Add an optional check to scan for packages using stable keywords. This is useful for overlays like
::guru, which require that all packages be keyworded unstable.The implementation is based on
UnstableOnlyCheck, though strictly copying the restrictions mechanism results inO(N * M), where a simple set intersection could beO(N).The severity was chosen based on the language in the regulations (rule 4): "Stable keywords must not be used." (emphasis mine)
Tests
expected.jsonandfix.patch.