diff options
author | Sam James <sam@gentoo.org> | 2023-10-30 05:30:04 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-11-06 15:57:56 +0000 |
commit | 262b8c9213c6698be4a7e2ce88536568899e6c2a (patch) | |
tree | 4b2c2df6c08e3062d748231257eb3587f3e045fc | |
parent | Use documented os.register_at_fork function (diff) | |
download | portage-262b8c9213c6698be4a7e2ce88536568899e6c2a.tar.gz portage-262b8c9213c6698be4a7e2ce88536568899e6c2a.tar.bz2 portage-262b8c9213c6698be4a7e2ce88536568899e6c2a.zip |
emerge: fix binpkg-respect-use notice with blockers
Items in _dynamic_config._displayed_list might be blockers, so filter those out.
Bug: https://bugs.gentoo.org/916336
Fixes: bb82666b48e18f448661a1a8bf6a39b773cc4b1c
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | lib/_emerge/depgraph.py | 6 | ||||
-rw-r--r-- | lib/portage/tests/resolver/test_useflags.py | 87 |
3 files changed, 94 insertions, 1 deletions
@@ -13,6 +13,8 @@ Bug fixes: * Convert portageq helper to a function to avoid breaking external callers (bug #916287, bug #916296). +* Avoid crash with incomplete depgraph for binpkg-respect-use notice (bug #916614). + portage-3.0.54 (2023-10-25) -------------- diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 85845dc1e..0717e0429 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -1234,7 +1234,11 @@ class depgraph: def _show_ignored_binaries_respect_use(self, respect_use): seen = {} messages = [] - merging = {pkg.cpv for pkg in self._dynamic_config._displayed_list} + merging = { + pkg.cpv + for pkg in self._dynamic_config._displayed_list + if isinstance(pkg, Package) + } for pkg, flags in respect_use.items(): # Don't include recursive deps which aren't in the merge list anyway. if pkg.cpv not in merging: diff --git a/lib/portage/tests/resolver/test_useflags.py b/lib/portage/tests/resolver/test_useflags.py index 0af1cb558..ee9f4f276 100644 --- a/lib/portage/tests/resolver/test_useflags.py +++ b/lib/portage/tests/resolver/test_useflags.py @@ -142,3 +142,90 @@ class UseFlagsTestCase(TestCase): ) finally: playground.cleanup() + + def testBlockerBinpkgRespectUse(self): + """ + Test for bug #916336 where we tried to check properties of a blocker + object which isn't a Package to be merged. + """ + + ebuilds = { + "dev-libs/A-1": { + "EAPI": "7", + "IUSE": "abi_x86_32", + "RDEPEND": "dev-libs/B", + }, + "dev-libs/B-1": { + "EAPI": "7", + "IUSE": "abi_x86_32", + }, + "dev-libs/A-2": { + "EAPI": "7", + "IUSE": "abi_x86_32", + "RDEPEND": "!<dev-libs/B-2", + }, + "dev-libs/B-2": { + "EAPI": "7", + "IUSE": "abi_x86_32", + }, + } + installed = { + "dev-libs/A-1": { + "IUSE": "abi_x86_32", + "USE": "abi_x86_32", + }, + "dev-libs/B-1": { + "IUSE": "abi_x86_32", + "USE": "abi_x86_32", + }, + } + binpkgs = ebuilds.copy() + + user_config = { + "make.conf": ( + 'FEATURES="binpkg-multi-instance"', + 'USE="abi_x86_32 abi_x86_32"', + ), + } + + world = ("dev-libs/A",) + + test_cases = ( + ResolverPlaygroundTestCase( + ["dev-libs/A"], + options={ + "--verbose": "y", + "--update": True, + "--deep": True, + "--complete-graph": True, + "--usepkg": True, + "--autounmask": "n", + "--autounmask-backtrack": "n", + "--autounmask-use": "n", + }, + success=True, + mergelist=["dev-libs/A-2", "[uninstall]dev-libs/B-1", "!<dev-libs/B-2"], + ), + ) + + for binpkg_format in SUPPORTED_GENTOO_BINPKG_FORMATS: + with self.subTest(binpkg_format=binpkg_format): + print(colorize("HILITE", binpkg_format), end=" ... ") + sys.stdout.flush() + user_config["make.conf"] += (f'BINPKG_FORMAT="{binpkg_format}"',) + playground = ResolverPlayground( + ebuilds=ebuilds, + binpkgs=binpkgs, + installed=installed, + user_config=user_config, + world=world, + ) + + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual( + test_case.test_success, True, test_case.fail_msg + ) + finally: + playground.cleanup() |