Skip to content

Commit be92740

Browse files
committed
BadPackageUpdate: fix when not run inside profiles/ dir
When we weren't inside profiles/ dir, we were running the VisibilityCheck check. This check was collecting repo.config.updates. This one is cached, resulting in the value not being recomputed when time comes for PackageUpdatesCheck to run. This commit fixes this by making sure we invalidate the cache. Sadly the object we're using to store config is Immutable, resulting in a very ugly hack to invalidate the cache, by using the __dict__ attribute of the object. This is not a good practice, but it works. Reported-by: Eli Schwartz <eschwartz@gentoo.org> Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent 0abdd45 commit be92740

4 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/pkgcheck/checks/repo_metadata.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def finish(self):
105105
base.LogMap("pkgcore.log.logger.error", BadPackageUpdate),
106106
)
107107

108+
del self.repo.config.__dict__["_updates"] # clear cache for immutable dict
108109
# convert log warnings/errors into reports
109110
with base.LogReports(*logmap) as log_reports:
110111
repo_updates = self.repo.config.updates
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"__class__": "BadPackageUpdate", "msg": "file '1Q-2024': 'move <=stub/old-name-1.2.3.4 stub/stable' on line 3: atom <=stub/old-name-1.2.3.4 must be versionless"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"__class__": "OldPackageUpdate", "pkg": "stub/random-pkgname", "updates": ["move", "VisibilityCheck/OldPackageName", "stub/random-pkgname"]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
move stub/old-name stub/stable
22
move VisibilityCheck/OldPackageName stub/random-pkgname
3+
move <=stub/old-name-1.2.3.4 stub/stable

0 commit comments

Comments
 (0)