commit: 22406d51ccaa743da4fd4c45e0fbaca09ffb1eba Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sat Feb 18 12:42:09 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sun Feb 19 19:19:44 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=22406d51
tests: dbapi: add basic metadata test (IDEPEND) In f9f55b42f1602e79a5541afcace6b2a30af394e8, I fixed the generation of IDEPEND metadata. It turns out we don't have suitable test coverage here. Add a basic test to make sure that: - IDEPEND survives cache generation and appears in the resultant cache; - IDEPEND accumulates across inherits (which is what the actual bug was, in a sense). This test fails with the fix for the bug (f9f55b42f1602e79a5541afcace6b2a30af394e8) reverted. We need to be testing various bits of newer EAPIs more (not least to ensure we don't forget to update one of the various parts of Portage when adding a new one) but this is a start. Bug: https://bugs.gentoo.org/870295 See: f9f55b42f1602e79a5541afcace6b2a30af394e8 Signed-off-by: Sam James <sam <AT> gentoo.org> lib/portage/tests/dbapi/test_portdb_cache.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/dbapi/test_portdb_cache.py b/lib/portage/tests/dbapi/test_portdb_cache.py index bda43643a..a55377b6b 100644 --- a/lib/portage/tests/dbapi/test_portdb_cache.py +++ b/lib/portage/tests/dbapi/test_portdb_cache.py @@ -1,4 +1,4 @@ -# Copyright 2012-2018 Gentoo Foundation +# Copyright 2012-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import subprocess @@ -23,9 +23,21 @@ class PortdbCacheTestCase(TestCase): "dev-libs/A-2": {}, "sys-apps/B-1": {}, "sys-apps/B-2": {}, + "sys-apps/C-1": { + "EAPI": 8, + "MISC_CONTENT": "inherit bar foo baz", + }, } - playground = ResolverPlayground(ebuilds=ebuilds, debug=debug) + # The convoluted structure here is to test accumulation + # of IDEPEND across eclasses (bug #870295). + eclasses = { + "foo": ("inherit bar",), + "bar": ("IDEPEND=dev-libs/A",), + "baz": ("IDEPEND=",), + } + + playground = ResolverPlayground(ebuilds=ebuilds, eclasses=eclasses, debug=debug) settings = playground.settings eprefix = settings["EPREFIX"] test_repo_location = settings.repositories["test_repo"].location @@ -161,6 +173,17 @@ class PortdbCacheTestCase(TestCase): """ ), ), + (portage_python, "-b", "-Wd", "-Wi::DeprecationWarning", "-c") + + ( + textwrap.dedent( + """ + import os, sys, portage + location = portage.portdb.repositories['test_repo'].location + if not portage.portdb._pregen_auxdb[location]["sys-apps/C-1"]['IDEPEND']: + sys.exit(1) + """ + ), + ), # Test auto-detection and preference for md5-cache when both # cache formats are available but layout.conf is absent. (BASH_BINARY, "-c", f"rm {portage._shell_quote(layout_conf_path)}"),
