Let's say I have dev-lang/python:3.9 installed. If the ebuild has the following dependency: BDEPEND="|| ( dev-lang/python:3.10 dev-lang/python:3.9 )" Then Portage considers it satisfied. However, if I duplicate the || block: BDEPEND=" || ( dev-lang/python:3.10 dev-lang/python:3.9 ) || ( dev-lang/python:3.10 dev-lang/python:3.9 )" Portage suddenly wants to pull python:3.10.
Since upgrades are generally desirable, we might consider the behavior for the duplicate || blocks to be the correct one.
In general, if do not request -u or --deep/--complete-graph, I'd say the desirable behavior is not to install anything extra if dependencies are satisfied already.
Created attachment 757444 [details] unit test case which demonstrates the unnecessary slot upgrade
It looks like we need it to separate these choices into separate bins before it sorts them to find upgrades. Currently, it's putting all the choices into the same bin and the attributes of the choices in the bin look like this: [ { "atoms": ["dev-lang/python:3.9", "dev-lang/python:3.9"], "all_available": True, "all_installed_slots": True, "new_slot_count": 0, "all_in_graph": False, "want_update": False, }, { "atoms": ["dev-lang/python:3.10", "dev-lang/python:3.10"], "all_available": True, "all_installed_slots": False, "new_slot_count": 1, "all_in_graph": False, "want_update": False, }, { "atoms": ["dev-lang/python:3.10", "dev-lang/python:3.9"], "all_available": True, "all_installed_slots": False, "new_slot_count": 1, "all_in_graph": False, "want_update": False, }, { "atoms": ["dev-lang/python:3.9", "dev-lang/python:3.10"], "all_available": True, "all_installed_slots": False, "new_slot_count": 1, "all_in_graph": False, "want_update": False, }, ]
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=a7289ac0eaaa0d435bf6d9bfb2724a6b39adcbee commit a7289ac0eaaa0d435bf6d9bfb2724a6b39adcbee Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2021-12-04 23:54:47 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2021-12-05 18:40:44 +0000 dep_zapdeps: avoid new slots when appropriate (bug 828136) Place choices that do not pull in new slots into a preferred choice bin, so that they will not be mixed with choices that contain unnecessary upgrades. This fixes the included test case so that an unnecessary new python slot is not pulled in. Bug: https://bugs.gentoo.org/828136 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/portage/dep/dep_check.py | 6 ++- .../tests/resolver/test_unecessary_slot_upgrade.py | 62 ++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-)
(In reply to Larry the Git Cow from comment #5) > The bug has been referenced in the following commit(s): > > https://gitweb.gentoo.org/proj/portage.git/commit/ > ?id=a7289ac0eaaa0d435bf6d9bfb2724a6b39adcbee > > commit a7289ac0eaaa0d435bf6d9bfb2724a6b39adcbee > Author: Zac Medico <zmedico@gentoo.org> > AuthorDate: 2021-12-04 23:54:47 +0000 > Commit: Zac Medico <zmedico@gentoo.org> > CommitDate: 2021-12-05 18:40:44 +0000 > > dep_zapdeps: avoid new slots when appropriate (bug 828136) > > Place choices that do not pull in new slots into a preferred > choice bin, so that they will not be mixed with choices that > contain unnecessary upgrades. This fixes the included test > case so that an unnecessary new python slot is not pulled in. > > Bug: https://bugs.gentoo.org/828136 > Signed-off-by: Zac Medico <zmedico@gentoo.org> > > lib/portage/dep/dep_check.py | 6 ++- > .../tests/resolver/test_unecessary_slot_upgrade.py | 62 > ++++++++++++++++++++++ > 2 files changed, 67 insertions(+), 1 deletion(-) This is now reverted since it triggered bug 833014.