public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/, lib/portage/tests/resolver/
Date: Tue, 28 Nov 2023 22:26:07 +0000 (UTC)	[thread overview]
Message-ID: <1701209266.2e298ea7ba36801a1cfba6e4cbfc16a7c05ee73d.sam@gentoo> (raw)

commit:     2e298ea7ba36801a1cfba6e4cbfc16a7c05ee73d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 28 06:22:44 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> 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 <zmedico <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> 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",
                 ],
             ),
         )


             reply	other threads:[~2023-11-28 22:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 22:26 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-26 18:48 [gentoo-commits] proj/portage:master commit in: lib/_emerge/, lib/portage/tests/resolver/ Zac Medico
2023-12-24 19:30 Zac Medico
2023-12-06 20:29 Zac Medico
2023-11-28 22:42 Zac Medico
2023-11-28  4:20 Zac Medico
2023-11-19 17:56 Zac Medico
2023-06-16  3:34 Sam James
2023-06-16  3:34 Sam James
2020-11-22  6:13 Zac Medico
2020-09-21  5:39 Zac Medico
2020-02-15  0:05 Zac Medico
2019-09-12  1:51 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1701209266.2e298ea7ba36801a1cfba6e4cbfc16a7c05ee73d.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox