I encountered an issue where the highest_installed code from this commit causes undesirable updates to get pulled in: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5842e87872fd738cdfc7d0698463f1d11ffe5dee The undesirable updates can trigger the need for additional rebuilds, causing backtracking to go off course and fail to find a solution. I'll post a patch that corrects the problem.
Patch posted for review: https://archives.gentoo.org/gentoo-portage-dev/message/1245d0c9cd58b071f26ec2817cf1524a https://github.com/gentoo/portage/pull/134
This is in the master branch: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7c01a73c5a3ff969ddaa43e91730a7372a8a10c8
This patch fixed an issue that I had noticed on a machine that had pending updates to sys-libs/db and dev-lang/perl, were every emerge command would try to pull in those pending updates like this: # emerge -1vu app-misc/foo These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild NS ] sys-libs/db-5.3.28-r2:5.3::gentoo [4.8.30-r2:4.8::gentoo] USE="cxx -doc -examples -java -tcl {-test}" 34,268 KiB [ebuild r U ] dev-lang/perl-5.22.3_rc4:0/5.22::gentoo [5.22.2:0/5.22::gentoo] USE="berkdb gdbm -debug -doc -ithreads" 11,080 KiB [ebuild r U ] sys-apps/iproute2-4.9.0::gentoo [4.4.0::gentoo] USE="berkdb iptables ipv6 -atm -minimal (-selinux)" 599 KiB [ebuild U ] app-misc/foo-4.2.38::private-repo [4.2.37::private-repo] USE="{-test}" PYTHON_TARGETS="python3_4 (-python3_5)" 43 KiB [ebuild r U ] dev-vcs/subversion-1.9.5::gentoo [1.9.4::gentoo] USE="berkdb dso http python vim-syntax -apache2 -ctypes-python -debug -doc -extras -gnome-keyring -java -kde (-nls) -perl -ruby -sasl {-test}" PYTHON_TARGETS="python2_7" 7,720 KiB Total: 5 packages (4 upgrades, 1 in new slot), Size of downloads: 53,709 KiB !!! Multiple package instances within a single package slot have been pulled !!! into the dependency graph, resulting in a slot conflict: dev-lang/perl:0 (dev-lang/perl-5.22.3_rc4:0/5.22::gentoo, ebuild scheduled for merge) pulled in by (no parents that aren't satisfied by other packages in this slot) (dev-lang/perl-5.22.2-1:0/5.22::gentoo, installed) pulled in by =dev-lang/perl-5.22.2* required by (virtual/perl-libnet-3.50.0-r2-1:0/0::gentoo, installed) ^ ^^^^^^^ (and 1 more with the same problem) After the patch, I can emerge app-misc/foo without triggering the unwanted updates.
Fixed in portage-2.3.5.