Skip to content

Commit 7848214

Browse files
committed
InheritsCheck: process @provides recursively
1 parent 41cd309 commit 7848214

8 files changed

Lines changed: 42 additions & 6 deletions

File tree

NEWS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ pkgcheck 0.10.6 (2021-??-??)
88

99
- add a check for calling EXPORT_FUNCTIONS before further inherits.
1010

11+
- InheritsCheck: process @PROVIDES recursively.
12+
1113
----------------------------
1214
pkgcheck 0.10.5 (2021-08-16)
1315
----------------------------

requirements/install.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ lxml
44
pathspec
55
tree-sitter~=0.19.0
66
snakeoil~=0.9.6
7-
pkgcore~=0.12.3
7+
pkgcore~=0.12.5

requirements/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ requires = [
77
"pathspec",
88
"tree-sitter~=0.19.0",
99
"snakeoil~=0.9.6",
10-
"pkgcore~=0.12.3",
10+
"pkgcore~=0.12.5",
1111
]
1212
build-backend = "setuptools.build_meta"

src/pkgcheck/addons/eclass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class EclassAddon(caches.CachedAddon):
4949
"""Eclass support for various checks."""
5050

5151
# cache registry
52-
cache = caches.CacheData(type='eclass', file='eclass.pickle', version=2)
52+
cache = caches.CacheData(type='eclass', file='eclass.pickle', version=3)
5353

5454
def __init__(self, *args):
5555
super().__init__(*args)
@@ -115,7 +115,7 @@ def update_cache(self, force=False):
115115
except (KeyError, AttributeError):
116116
try:
117117
progress(f'{repo} -- updating eclass cache: {name:<{padding}}')
118-
eclasses[name] = EclassDoc(path, sourced=True)
118+
eclasses[name] = EclassDoc(path, sourced=True, repo=repo)
119119
cache_eclasses = True
120120
except IOError:
121121
continue

src/pkgcheck/checks/codingstyle.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,7 @@ def feed(self, pkg):
676676
used[eclass].append((lineno + 1, name, name))
677677

678678
# allowed indirect inherits
679-
indirect_allowed = set().union(*(
680-
self.eclass_cache[x].indirect_eclasses for x in pkg.inherit))
679+
indirect_allowed = set().union(*(self.eclass_cache[x].provides for x in pkg.inherit))
681680
# missing inherits
682681
missing = used.keys() - pkg.inherit - indirect_allowed - conditional
683682

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
EAPI=7
2+
3+
inherit deep-provided-inherit
4+
5+
DESCRIPTION="Ebuild relying on indirect inherit"
6+
HOMEPAGE="https://github.com/pkgcore/pkgcheck"
7+
SLOT="0"
8+
LICENSE="BSD"
9+
10+
src_prepare() {
11+
inherit_public_func
12+
deep-provided-inherit_public_func
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# @ECLASS: deep-provided-inherit.eclass
2+
# @MAINTAINER:
3+
# Random Person <maintainer@random.email>
4+
# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
5+
# @PROVIDES: provided-inherit
6+
# @BLURB: Stub eclass for testing InheritsCheck.
7+
8+
inherit provided-inherit
9+
10+
11+
# @FUNCTION: deep-provided-inherit_public_func
12+
# @DESCRIPTION:
13+
# Public stub function.
14+
deep-provided-inherit_public_func() { :; }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# @ECLASS: provided-inherit.eclass
2+
# @MAINTAINER:
3+
# Random Person <maintainer@random.email>
4+
# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
5+
# @PROVIDES: inherit
6+
# @BLURB: Stub eclass for testing InheritsCheck.
7+
8+
inherit inherit

0 commit comments

Comments
 (0)