The log attached to bug 756793 comment 5 shows that it selects dev-lang/rust-bin-1.46.0 event though dev-lang/rust-1.46.0 is installed, which may be a misbehavior of the change related to bug 705986: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef66aab178180288132177011ad0e910fb2cd55e > Parent: (dev-lang/rust-1.47.0-r2:stable/1.47::gentoo, ebuild scheduled for merge) > Depstring: || ( dev-lang/python:3.9 dev-lang/python:3.8 dev-lang/python:3.7 dev-lang/python:3.6 ) || ( >=sys-devel/gcc-4.7 >=sys-devel/clang-3.5 ) || ( =dev-lang/rust-1.46* =dev-lang/rust-bin-1.46* =dev-lang/rust-1.47* =dev-lang/rust-bin-1.47* ) > Priority: buildtime > ebuild: dev-lang/python-3.8.6::gentoo > installed: dev-lang/python-3.8.6::gentoo > ebuild: dev-lang/python-3.7.9::gentoo > ebuild: dev-lang/python-3.6.12::gentoo > ebuild: sys-devel/gcc-9.3.0-r1::gentoo > installed: sys-devel/gcc-9.3.0-r1::gentoo > ebuild: sys-devel/gcc-9.3.0-r1::gentoo > installed: sys-devel/gcc-9.3.0-r1::gentoo > ebuild: sys-devel/clang-11.0.0::gentoo > ebuild: sys-devel/clang-11.0.0::gentoo > ebuild: dev-lang/rust-1.46.0::gentoo > installed: dev-lang/rust-1.46.0::gentoo > ebuild: dev-lang/rust-1.47.0-r2::gentoo > ebuild: dev-lang/rust-bin-1.46.0::gentoo > ebuild: dev-lang/rust-bin-1.46.0::gentoo > ebuild: dev-lang/rust-1.47.0-r2::gentoo > Candidates: ['dev-lang/python:3.8', '>=sys-devel/gcc-4.7', '=dev-lang/rust-bin-1.46*'] > ebuild: dev-lang/python-3.8.6::gentoo > installed: dev-lang/python-3.8.6::gentoo > ebuild: sys-devel/gcc-9.3.0-r1::gentoo > installed: sys-devel/gcc-9.3.0-r1::gentoo > ebuild: dev-lang/rust-bin-1.46.0::gentoo > > Child: (dev-lang/python-3.8.6-1:3.8/3.8::gentoo, installed) USE="gdbm hardened ipv6 ncurses readline sqlite ssl xml -bluetooth -build -examples -libressl -test -tk -wininst" ABI_X86="(64)" > Parent Dep: dev-lang/python:3.8 required by (dev-lang/rust-1.47.0-r2:stable/1.47::gentoo, ebuild scheduled for merge) > > Child: (sys-devel/gcc-9.3.0-r1-3:9.3.0/9.3.0::gentoo, installed) USE="(cxx) fortran jit lto (multilib) nptl openmp pch pgo (pie) sanitize ssp vtv (-ada) (-altivec) -d -debug -doc (-fixed-point) -go -graphite (-hardened) (-libssp) -nls -objc -objc++ -objc-gc -systemtap -test -vanilla" ABI_X86="(64)" > Parent Dep: >=sys-devel/gcc-4.7 required by (dev-lang/rust-1.47.0-r2:stable/1.47::gentoo, ebuild scheduled for merge) > > Child: (dev-lang/rust-bin-1.46.0:stable/stable::gentoo, ebuild scheduled for merge) USE="-clippy -doc -rls -rustfmt" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="sse2" > Parent Dep: =dev-lang/rust-bin-1.46* required by (dev-lang/rust-1.47.0-r2:stable/1.47::gentoo, ebuild scheduled for merge)
Since the dev-lang/rust:stable slot is occupied by dev-lang/rust-1.47.0-r2, it will eliminate the installed dev-lang/rust-1.46.0 instance from the choices. Circular dependency avoidance logic will eliminate dev-lang/rust-1.47.0-r2 since the package cannot be used to satisfy its own buildtime dependency. After those choices have been eliminated, it naturally chooses dev-lang/rust-bin-1.46.0. So, it needs to be fixed to recognize that the installed dev-lang/rust-1.46.0 instance is the correct choice despite the fact that it occupies the same dev-lang/rust:stable slot as the dev-lang/rust-1.47.0-r2 package that will replace it.
If the user has masked dev-lang/rust-bin, then the same problem will result in a circular dependency error like this one from the log attached to bug 756793 comment 9: * Error: circular dependencies: (dev-lang/rust-1.48.0:stable/1.48::gentoo, ebuild scheduled for merge) depends on (dev-lang/rust-1.48.0:stable/1.48::gentoo, ebuild scheduled for merge) (buildtime) It might be possible to break this cycle by applying the following change: - dev-lang/rust-1.48.0 (Change USE: -system-bootstrap)
It seems like the simplest solution may be for portage to internally group the || ( =dev-lang/rust-1.46* =dev-lang/rust-1.47* ) choice into a composite atom that matches both the installed and new version that occupy the same dev-lang/rust:stable slot. This will allow it to chose the new version to satisfy the composite atom while recognizing that the same composite atom will be satisfied by the installed version.
Patch posted for review: https://archives.gentoo.org/gentoo-portage-dev/message/31b12ed3c2b9bfd555785d3fd6cdcfd0 https://github.com/gentoo/portage/pull/642
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=b991f23ad915d1fc37088f11ca855c8c8374f5ae commit b991f23ad915d1fc37088f11ca855c8c8374f5ae Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2020-11-28 01:57:14 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2020-11-28 20:50:13 +0000 Allow a package to replace its own buildtime dependency If a package has a buildtime dependency on a previous version that it will replace, then do not treat it as a slot conflict. This solves inappropriate behavior for dev-lang/rust[system-bootstrap]. This requires adjustments to package selection logic in several locations, in order to ensure that an installed package instance will be selected to satisfy a buildtime dependency when appropriate. Dependencies of the installed package will be entirely ignored, but that has already been the case when using installed package to break cycles, as discussed in bug 199856. Bug: https://bugs.gentoo.org/756793 Bug: https://bugs.gentoo.org/756961 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/_emerge/depgraph.py | 68 +++++++++++++--- lib/portage/dep/dep_check.py | 24 +++--- .../tests/resolver/test_circular_choices_rust.py | 94 ++++++++++++++++++++++ 3 files changed, 164 insertions(+), 22 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d77f07243dac0d12e44d0b0c5e6ab79c76111809 commit d77f07243dac0d12e44d0b0c5e6ab79c76111809 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2020-11-28 21:10:27 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2020-11-28 21:17:14 +0000 sys-apps/portage: Bump to version 3.0.11 #756961 handle dev-lang/rust[system-bootstrap] dependency cycle #757306 backtracking: fix virtual choices for circular deps Bug: https://bugs.gentoo.org/756793 Bug: https://bugs.gentoo.org/756961 Bug: https://bugs.gentoo.org/757306 Bug: https://bugs.gentoo.org/756028 Package-Manager: Portage-3.0.11, Repoman-3.0.2 Signed-off-by: Zac Medico <zmedico@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.11.ebuild | 267 +++++++++++++++++++++++++++++++++ 2 files changed, 268 insertions(+)