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 E9E74158015 for ; Wed, 20 Dec 2023 08:16:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2CB242BC01F; Wed, 20 Dec 2023 08:16:08 +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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 02D522BC01F for ; Wed, 20 Dec 2023 08:16:07 +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 1253633BE3B for ; Wed, 20 Dec 2023 08:16:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AB0FF131D for ; Wed, 20 Dec 2023 08:16:05 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1702967246.70cbb9b693782eaa779cd7f9f5de6f72edc381d1.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/soname/, lib/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: lib/_emerge/depgraph.py lib/portage/tests/resolver/soname/test_skip_update.py X-VCS-Directories: lib/_emerge/ lib/portage/tests/resolver/soname/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 70cbb9b693782eaa779cd7f9f5de6f72edc381d1 X-VCS-Branch: master Date: Wed, 20 Dec 2023 08:16:05 +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: 593240dc-1be8-495f-b085-f37f7228e166 X-Archives-Hash: 03147bbc627d98eb95b282c9cac1072e commit: 70cbb9b693782eaa779cd7f9f5de6f72edc381d1 Author: Zac Medico gentoo org> AuthorDate: Tue Dec 19 05:25:40 2023 +0000 Commit: Zac Medico gentoo org> CommitDate: Tue Dec 19 06:27:26 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=70cbb9b6 depgraph: Use strip_libc_deps in _eliminate_rebuilds The included test case will fail without strip_libc_deps because the "injected" >=sys-libs/glibc-2.37 dependency will be interpreted as a dependency change, triggering unwanted reinstall of app-misc/A-1. Bug: https://bugs.gentoo.org/915494 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py | 33 ++++++++++++++-------- .../tests/resolver/soname/test_skip_update.py | 17 +++++++++-- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 4612ac2049..e92c6962ac 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -2966,6 +2966,23 @@ class depgraph: return flags return None + def _installed_libc_deps(self, eroot): + """ + Return find_libc_deps result for installed packages from the + given EROOT. + """ + try: + return self._frozen_config._libc_deps_cache[eroot] + except (AttributeError, KeyError) as e: + if isinstance(e, AttributeError): + self._frozen_config._libc_deps_cache = {} + + self._frozen_config._libc_deps_cache[eroot] = find_libc_deps( + self._frozen_config._trees_orig[eroot]["vartree"].dbapi, + False, + ) + return self._frozen_config._libc_deps_cache[eroot] + def _changed_deps(self, pkg): ebuild = None try: @@ -2985,18 +3002,7 @@ class depgraph: else: depvars = Package._runtime_keys - eroot = pkg.root_config.settings["EROOT"] - try: - libc_deps = self._frozen_config._libc_deps_cache[eroot] - except (AttributeError, KeyError) as e: - if isinstance(e, AttributeError): - self._frozen_config._libc_deps_cache = {} - - self._frozen_config._libc_deps_cache[eroot] = find_libc_deps( - self._frozen_config._trees_orig[eroot]["vartree"].dbapi, - False, - ) - libc_deps = self._frozen_config._libc_deps_cache[eroot] + libc_deps = self._installed_libc_deps(pkg.root) # Use _raw_metadata, in order to avoid interaction # with --dynamic-deps. @@ -3726,6 +3732,7 @@ class depgraph: if pkg.requires != installed_instance.requires: continue + libc_deps = self._installed_libc_deps(pkg.root) depvars = Package._dep_keys try: installed_deps = [] @@ -3736,6 +3743,7 @@ class depgraph: eapi=pkg.eapi, token_class=Atom, ) + strip_libc_deps(dep_struct, libc_deps) installed_deps.append(dep_struct) except InvalidDependString: continue @@ -3759,6 +3767,7 @@ class depgraph: eapi=pkg.eapi, token_class=Atom, ) + strip_libc_deps(dep_struct, libc_deps) new_deps.append(dep_struct) if new_deps != installed_deps: diff --git a/lib/portage/tests/resolver/soname/test_skip_update.py b/lib/portage/tests/resolver/soname/test_skip_update.py index 407c16a548..dc48a66f9f 100644 --- a/lib/portage/tests/resolver/soname/test_skip_update.py +++ b/lib/portage/tests/resolver/soname/test_skip_update.py @@ -1,4 +1,4 @@ -# Copyright 2015-2023 Gentoo Foundation +# Copyright 2015-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import sys @@ -29,7 +29,10 @@ class SonameSkipUpdateTestCase(TestCase): def testSonameSkipUpdate(self, backtrack=3): binpkgs = { "app-misc/A-1": { - "RDEPEND": "dev-libs/B", + # Simulate injected libc dep which should not trigger + # reinstall due to use of strip_libc_deps in + # depgraph._eliminate_rebuilds dep comparison. + "RDEPEND": "dev-libs/B >=sys-libs/glibc-2.37", "DEPEND": "dev-libs/B", "REQUIRES": "x86_32: libB.so.1", }, @@ -39,6 +42,10 @@ class SonameSkipUpdateTestCase(TestCase): "dev-libs/B-1": { "PROVIDES": "x86_32: libB.so.1", }, + "sys-libs/glibc-2.37-r7": { + "PROVIDES": "x86_32: libc.so.6", + }, + "virtual/libc-1-r1": {"RDEPEND": "sys-libs/glibc"}, } installed = { @@ -50,6 +57,12 @@ class SonameSkipUpdateTestCase(TestCase): "dev-libs/B-1": { "PROVIDES": "x86_32: libB.so.1", }, + "sys-libs/glibc-2.37-r7": { + "PROVIDES": "x86_32: libc.so.6", + }, + "virtual/libc-1-r1": { + "RDEPEND": "sys-libs/glibc", + }, } world = ("app-misc/A",)