commit: c56ca69564452198039e17b3a07f24f5b87a6852 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Mon Nov 6 15:03:10 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Nov 6 15:57:56 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c56ca695
emerge: fix _show_ignored_binaries_respect_use with incomplete depgraph I've gone for the simpler solution of just using an empty tuple where the merge list is empty to preserve prior behaviour with what we do (or do not) display wrt skipped binaries. Bug: https://bugs.gentoo.org/916614 Signed-off-by: Sam James <sam <AT> gentoo.org> NEWS | 2 + lib/_emerge/depgraph.py | 4 +- lib/portage/tests/resolver/test_useflags.py | 89 +++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4a33559a33..89d9335275 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,8 @@ Bug fixes: * Avoid crash with incomplete depgraph for binpkg-respect-use notice (bug #916614). +* Avoid crash with blockers in depgraph for binpkg-respect-use notice (bug #916336). + portage-3.0.54 (2023-10-25) -------------- diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index d1fed0d652..e4305c18c9 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -1234,11 +1234,13 @@ class depgraph: def _show_ignored_binaries_respect_use(self, respect_use): seen = {} messages = [] + merging = { (pkg.root, pkg.cpv) - for pkg in self._dynamic_config._displayed_list + for pkg in self._dynamic_config._displayed_list or () 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.root, pkg.cpv) not in merging: diff --git a/lib/portage/tests/resolver/test_useflags.py b/lib/portage/tests/resolver/test_useflags.py index ee9f4f2763..86684f7f28 100644 --- a/lib/portage/tests/resolver/test_useflags.py +++ b/lib/portage/tests/resolver/test_useflags.py @@ -229,3 +229,92 @@ class UseFlagsTestCase(TestCase): ) finally: playground.cleanup() + + def testNoMergeBinpkgRespectUse(self): + """ + Testcase for bug #916614 where an incomplete depgraph may be fed into + _show_ignored_binaries_respect_use. + + We use a mix of +/-abi_x86_32 to trigger the binpkg-respect-use notice + and depend on a non-existent package in one of the available ebuilds we + queue to reinstall to trigger an aborted calculation. + """ + ebuilds = { + "dev-libs/A-2": { + "EAPI": "7", + "IUSE": "abi_x86_32", + }, + "dev-libs/B-1": { + "IUSE": "abi_x86_32", + "RDEPEND": "=dev-libs/A-1", + }, + } + + installed = { + "dev-libs/B-1": { + "IUSE": "abi_x86_32", + "USE": "abi_x86_32", + }, + "dev-libs/A-1": { + "IUSE": "abi_x86_32", + "USE": "abi_x86_32", + }, + } + + binpkgs = { + "dev-libs/A-2": { + "IUSE": "abi_x86_32", + "USE": "abi_x86_32", + }, + "dev-libs/B-1": { + "IUSE": "abi_x86_32", + "USE": "", + "BUILD_ID": "2", + "BUILD_TIME": "2", + }, + } + + user_config = { + "make.conf": ( + 'FEATURES="binpkg-multi-instance"', + 'USE="abi_x86_32 abi_x86_32"', + ), + } + + world = ("dev-libs/A",) + + test_cases = ( + ResolverPlaygroundTestCase( + ["@installed"], + options={ + "--verbose": "y", + "--emptytree": True, + "--usepkg": True, + }, + success=False, + mergelist=["[binary]dev-libs/A-2", "dev-libs/B-1"], + slot_collision_solutions=[], + ), + ) + + 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()
