proj/portage:master commit in: lib/portage/dep/

"Matt Turner" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1785944378.fd18a108029fcc51cae12c6742517acc6de11cb7.mattst88@gentoo>
commit:     fd18a108029fcc51cae12c6742517acc6de11cb7
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  5 15:34:16 2026 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Aug  5 15:39:38 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fd18a108

dep_check: use Atom.with_cp() for old-style virtual expansion

Atom is no longer a str subclass, so x.replace() raises

    AttributeError: 'Atom' object has no attribute 'replace'

Two old-style virtual expansion sites were missed when the rest of this
pattern was converted in commit f832cc727 ("dep: Atom: add with_cp()
method, use it at call sites"): the treeVirtuals expansion taken when
local_config is disabled (or when the caller supplies no
match_pkgs/pkg_use_enabled), and the package.provided check. Neither is
exercised by the test suite.

Fixes: 7e15fc7fa ("dep: Atom: remove str subtyping")
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 lib/portage/dep/dep_check.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py
index 226a7aff9..38259c2c4 100644
--- a/lib/portage/dep/dep_check.py
+++ b/lib/portage/dep/dep_check.py
@@ -151,7 +151,7 @@ def _expand_new_virtuals(
                     mysettings._populate_treeVirtuals_if_needed(myvartree)
                 mychoices = mysettings.getvirtuals().get(mykey, [])
                 for y in mychoices:
-                    a.append(Atom(x.replace(x.cp, y.cp, 1)))
+                    a.append(x.with_cp(y.cp))
                 if not a:
                     newsplit.append(x)
                 elif is_disjunction:
@@ -272,7 +272,7 @@ def _expand_new_virtuals(
         if not a and mychoices:
             # Check for a virtual package.provided match.
             for y in mychoices:
-                new_atom = Atom(x.replace(x.cp, y.cp, 1))
+                new_atom = x.with_cp(y.cp)
                 if match_from_list(new_atom, pprovideddict.get(new_atom.cp, [])):
                     a.append(new_atom)
                     if atom_graph is not None:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.