commit:     44afa8445dc46464200fe46c1e09e0c7475067bf
Author:     YiFei Zhu <zhuyifei1999 <AT> gmail <DOT> com>
AuthorDate: Mon Jun 12 02:23:09 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun 16 03:34:46 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=44afa844

depgraph: Don't ignore downgrades as missed_updates

Missed updates can also come in the form of package downgrades,
when, for example, there are keyword changes. They can cause
rebuilds, and these rebuilds may be not possible due to reasons such
as keywords or masks. In this case, prior to this patch, portage
would cancel the downgrade, but the rebuilds would be requested
endlessly, because bug 439688's backtrack code does not trigger.

To reproduce, on an ACCEPT_KEYWORDS=~amd64 machine, emerge
=dev-libs/openssl=3.0.9, dev-util/rustup, and something else that
depends on openssl. Then un-accept ~amd64 for openssl and rustup.
Prior to this patch, a @world upgrade would cause:

  These are the packages that would be merged, in order:

  Calculating dependencies... done!

  [ebuild  rR    ] dev-libs/libevent-2.1.12-r1:0/2.1-7::gentoo
  [ebuild  rR    ] net-misc/rsync-3.2.7-r2::gentoo
  [...]

  Total: 71 packages (71 reinstalls), Size of downloads: 0 KiB

There are no packages marked "R", only "rR". There are no section
labeled "The following packages are causing rebuilds:" either.

After this patch, we have:

  These are the packages that would be merged, in order:

  Calculating dependencies... done!

  Total: 0 packages, Size of downloads: 0 KiB

  WARNING: One or more updates/rebuilds have been skipped due to a dependency 
conflict:

  dev-libs/openssl:0

    (dev-libs/openssl-1.1.1u:0/1.1::gentoo, ebuild scheduled for merge)
      dev-libs/openssl:0/3= required by (dev-util/rustup-1.25.2:0/0::gentoo, 
installed)

I also updated the test from the previous patch to account for
this change. No other tests seems affected.

Bug: https://bugs.gentoo.org/439688
Bug: https://bugs.gentoo.org/622270
Signed-off-by: YiFei Zhu <zhuyifei1999 <AT> gmail.com>
Closes: https://github.com/gentoo/portage/pull/1053
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/_emerge/depgraph.py                                        | 4 +---
 lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 77133e99c..60e57b226 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -1287,9 +1287,7 @@ class depgraph:
                 pkg.root, pkg.slot_atom
             ):
                 any_selected = True
-                if chosen_pkg > pkg or (
-                    not chosen_pkg.installed and chosen_pkg.version == 
pkg.version
-                ):
+                if not chosen_pkg.installed and chosen_pkg.version == 
pkg.version:
                     missed_update = False
                     break
             if any_selected and missed_update:

diff --git a/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py 
b/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py
index 14e98cd00..b23126d5f 100644
--- a/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py
+++ b/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py
@@ -63,7 +63,7 @@ class SlotConflictBlockedPruneTestCase(TestCase):
                 ["@world"],
                 options={"--deep": True, "--update": True, "--verbose": True},
                 success=True,
-                mergelist=["x11-base/xwayland-23.1.1"],
+                mergelist=[],
             ),
         )
 

Reply via email to