From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0F7CF158099 for ; Tue, 28 Nov 2023 22:26:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 003372BC024; Tue, 28 Nov 2023 22:26:10 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CAEA52BC024 for ; Tue, 28 Nov 2023 22:26:09 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B0434335D0E for ; Tue, 28 Nov 2023 22:26:08 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 47BD813F1 for ; Tue, 28 Nov 2023 22:26:07 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1701209266.2e298ea7ba36801a1cfba6e4cbfc16a7c05ee73d.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/, lib/portage/tests/resolver/ X-VCS-Repository: proj/portage X-VCS-Files: lib/_emerge/DepPriorityNormalRange.py lib/_emerge/DepPrioritySatisfiedRange.py lib/portage/tests/resolver/test_runtime_cycle_merge_order.py X-VCS-Directories: lib/portage/tests/resolver/ lib/_emerge/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 2e298ea7ba36801a1cfba6e4cbfc16a7c05ee73d X-VCS-Branch: master Date: Tue, 28 Nov 2023 22:26:07 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: fa9e0451-4a4a-49e4-8637-f81090360878 X-Archives-Hash: 0cefc243145dd1ffd7b20995b8182fa8 commit: 2e298ea7ba36801a1cfba6e4cbfc16a7c05ee73d Author: Sam James gentoo org> AuthorDate: Tue Nov 28 06:22:44 2023 +0000 Commit: Sam James gentoo org> CommitDate: Tue Nov 28 22:07:46 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2e298ea7 DepPriority{Normal,Satisfied}Range: strengthen _ignore_runtime for runtime slot operators In the reported bug, net-misc/curl gets merged (binary), then dev-util/cmake gets bulit (from source) which fails because one of the built curl's dependencies (net-libs/nghttp2) is missing: ``` [binary R ] net-misc/curl-8.4.0::test_repo USE="http2%*" 0 KiB [ebuild U ] dev-util/cmake-3.27.8::test_repo [3.26.5-r2::test_repo] 0 KiB [ebuild N ] net-libs/nghttp2-1.57.0::test_repo 0 KiB ``` Zac had the idea [0] of strengthening _ignore_runtime to consider runtime slot deps as well, so we now get: ``` [ebuild U ] dev-util/cmake-3.27.8::test_repo [3.26.5-r2::test_repo] 0 KiB [ebuild N ] net-libs/nghttp2-1.57.0::test_repo 0 KiB [binary R ] net-misc/curl-8.4.0::test_repo USE="http2%*" 0 KiB ``` For DepPrioritySatisfiedRange, we now allow ignoring the dep if: * it's either a satisfied runtime slot dep, or it's not a runtime slot dep at all, and * the dep is satisfied or it's optional/not a build time dep. (i.e. we now prevent ignoring the slot dep unless it's satisfied.) For DepPriorityNormalRange, we now allow ignoring the dep if: * it's not a runtime slot dep, and * it's optional, or * it's not a buildtime dep. (i.e. we now prevent ignoring the slot dep.) We then realise we can't ignore curl's dep on nghttp2 and come up with a better order. [0] https://github.com/gentoo/portage/pull/1193#issuecomment-1829178126 Bug: https://bugs.gentoo.org/918683 Thanks-to: Zac Medico gentoo.org> Signed-off-by: Sam James gentoo.org> lib/_emerge/DepPriorityNormalRange.py | 8 +++++++- lib/_emerge/DepPrioritySatisfiedRange.py | 13 +++++++++++-- .../tests/resolver/test_runtime_cycle_merge_order.py | 9 ++++----- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/_emerge/DepPriorityNormalRange.py b/lib/_emerge/DepPriorityNormalRange.py index a85e1b9c14..d7e4381b47 100644 --- a/lib/_emerge/DepPriorityNormalRange.py +++ b/lib/_emerge/DepPriorityNormalRange.py @@ -37,7 +37,13 @@ class DepPriorityNormalRange: def _ignore_runtime(cls, priority): if priority.__class__ is not DepPriority: return False - return bool(priority.optional or not priority.buildtime) + # If we ever allow "optional" runtime_slot_op, we'll need + # to adjust this appropriately. But only build time dependencies + # are optional right now, so it's not an issue as-is. + return bool( + not priority.runtime_slot_op + and (priority.optional or not priority.buildtime) + ) ignore_medium = _ignore_runtime ignore_medium_soft = _ignore_runtime_post diff --git a/lib/_emerge/DepPrioritySatisfiedRange.py b/lib/_emerge/DepPrioritySatisfiedRange.py index 0633a5e1c2..0d42e7613d 100644 --- a/lib/_emerge/DepPrioritySatisfiedRange.py +++ b/lib/_emerge/DepPrioritySatisfiedRange.py @@ -1,4 +1,4 @@ -# Copyright 1999-2013 Gentoo Foundation +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from _emerge.DepPriority import DepPriority @@ -89,7 +89,16 @@ class DepPrioritySatisfiedRange: def _ignore_runtime(cls, priority): if priority.__class__ is not DepPriority: return False - return bool(priority.satisfied or priority.optional or not priority.buildtime) + # We could split this up into 2 variants (ignoring satisfied + # runtime_slot_op, and not) if we need more granularity for ignore_priority + # in future. + return bool( + ( + (not priority.runtime_slot_op) + or (priority.satisfied and priority.runtime_slot_op) + ) + and (priority.satisfied or priority.optional or not priority.buildtime) + ) ignore_medium = _ignore_runtime ignore_medium_soft = _ignore_satisfied_buildtime_slot_op diff --git a/lib/portage/tests/resolver/test_runtime_cycle_merge_order.py b/lib/portage/tests/resolver/test_runtime_cycle_merge_order.py index 26850ccad2..ed329aa097 100644 --- a/lib/portage/tests/resolver/test_runtime_cycle_merge_order.py +++ b/lib/portage/tests/resolver/test_runtime_cycle_merge_order.py @@ -1,4 +1,4 @@ -# Copyright 2016 Gentoo Foundation +# Copyright 2016-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -7,8 +7,6 @@ from portage.tests.resolver.ResolverPlayground import ( ResolverPlaygroundTestCase, ) -import pytest - class RuntimeCycleMergeOrderTestCase(TestCase): def testRuntimeCycleMergeOrder(self): @@ -77,7 +75,6 @@ class RuntimeCycleMergeOrderTestCase(TestCase): finally: playground.cleanup() - @pytest.mark.xfail() def testBuildtimeRuntimeCycleMergeOrder(self): installed = { "dev-util/cmake-3.26.5-r2": { @@ -192,10 +189,12 @@ class RuntimeCycleMergeOrderTestCase(TestCase): "--usepkg": True, }, success=True, + # It would also work to punt the dev-util/cmake upgrade + # until the end, given it's already installed. mergelist=[ + "dev-util/cmake-3.27.8", "net-libs/nghttp2-1.57.0", "[binary]net-misc/curl-8.4.0", - "dev-util/cmake-3.27.8", ], ), )