Summary: | emerge --depclean: wrong order of cleaning with circular dependencies and IDEPEND (which breaks pkg_* phases) | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Andrei Horodniceanu <a.horodniceanu> |
Component: | Core - Dependencies | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | esigra, flow |
Priority: | Normal | Keywords: | InVCS |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://github.com/gentoo/portage/pull/1147 https://bugs.gentoo.org/show_bug.cgi?id=920242 https://github.com/gentoo/portage/pull/1212 https://github.com/gentoo/portage/pull/1216 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 919862 | ||
Bug Blocks: | 155723 |
Description
Andrei Horodniceanu
2023-10-22 19:03:58 UTC
In https://github.com/gentoo/portage/pull/1212 I've handled direct circular dependencies, but it is possible that indirect circular dependencies may still trigger problems with the unmerge order (for example if there was a virtual/ldc2 which made this an indirect circular dependency). The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=bf3d091de8702f0c95e5530d03c6e925008ee80a commit bf3d091de8702f0c95e5530d03c6e925008ee80a Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2023-12-24 05:12:55 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2023-12-24 19:29:25 +0000 depclean: drop direct circular deps in merge order calculation Drop direct circular deps in the depclean merge order calculation, since it does not handle them well as shown by the test case for bug 916135. Bug: https://bugs.gentoo.org/916135 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/_emerge/actions.py | 8 ++++++-- lib/portage/tests/resolver/test_depclean_order.py | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) https://gitweb.gentoo.org/proj/portage.git/commit/?id=eeb4c29a64927efbaa7028153230367651bcf3b7 commit eeb4c29a64927efbaa7028153230367651bcf3b7 Author: Andrei Horodniceanu <a.horodniceanu@proton.me> AuthorDate: 2023-10-21 14:38:36 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2023-12-24 19:29:16 +0000 tests/resolver: test depclean order with IDEPEND and circular deps Bug: https://bugs.gentoo.org/916135 Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me> Closes: https://github.com/gentoo/portage/pull/1147 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/portage/tests/resolver/test_depclean_order.py | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) (In reply to Zac Medico from comment #1) > In https://github.com/gentoo/portage/pull/1212 I've handled direct circular > dependencies, but it is possible that indirect circular dependencies may > still trigger problems with the unmerge order (for example if there was a > virtual/ldc2 which made this an indirect circular dependency). You can get indirect circular dependencies by having 2 ldc2 versions build each other, for example ldc2:1.35 was built with ldc2:1.34 and ldc2:1.34 was built with ldc2:1.35. As you guessed, the unmerge order is the wrong one because of the 1-layer indirection. To handle indirect circular dependencies, we can increase the priority of IDEPEND relative to RDEPEND. Here's a test case that shows the incorrect order: def testCircularDepclean(self): """ Test for bug 916135, where an indirect circular dependency caused the unmerge order to fail to account for IDEPEND. """ ebuilds = { "dev-util/A-1": {}, "dev-libs/B-1": { "EAPI": "8", "SLOT": "1", "IDEPEND": "dev-util/A", "RDEPEND": "dev-libs/B:=", }, "dev-libs/B-2": { "EAPI": "8", "SLOT": "2", "IDEPEND": "dev-util/A", "RDEPEND": "dev-libs/B:=", }, "dev-libs/C-1": {}, } installed = { "dev-util/A-1": {}, "dev-libs/B-1": { "EAPI": "8", "SLOT": "1", "IDEPEND": "dev-util/A", "RDEPEND": "dev-libs/B:2/2=", }, "dev-libs/B-2": { "EAPI": "8", "SLOT": "2", "IDEPEND": "dev-util/A", "RDEPEND": "dev-libs/B:1/1=", }, "dev-libs/C-1": {}, } world = ("dev-libs/C",) test_cases = ( # Remove dev-libs/B first because it IDEPENDs on dev-util/A ResolverPlaygroundTestCase( [], options={"--depclean": True}, success=True, ordered=True, cleanlist=["dev-util/A-1", "dev-libs/B-1", "dev-libs/B-2"], ), ) playground = ResolverPlayground( ebuilds=ebuilds, installed=installed, 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() The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=64b16b76611e14ff0b38b762486f073039f21a05 commit 64b16b76611e14ff0b38b762486f073039f21a05 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2023-12-25 02:53:57 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2023-12-26 21:04:25 +0000 depclean: Strengthen IDEPEND in unmerge order Increase priority of IDEPEND so that it is stronger than RDEPEND in unmerge order calculations. This causes IDEPEND to be unmerged afterwards when packages are involved in RDEPEND cycles. Bug: https://bugs.gentoo.org/916135 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/_emerge/AbstractDepPriority.py | 3 +- lib/_emerge/UnmergeDepPriority.py | 35 +++++++------ lib/_emerge/actions.py | 5 +- lib/_emerge/depgraph.py | 4 +- lib/portage/tests/resolver/test_depclean_order.py | 63 +++++++++++++++++++++++ 5 files changed, 92 insertions(+), 18 deletions(-) The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a1f19cdd7a598070b7eb08b3954e677aa4868ad commit 0a1f19cdd7a598070b7eb08b3954e677aa4868ad Author: Sam James <sam@gentoo.org> AuthorDate: 2023-12-27 21:27:55 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-12-27 21:28:01 +0000 sys-apps/portage: add 3.0.59 Closes: https://bugs.gentoo.org/587088 Closes: https://bugs.gentoo.org/822033 Closes: https://bugs.gentoo.org/915494 Closes: https://bugs.gentoo.org/916135 Closes: https://bugs.gentoo.org/917120 Closes: https://bugs.gentoo.org/919862 Closes: https://bugs.gentoo.org/920095 Closes: https://bugs.gentoo.org/920258 Closes: https://bugs.gentoo.org/920537 Closes: https://bugs.gentoo.org/920654 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.59.ebuild | 246 +++++++++++++++++++++++++++++++++ 2 files changed, 247 insertions(+) |