Summary: | portage-3.0.46: emerge --depclean wants to remove dev-lang/python-2.7.18_p16-r1 even though an installed package depends on python:2.7[threads] | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Pavel Goran <via-gentoo> |
Component: | Core - Dependencies | Assignee: | Portage team <dev-portage> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | esigra, gentoo, via-gentoo, zmedico |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
See Also: | https://bugs.gentoo.org/show_bug.cgi?id=249166 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 155723 |
Description
Pavel Goran
2023-11-06 08:52:26 UTC
zac, can you take a look? This kind of behavior is expected if a matching package is listed in /etc/portage/profile/package.provided, so is that the case? (In reply to Zac Medico from comment #2) > This kind of behavior is expected if a matching package is listed in > /etc/portage/profile/package.provided, so is that the case? No, it's not. I don't even have /etc/portage/profile on that system. It looks like build time dependencies have the ignored dep priority attribute set for depclean actions, and that's causing them to be dropped. I'll try to make a test case. (In reply to Zac Medico from comment #4) > It looks like build time dependencies have the ignored dep priority > attribute set for depclean actions, and that's causing them to be dropped. > I'll try to make a test case. From looking at the code, it seems like it could be ignored, but this test case does not reproduce it: > # Copyright 2024 Gentoo Authors > # Distributed under the terms of the GNU General Public License v2 > > from portage.tests import TestCase > from portage.tests.resolver.ResolverPlayground import ( > ResolverPlayground, > ResolverPlaygroundTestCase, > ) > > > class DepcleanBdepsTestCase(TestCase): > def testDepcleanBdeps(self): > installed = { > "www-client/firefox-52.9.0-r1": { > "EAPI": "8", > "DEPEND": "dev-lang/python:2.7", > }, > "dev-lang/python-2.7.18_p16-r1": {"SLOT": "2.7"}, > } > > world = ("www-client/firefox",) > > test_cases = ( > ResolverPlaygroundTestCase( > [], > options={"--depclean": True}, > success=True, > cleanlist=[], > ), > ResolverPlaygroundTestCase( > [], > options={"--depclean": True, "--with-bdeps": "n"}, > success=True, > cleanlist=["dev-lang/python-2.7.18_p16-r1"], > ), > ) > > playground = ResolverPlayground(installed=installed, world=world, debug=True) > 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.debug = False > playground.cleanup() (In reply to Zac Medico from comment #5) > From looking at the code, it seems like it could be ignored Looking again at the code, the ignored attribute is only True for --with-bdeps=n here, so it should not be ignored: depend_root, edepend["DEPEND"], self._priority( cross=self._cross(pkg.root), buildtime=True, optional=(pkg.built or ignore_depend_deps), ignored=ignore_depend_deps, ), The test case debug output shows it as a "soft" dependency rather than "ignored": (www-client/firefox-52.9.0-r1:0/0::test_repo, installed) depends on (dev-lang/python-2.7.18_p16-r1:2.7/2.7::test_repo, installed) (soft) It must be because the "threads" USE flag was dropped here: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=742eeca02a0d06a56f6a69af55bcbcdf42f18ba1 commit 742eeca02a0d06a56f6a69af55bcbcdf42f18ba1 Author: Michał Górny <mgorny@gentoo.org> Date: 2021-08-31 10:22:13 +0200 dev-lang/python: Enable threads unconditionally in <3.7 too Signed-off-by: Michał Górny <mgorny@gentoo.org> Because of that, your installed dev-lang/python-2.7.18_p16-r1 does not match the firefox dependency. Since it's a DEPEND, it's build-time only and does not trigger any warning or error when it is unsatisfied. The "threads" USE flag first became optional in firefox ebuilds with this commit from bug 679582: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed2ace908b4d5dc23d0f3b873f6d5df867f513d5 commit ed2ace908b4d5dc23d0f3b873f6d5df867f513d5 Author: Thomas Deutschmann <whissi@gentoo.org> Date: 2019-03-08 21:33:03 +0100 mozcoreconf-v6.eclass: add still required Python 2.7 dependency In commit 9d973365a74e58731b62caae87d4ad521c90d947 and af9298355290622e1ab2ec5253550e6b8196722a Python 3 support was added and PYTHON_COMPAT was moved from eclass to ebuild as requested by QA. However, Python 2 dependency, which is still required, was lost. This commit will bring back Python 2 dependency. Note that we use python-any-r1_pkg_setup in moz_pkgsetup to initialize Python 3 via PYTHON_COMPAT but we will switch back to Python 2 manually using python_export later. Closes: https://bugs.gentoo.org/679582 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> Note in bug 249166 comment #6 the idea that "package manager should be warning or erroring" about flags not listed in IUSE. We could definitely trigger a warning here. The dbapi _match_use method and match_from_list function are the obvious places to detect and warn about the missing IUSE, but they we don't have access to the parent package in these locations, so there's not enough information to emit a really useful warning message here. So, we should probably add a function to detect this case and trigger the warning when we encounter an unsatisfied dependency in the depgraph. So, is the following the correct summary of the situation: emerge --depclean doesn't pick up firefox's dependence on python because this dependency (1) is a build-time dependency and (2) isn't fully satisfied by the installed python package because of missing USE="threads"? Or the second factor (missing USE) would solely trigger this behaviour, too? (In reply to Pavel Goran from comment #11) > So, is the following the correct summary of the situation: emerge --depclean > doesn't pick up firefox's dependence on python because this dependency (1) > is a build-time dependency With the default --with-bdeps=y behavior of depclean, build-time dependencies have an "optional" attribute set to True, and optional dependencies are silently ignored if they are unsatisfied. > and (2) isn't fully satisfied by the installed > python package because of missing USE="threads"? Or the second factor > (missing USE) would solely trigger this behaviour, too? Depclean has a boolean allow_missing_deps flag which is True if there are package arguments and False if there are no package arguments. Regardless of the allow_missing_deps flag, optional build-time dependencies are silently ignored if they are unsatisfied, but runtime dependencies trigger an error like this if they are unsatisfied and the allow_missing_deps flag is False (no package arguments): > * Dependencies could not be completely resolved due to > * the following required packages not being installed: > * > * >=dev-lang/python-2.7.5-r2:2.7[ncurses,sqlite,ssl,threads] pulled in by: > * www-client/firefox-52.9.0-r1 > * > * Have you forgotten to do a complete update prior to depclean? The > * most comprehensive command for this purpose is as follows: > * > * emerge --update --newuse --deep --with-bdeps=y @world Regardless of depclean options, this error will never trigger for the firefox dependency on python because it is build-time only. We can fix it to trigger special behavior for build-time dependencies that are unsatisfied due to USE. We can make it either a warning or an error. We can treat it more severely when the flag is missing from IUSE, as noted in bug 249166 comment #6, since this case is exceptional. |