commit:     1c8399e3fe74a09ebe920c6c81e5575e4969db10
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 15 15:08:40 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 15 15:15:30 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1c8399e3

emerge: don't complain on --excluded packages in world

Bug: https://bugs.gentoo.org/911180
Fixes: 5cebd32552c21d48dbe66f89abe7ca4d0bf2dda1
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/_emerge/depgraph.py                          |  3 ++
 lib/portage/tests/resolver/test_world_warning.py | 50 ++++++++++++++++++++++++
 2 files changed, 53 insertions(+)

diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 4c5293cc63..dee63760c9 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -5366,6 +5366,9 @@ class depgraph:
                         and isinstance(arg, SetArg)
                         and arg.name in ("selected, world")
                         and not self._replace_installed_atom(pkg)
+                        and not 
self._frozen_config.excluded_pkgs.findAtomForPackage(
+                            pkg
+                        )
                     ):
                         self._dynamic_config._missing_args.append((arg, atom))
 

diff --git a/lib/portage/tests/resolver/test_world_warning.py 
b/lib/portage/tests/resolver/test_world_warning.py
index ea728cd15e..0f0904f217 100644
--- a/lib/portage/tests/resolver/test_world_warning.py
+++ b/lib/portage/tests/resolver/test_world_warning.py
@@ -271,3 +271,53 @@ class WorldWarningTestCase(TestCase):
             )
         finally:
             playground.cleanup()
+
+    def testExcludedInWorldEmerge(self):
+        """
+        Test that we do not warn about a package in @world that we
+        are --exclude-ing on the command line.
+        """
+
+        installed = {
+            "app-misc/foo-1": {},
+        }
+        ebuilds = {
+            "app-misc/foo-1": {},
+        }
+
+        playground = ResolverPlayground(
+            world=["app-misc/foo"],
+            ebuilds=ebuilds,
+            installed=installed,
+        )
+
+        test_case = ResolverPlaygroundTestCase(
+            ["@world"],
+            mergelist=[],
+            options={
+                "--exclude": ["app-misc/foo"],
+                "--update": True,
+                "--deep": True,
+            },
+            success=True,
+        )
+
+        try:
+            # Just to make sure we don't freak out on the general case
+            # without worrying about the specific output first.
+            playground.run_TestCase(test_case)
+            self.assertEqual(test_case.test_success, True, test_case.fail_msg)
+
+            # We need access to the depgraph object to check for missing_args
+            # so we run again manually.
+            depgraph = playground.run(
+                ["@world"], test_case.options, test_case.action
+            ).depgraph
+
+            self.assertIsNotNone(depgraph._dynamic_config._missing_args)
+            self.assertTrue(
+                len(depgraph._dynamic_config._missing_args) == 0,
+                "Package with an ebuild that was reachable from world but 
--excluded was incorrectly flagged",
+            )
+        finally:
+            playground.cleanup()

Reply via email to