[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: ff22b5bf954574f1fad789fc148945d67c3a1215 Author: Zac Medico gentoo org> AuthorDate: Sun May 26 18:57:38 2024 + Commit: Zac Medico gentoo org> CommitDate: Sun May 26 18:57:58 2024 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ff22b5bf test_tar_merge_order.py: Fix unused pytest unused-import Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_tar_merge_order.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/portage/tests/resolver/test_tar_merge_order.py b/lib/portage/tests/resolver/test_tar_merge_order.py index 4bd9b4df4a..c66d01ee31 100644 --- a/lib/portage/tests/resolver/test_tar_merge_order.py +++ b/lib/portage/tests/resolver/test_tar_merge_order.py @@ -2,7 +2,6 @@ # Distributed under the terms of the GNU General Public License v2 import os -import pytest from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import (
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 11bded10a2a4f143e8d7f8ccb2f91f2b6fed59b5 Author: Sam James gentoo org> AuthorDate: Sun May 26 14:44:56 2024 + Commit: Zac Medico gentoo org> CommitDate: Sun May 26 18:27:02 2024 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=11bded10 tests: add testcase for app-arch/tar merge order with binpkgs In the bug, dilfridge reports releng@ is hitting the following: ``` $ emerge -epvk world | grep -E "(app-arch/tar|sys-apps/acl)" [ebuild N ] sys-apps/acl-2.3.2-r1::gentoo USE="nls -static-libs" 363 KiB [binary R] app-arch/tar-1.35-1::gentoo USE="acl* nls* xattr* -minimal (-selinux) -verify-sig" 0 KiB [...] ``` Test for bug #922629 where binary app-arch/tar[acl] was merged before its dependency sys-apps/acl (with virtual/acl merged but unsatisfied). It (appears to be) a bad interaction with @system containing app-alternatives/tar plus a circular dependency on app-arch/tar. The USE change is also important, as e.g. dropping "sys-apps/attr nls" from package.use makes things okay. XFAIL'd for now. Bug: https://bugs.gentoo.org/922629 Signed-off-by: Sam James gentoo.org> Closes: https://github.com/gentoo/portage/pull/1332 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/meson.build | 1 + lib/portage/tests/resolver/test_tar_merge_order.py | 495 + 2 files changed, 496 insertions(+) diff --git a/lib/portage/tests/resolver/meson.build b/lib/portage/tests/resolver/meson.build index 8892c78131..ea948982e7 100644 --- a/lib/portage/tests/resolver/meson.build +++ b/lib/portage/tests/resolver/meson.build @@ -81,6 +81,7 @@ py.install_sources( 'test_slot_operator_update_probe_parent_downgrade.py', 'test_solve_non_slot_operator_slot_conflicts.py', 'test_targetroot.py', +'test_tar_merge_order.py', 'test_unmerge_order.py', 'test_unnecessary_slot_upgrade.py', 'test_update.py', diff --git a/lib/portage/tests/resolver/test_tar_merge_order.py b/lib/portage/tests/resolver/test_tar_merge_order.py new file mode 100644 index 00..7e1a18bc21 --- /dev/null +++ b/lib/portage/tests/resolver/test_tar_merge_order.py @@ -0,0 +1,495 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +import os +import pytest + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( +ResolverPlayground, +ResolverPlaygroundTestCase, +) + + +class TarMergeOrderTestCase(TestCase): +@pytest.mark.xfail(reason="bug #922629 isn't yet fixed") +def testTarMergeOrder(self): +""" +Test for bug #922629 where binary app-arch/tar[acl] was merged +before its dependency sys-apps/acl (with virtual/acl merged but +unsatisfied). + +It poorly interacted with @system containing app-alternatives/tar +as a circular dependency on app-arch/tar. +""" + +ebuilds = { +"app-alternatives/tar-0-1": { +"EAPI": "8", +"RDEPEND": """ +!=app-arch/tar-1.34-r2 ) +libarchive? ( app-arch/libarchive ) +""", +"IUSE": "+gnu libarchive", +"REQUIRED_USE": "^^ ( gnu libarchive )", +}, +"app-arch/libarchive-3.7.4": {"EAPI": "8"}, +"app-arch/tar-1.35": { +"EAPI": "8", +"RDEPEND": """ +acl? ( virtual/acl ) +""", +"DEPEND": """ +acl? ( virtual/acl ) +xattr? ( sys-apps/attr ) +""", +"BDEPEND": """ +nls? ( sys-devel/gettext ) +""", +"IUSE": "acl nls xattr", +}, +"virtual/acl-0-r2": { +"EAPI": "8", +"RDEPEND": ">=sys-apps/acl-2.2.52-r1", +}, +"sys-devel/gettext-0.22.4": { +"EAPI": "8", +"RDEPEND": """ +acl? ( virtual/acl ) +xattr? ( sys-apps/attr ) +""", +"DEPEND": """ +acl? ( virtual/acl ) +xattr? ( sys-apps/attr ) +""", +"IUSE": "acl nls xattr", +}, +"sys-apps/attr-2.5.2-r1": { +"EAPI": "8", +"BDEPEND": "nls? ( sys-devel/gettext )", +"IUSE": "nls", +}, +"sys-apps/acl-2.3.2-r1": { +"EAPI": "8", +"DEPEND": ">=sys-apps/attr-2.4.47-r1", +"RDEPEND": ">=sys-apps/attr-2.4.47-r1", +"BDEPEND": "nls? ( sys-devel/gettext )", +"IUSE": "nls", +}, +} + +installed = { +"app-alternatives/tar-0-1": { +"EAPI": "8", +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, cnf/sets/, lib/portage/tests/sets/base/
commit: 1d3e3843f2a51c581d344540c5c6ee266afa30d2 Author: Zac Medico gentoo org> AuthorDate: Sun Feb 25 22:57:43 2024 + Commit: Zac Medico gentoo org> CommitDate: Mon Feb 26 23:17:55 2024 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1d3e3843 cnf: sets: Migrate @golang-rebuild to dev-lang/go Bug: https://bugs.gentoo.org/919751 Signed-off-by: Zac Medico gentoo.org> cnf/sets/portage.conf| 6 -- lib/portage/tests/resolver/ResolverPlayground.py | 10 +- lib/portage/tests/sets/base/test_variable_set.py | 8 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cnf/sets/portage.conf b/cnf/sets/portage.conf index 2e02f91f97..c272f98db1 100644 --- a/cnf/sets/portage.conf +++ b/cnf/sets/portage.conf @@ -110,12 +110,6 @@ class = portage.sets.dbapi.UnavailableBinaries [changed-deps] class = portage.sets.dbapi.ChangedDepsSet -# Installed packages for which vdb *DEPEND includes dev-lang/go. -[golang-rebuild] -class = portage.sets.dbapi.VariableSet -variable = BDEPEND -includes = dev-lang/go - # Installed packages for which vdb *DEPEND includes virtual/rust [rust-rebuild] class = portage.sets.dbapi.VariableSet diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 75c86b615c..c0455415a1 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -28,7 +28,7 @@ from portage.exception import InvalidBinaryPackageFormat from portage.gpg import GPG import _emerge -from _emerge.actions import _calc_depclean +from _emerge.actions import _calc_depclean, expand_set_arguments from _emerge.Blocker import Blocker from _emerge.create_depgraph_params import create_depgraph_params from _emerge.DependencyArg import DependencyArg @@ -747,6 +747,14 @@ class ResolverPlayground: self.settings, self.trees, options, params, None ) +atoms, retval = expand_set_arguments( +atoms, action, self.trees[self.eroot]["root_config"] +) +if retval != os.EX_OK: +raise AssertionError( +f"expand_set_arguments failed with retval {retval}" +) + if params_action == "remove": depclean_result = _calc_depclean( self.settings, diff --git a/lib/portage/tests/sets/base/test_variable_set.py b/lib/portage/tests/sets/base/test_variable_set.py index 9e90ee6dd7..60c43a5b83 100644 --- a/lib/portage/tests/sets/base/test_variable_set.py +++ b/lib/portage/tests/sets/base/test_variable_set.py @@ -1,4 +1,4 @@ -# Copyright 2022 Gentoo Authors +# Copyright 2022-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -10,6 +10,10 @@ from portage.tests.resolver.ResolverPlayground import ( class VariableSetTestCase(TestCase): def testVariableSetEmerge(self): + +# Using local set definition because @golang-rebuild migrated to dev-lang/go since bug 919751. +golang_rebuild = "{class=portage.sets.dbapi.VariableSet,variable=BDEPEND,includes=dev-lang/go}" + ebuilds = { "dev-go/go-pkg-1": {"BDEPEND": "dev-lang/go"}, "www-client/firefox-1": { @@ -21,7 +25,7 @@ class VariableSetTestCase(TestCase): test_cases = ( ResolverPlaygroundTestCase( -["@golang-rebuild"], +[f"@golang-rebuild{golang_rebuild}"], mergelist=["dev-go/go-pkg-1"], success=True, ),
[gentoo-commits] proj/portage:master commit in: /, lib/portage/tests/resolver/, lib/_emerge/
commit: 92ff02b9189f8350f44e134d538319e4037f3f71 Author: Gábor Oszkár Dénes protonmail com> AuthorDate: Wed Feb 14 17:40:24 2024 + Commit: Sam James gentoo org> CommitDate: Fri Feb 23 04:39:26 2024 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=92ff02b9 emerge: Skip installed packages with emptytree in depgraph selection Running emerge with emptytree tries to find the best match for every atom it needs to install. Sometimes the best matches would be already installed packages (with `operation=nomerge`), but these packages would be silently skipped with full emptytree installation. This change makes sure that emerge attempts to install every package. If the package has unmet requirements, emerge will complain. Bug: https://bugs.gentoo.org/651018 Signed-off-by: Gábor Oszkár Dénes protonmail.com> Closes: https://github.com/gentoo/portage/pull/1272 Signed-off-by: Sam James gentoo.org> NEWS | 6 + lib/_emerge/depgraph.py| 13 ++ lib/portage/tests/resolver/test_depth.py | 8 +- .../test_emptytree_reinstall_unsatisfiability.py | 137 + lib/portage/tests/resolver/test_useflags.py| 6 +- 5 files changed, 166 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 3fbc727861..94be26de84 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,12 @@ Release notes take the form of the following optional categories: * Bug fixes * Cleanups +portage-3.0.63 (UNRELEASED) +-- + +Bug fixes: +* emerge: Skip installed packages with emptytree in depgraph selection (bug #651018). + portage-3.0.62 (2024-02-22) -- diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 70b83ee1f4..ea96bd58c4 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -7639,6 +7639,19 @@ class depgraph: if pkg.installed and root_slot in self._rebuild.reinstall_list: continue +if ( +empty +and pkg.installed +and not self._frozen_config.excluded_pkgs.findAtomForPackage( +pkg, modified_use=self._pkg_use_enabled(pkg) +) +): +# With --emptytree option we assume no packages +# are installed, so we do not select them. +# But we allow installed packages to satisfy dependency requirements +# if they're explicitly excluded, so we allow them to be selected. +continue + if ( not pkg.installed and self._frozen_config.excluded_pkgs.findAtomForPackage( diff --git a/lib/portage/tests/resolver/test_depth.py b/lib/portage/tests/resolver/test_depth.py index 9c5289f7d0..ab5f8e7ec3 100644 --- a/lib/portage/tests/resolver/test_depth.py +++ b/lib/portage/tests/resolver/test_depth.py @@ -1,4 +1,4 @@ -# Copyright 2011-2020 Gentoo Authors +# Copyright 2011-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -318,6 +318,12 @@ class ResolverDepthTestCase(TestCase): "sys-fs/udev-164", ], ), +ResolverPlaygroundTestCase( +["@world"], +options={"--emptytree": True, "--exclude": ["dev-libs/B"]}, +success=True, +mergelist=["dev-libs/C-2", "dev-libs/A-2"], +), ) playground = ResolverPlayground( diff --git a/lib/portage/tests/resolver/test_emptytree_reinstall_unsatisfiability.py b/lib/portage/tests/resolver/test_emptytree_reinstall_unsatisfiability.py new file mode 100644 index 00..fcdc01d7f1 --- /dev/null +++ b/lib/portage/tests/resolver/test_emptytree_reinstall_unsatisfiability.py @@ -0,0 +1,137 @@ +# Copyright 2024 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( +ResolverPlayground, +ResolverPlaygroundTestCase, +) + + +class EmptytreeReinstallUnsatisfiabilityTestCase(TestCase): +def testEmptytreeReinstallUnsatisfiability(self): +""" +Tests to check if emerge fails and complains when --emptytree +package dependency graph reinstall is unsatisfied, even if the already +installed packages successfully satisfy the dependency tree. + +See bug #651018 where emerge silently skips package +reinstalls because of unsatisfied use flag requirements. +""" +ebuilds = { +"dev-libs/A-1": { +"DEPEND": "dev-libs/B", +"RDEPEND": "dev-libs/B", +"EAPI": "2", +}, +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: be37f0761752f13a855aed66fa6e49e2f7211a0f Author: Zac Medico gentoo org> AuthorDate: Fri Feb 9 21:36:02 2024 + Commit: Zac Medico gentoo org> CommitDate: Fri Feb 9 21:36:28 2024 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=be37f076 EAPITestCase: Disable playground debug so tempdir is cleaned up Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_eapi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/resolver/test_eapi.py b/lib/portage/tests/resolver/test_eapi.py index 5d425ccdb9..32dcb49895 100644 --- a/lib/portage/tests/resolver/test_eapi.py +++ b/lib/portage/tests/resolver/test_eapi.py @@ -1,4 +1,4 @@ -# Copyright 2010-2020 Gentoo Authors +# Copyright 2010-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -199,7 +199,7 @@ class EAPITestCase(TestCase): mergelist=["dev-libs/A-1.0", "dev-libs/B-1.0"], ) -playground = ResolverPlayground(ebuilds=ebuilds, debug=True) +playground = ResolverPlayground(ebuilds=ebuilds) try: playground.run_TestCase(test_case) self.assertEqual(test_case.test_success, True, test_case.fail_msg)
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: 4b885b9ca063c990b1e218c73a786e9d434717e8 Author: Zac Medico gentoo org> AuthorDate: Mon Jan 8 06:04:37 2024 + Commit: Zac Medico gentoo org> CommitDate: Mon Jan 8 08:08:51 2024 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4b885b9c _calc_depclean: add dep_check action Add a dep_check action which can be used to check the dependencies of all installed packages. The plan is for depgraph to use this action to check for broken dependencies prior to the merge order calculation. The new frozen_config parameter will allow depgraph to pass a shared frozen config to _calc_depclean. The result of the dep_check action becomes stale as soon as there is any change to the installed packages. So, in order to account for dependencies that may become broken or satisfied during the process of updating installed packages, the merge order calculation will need to refresh the dep_check calculation for every merge order choice that it makes. This refresh will need to be optimized to identify the portion of the graph that would become stale due to a given change, so that it can avoid unnecessary repetition of work. Bug: https://bugs.gentoo.org/921333 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/actions.py | 21 ++- lib/_emerge/depgraph.py | 7 ++- lib/portage/tests/resolver/ResolverPlayground.py | 43 -- lib/portage/tests/resolver/meson.build | 1 + lib/portage/tests/resolver/test_broken_deps.py | 76 5 files changed, 138 insertions(+), 10 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 20f3978f77..2710c4856c 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -909,7 +909,16 @@ _depclean_result = collections.namedtuple( ) -def _calc_depclean(settings, trees, ldpath_mtimes, myopts, action, args_set, spinner): +def _calc_depclean( +settings, +trees, +ldpath_mtimes, +myopts, +action, +args_set, +spinner, +frozen_config=None, +): allow_missing_deps = bool(args_set) debug = "--debug" in myopts @@ -988,12 +997,14 @@ def _calc_depclean(settings, trees, ldpath_mtimes, myopts, action, args_set, spi writemsg_level("\nCalculating dependencies ") resolver_params = create_depgraph_params(myopts, "remove") -resolver = depgraph(settings, trees, myopts, resolver_params, spinner) +resolver = depgraph( +settings, trees, myopts, resolver_params, spinner, frozen_config=frozen_config +) resolver._load_vdb() vardb = resolver._frozen_config.trees[eroot]["vartree"].dbapi real_vardb = trees[eroot]["vartree"].dbapi -if action == "depclean": +if action in ("dep_check", "depclean"): if args_set: if deselect: # Start with an empty set. @@ -1002,6 +1013,7 @@ def _calc_depclean(settings, trees, ldpath_mtimes, myopts, action, args_set, spi # Pull in any sets nested within the selected set. selected_set.update(psets["selected"].getNonAtoms()) +if args_set or action == "dep_check": # Pull in everything that's installed but not matched # by an argument atom since we don't want to clean any # package if something depends on it. @@ -1098,6 +1110,9 @@ def _calc_depclean(settings, trees, ldpath_mtimes, myopts, action, args_set, spi if not success: return _depclean_result(1, [], False, 0, resolver) +if action == "dep_check": +return _depclean_result(0, [], False, 0, resolver) + def unresolved_deps(): soname_deps = set() unresolvable = set() diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index a2865cad23..b859e68224 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -11723,6 +11723,7 @@ def backtrack_depgraph( myaction: Optional[str], myfiles: list[str], spinner: "_emerge.stdout_spinner.stdout_spinner", +frozen_config: Optional[_frozen_depgraph_config] = None, ) -> tuple[Any, depgraph, list[str]]: """ @@ -11747,6 +11748,7 @@ def _backtrack_depgraph( myaction: Optional[str], myfiles: list[str], spinner: "_emerge.stdout_spinner.stdout_spinner", +frozen_config: Optional[_frozen_depgraph_config] = None, ) -> tuple[Any, depgraph, list[str], int, int]: debug = "--debug" in myopts mydepgraph = None @@ -11756,7 +11758,10 @@ def _backtrack_depgraph( backtracker = Backtracker(max_depth) backtracked = 0 -frozen_config = _frozen_depgraph_config(settings, trees, myopts, myparams, spinner) +if frozen_config is None: +frozen_config = _frozen_depgraph_config( +settings, trees, myopts, myparams, spinner +) while backtracker: if debug and mydepgraph is not None: diff --git a/lib/portage/tests/resolver/ResolverPlayground.py
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: 64b16b76611e14ff0b38b762486f073039f21a05 Author: Zac Medico gentoo org> AuthorDate: Mon Dec 25 02:53:57 2023 + Commit: Zac Medico gentoo org> CommitDate: Tue Dec 26 21:04:25 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=64b16b76 depclean: Strengthen IDEPEND in unmerge order Increase priority of IDEPEND so that it is stronger than RDEPEND in unmerge order calculations. This causes IDEPEND to be unmerged afterwards when packages are involved in RDEPEND cycles. Bug: https://bugs.gentoo.org/916135 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AbstractDepPriority.py| 3 +- lib/_emerge/UnmergeDepPriority.py | 35 +++-- lib/_emerge/actions.py| 5 +- lib/_emerge/depgraph.py | 4 +- lib/portage/tests/resolver/test_depclean_order.py | 63 +++ 5 files changed, 92 insertions(+), 18 deletions(-) diff --git a/lib/_emerge/AbstractDepPriority.py b/lib/_emerge/AbstractDepPriority.py index a9616c1094..3af262cd79 100644 --- a/lib/_emerge/AbstractDepPriority.py +++ b/lib/_emerge/AbstractDepPriority.py @@ -1,4 +1,4 @@ -# Copyright 1999-2013 Gentoo Foundation +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import copy @@ -9,6 +9,7 @@ class AbstractDepPriority(SlotObject): __slots__ = ( "buildtime", "buildtime_slot_op", +"installtime", "runtime", "runtime_post", "runtime_slot_op", diff --git a/lib/_emerge/UnmergeDepPriority.py b/lib/_emerge/UnmergeDepPriority.py index d818bad1b8..b14f8b84eb 100644 --- a/lib/_emerge/UnmergeDepPriority.py +++ b/lib/_emerge/UnmergeDepPriority.py @@ -12,18 +12,19 @@ class UnmergeDepPriority(AbstractDepPriority): "satisfied", ) """ - Combination of properties Priority Category - - runtime_slot_op0 HARD - runtime -1 HARD - runtime_post -2 HARD - buildtime -3 SOFT - (none of the above) -3 SOFT - """ +Combination of properties Priority Category + +installtime0 HARD +runtime_slot_op -1 HARD +runtime -2 HARD +runtime_post -3 HARD +buildtime -4 SOFT +(none of the above) -4 SOFT +""" MAX = 0 -SOFT = -3 -MIN = -3 +SOFT = -4 +MIN = -4 def __init__(self, **kwargs): AbstractDepPriority.__init__(self, **kwargs) @@ -31,19 +32,23 @@ class UnmergeDepPriority(AbstractDepPriority): self.optional = True def __int__(self): -if self.runtime_slot_op: +if self.installtime: return 0 -if self.runtime: +if self.runtime_slot_op: return -1 -if self.runtime_post: +if self.runtime: return -2 -if self.buildtime: +if self.runtime_post: return -3 -return -3 +if self.buildtime: +return -4 +return -4 def __str__(self): if self.ignored: return "ignored" +if self.installtime: +return "install time" if self.runtime_slot_op: return "hard slot op" myvalue = self.__int__() diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 13bb75931c..20f3978f77 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -1568,11 +1568,12 @@ def _calc_depclean(settings, trees, ldpath_mtimes, myopts, action, args_set, spi graph = digraph() del cleanlist[:] +installtime = UnmergeDepPriority(installtime=True, runtime=True) runtime = UnmergeDepPriority(runtime=True) runtime_post = UnmergeDepPriority(runtime_post=True) buildtime = UnmergeDepPriority(buildtime=True) priority_map = { -"IDEPEND": runtime, +"IDEPEND": installtime, "RDEPEND": runtime, "PDEPEND": runtime_post, "BDEPEND": buildtime, @@ -1683,6 +1684,8 @@ def _calc_depclean(settings, trees, ldpath_mtimes, myopts, action, args_set, spi break if not nodes: raise AssertionError("no root nodes") +# Sort nodes for deterministic results. +nodes.sort(reverse=True) if ignore_priority is not None: # Some deps have been dropped due to circular dependencies, # so only pop one node in order to minimize the number that diff --git a/lib/_emerge/depgraph.py
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: eeb4c29a64927efbaa7028153230367651bcf3b7 Author: Andrei Horodniceanu proton me> AuthorDate: Sat Oct 21 14:38:36 2023 + Commit: Zac Medico gentoo org> CommitDate: Sun Dec 24 19:29:16 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=eeb4c29a tests/resolver: test depclean order with IDEPEND and circular deps Bug: https://bugs.gentoo.org/916135 Signed-off-by: Andrei Horodniceanu proton.me> Closes: https://github.com/gentoo/portage/pull/1147 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_depclean_order.py | 50 +++ 1 file changed, 50 insertions(+) diff --git a/lib/portage/tests/resolver/test_depclean_order.py b/lib/portage/tests/resolver/test_depclean_order.py index 08dd249e11..867b1a54ca 100644 --- a/lib/portage/tests/resolver/test_depclean_order.py +++ b/lib/portage/tests/resolver/test_depclean_order.py @@ -1,6 +1,8 @@ # Copyright 2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import pytest + from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import ( ResolverPlayground, @@ -57,3 +59,51 @@ class SimpleDepcleanTestCase(TestCase): self.assertEqual(test_case.test_success, True, test_case.fail_msg) finally: playground.cleanup() + +@pytest.mark.xfail() +def testIDEPENDDepclean(self): +ebuilds = { +"dev-util/A-1": {}, +"dev-libs/B-1": { +"EAPI": "8", +"IDEPEND": "dev-util/A", +"RDEPEND": "dev-libs/B:=", +}, +"dev-libs/C-1": {}, +} + +installed = { +"dev-util/A-1": {}, +"dev-libs/B-1": { +"EAPI": "8", +"IDEPEND": "dev-util/A", +"RDEPEND": "dev-libs/B:0/0=", +}, +"dev-libs/C-1": {}, +} + +world = ("dev-libs/C",) + +test_cases = ( +# Remove dev-libs/B first because it IDEPENDs on dev-util/A +ResolverPlaygroundTestCase( +[], +options={"--depclean": True}, +success=True, +ordered=True, +cleanlist=[ +"dev-libs/B-1", +"dev-util/A-1", +], +), +) + +playground = ResolverPlayground( +ebuilds=ebuilds, installed=installed, world=world +) +try: +for test_case in test_cases: +playground.run_TestCase(test_case) +self.assertEqual(test_case.test_success, True, test_case.fail_msg) +finally: +playground.cleanup()
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/soname/, lib/_emerge/
commit: 70cbb9b693782eaa779cd7f9f5de6f72edc381d1 Author: Zac Medico gentoo org> AuthorDate: Tue Dec 19 05:25:40 2023 + Commit: Zac Medico gentoo org> CommitDate: Tue Dec 19 06:27:26 2023 + 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":
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, bin/
commit: 112594d7606bbb795da3ec8a01c6e295fba864d3 Author: Sam James gentoo org> AuthorDate: Sat Sep 23 13:16:23 2023 + Commit: Sam James gentoo org> CommitDate: Sun Dec 10 22:01:48 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=112594d7 Small pyupgrade fixes Signed-off-by: Sam James gentoo.org> bin/dispatch-conf| 2 +- lib/portage/tests/resolver/ResolverPlayground.py | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 849be562ee..601110ce87 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -475,7 +475,7 @@ class dispatch: try: os.rename(newconf, curconf) -except (OSError, os.error) as why: +except OSError as why: writemsg( f"dispatch-conf: Error renaming {newconf} to {curconf}: {str(why)}; fatal\n", noiselevel=-1, diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 115800a606..962550df37 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -262,7 +262,7 @@ class ResolverPlayground: try: os.makedirs(profile_path) -except os.error: +except OSError: pass repo_name_file = os.path.join(profile_path, "repo_name") @@ -305,7 +305,7 @@ class ResolverPlayground: ebuild_path = os.path.join(ebuild_dir, a.cpv.split("/")[1] + ".ebuild") try: os.makedirs(ebuild_dir) -except os.error: +except OSError: pass with open(ebuild_path, "w") as f: @@ -411,7 +411,7 @@ class ResolverPlayground: vdb_pkg_dir = os.path.join(self.vdbdir, a.cpv) try: os.makedirs(vdb_pkg_dir) -except os.error: +except OSError: pass metadata = installed[cpv].copy() @@ -457,7 +457,7 @@ class ResolverPlayground: try: os.makedirs(user_config_dir) -except os.error: +except OSError: pass for repo in self._repositories: @@ -639,7 +639,7 @@ class ResolverPlayground: try: os.makedirs(default_sets_conf_dir) -except os.error: +except OSError: pass provided_sets_portage_conf = os.path.join(str(cnf_path), "sets", "portage.conf") @@ -652,7 +652,7 @@ class ResolverPlayground: try: os.makedirs(set_config_dir) -except os.error: +except OSError: pass for sets_file, lines in sets.items():
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, /, lib/_emerge/, bin/
commit: 3011e502b399d2d02e292480252525e16dc1cfb4 Author: Michał Górny gentoo org> AuthorDate: Sun Nov 26 15:17:47 2023 + Commit: Michał Górny gentoo org> CommitDate: Thu Nov 30 04:43:53 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3011e502 Stop implicitly manipulating `NO_COLOR`/`NOCOLOR` Stop implicitly forcing `NO_COLOR` and `NOCOLOR` in ebuild environment. This is undesired for several reasons: 1. It makes it impossible to control color for emerge output independently of command output, e.g. when one goes to a pty while the other goes to logs. 2. It makes it impossible to get color output in logs when running `emerge --jobs ...`. 3. Forcing `NO_COLOR=1` turns out to cause random test failures, and while fixing them is commendable, it is a pain for arch testing and it is currently blocking stabilization requests. With the new approach, the color output in programs is consistent between using ``--jobs`` or ``--quiet-build``, and not. Therefore, both cases generate uniform logs. In order to obtain logs free of color codes, one can either filter them via `ansifilter(1)` (as the manpages already recommend) or explicitly set `NO_COLOR`. Furthermore, one can combine color-free build output (for clean logs) with colorful emerge output by using: NO_COLOR=true emerge --color y ... Bug: https://bugs.gentoo.org/918515 Signed-off-by: Michał Górny gentoo.org> Closes: https://github.com/gentoo/portage/pull/1188 Signed-off-by: Michał Górny gentoo.org> NEWS | 5 + bin/ebuild | 4 lib/_emerge/AbstractEbuildProcess.py | 6 -- lib/_emerge/actions.py | 5 - lib/portage/tests/resolver/ResolverPlayground.py | 3 --- 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index f1305744fb..eb5eb4ab08 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,11 @@ Release notes take the form of the following optional categories: portage-3.0.56 (UNRELEASED) -- +Breaking changes: +* ebuild: no longer implicitly set NOCOLOR and NO_COLOR when color output + is disabled for emerge itself. In order to obtain color-free logs, please + either explicitly set NO_COLOR environment variable or use e.g. ansifilter. + Features: * sync: git: Add sync-git-verify-max-age-days option. diff --git a/bin/ebuild b/bin/ebuild index cbefb58161..69db474c0b 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -132,10 +132,6 @@ def main(): or not sys.stdout.isatty() ): portage.output.nocolor() -portage.settings.unlock() -portage.settings["NO_COLOR"] = "true" -portage.settings.backup_changes("NO_COLOR") -portage.settings.lock() apply_priorities(portage.settings) diff --git a/lib/_emerge/AbstractEbuildProcess.py b/lib/_emerge/AbstractEbuildProcess.py index 96d91b5da8..3a8a18b5fa 100644 --- a/lib/_emerge/AbstractEbuildProcess.py +++ b/lib/_emerge/AbstractEbuildProcess.py @@ -80,12 +80,6 @@ class AbstractEbuildProcess(SpawnProcess): self._async_wait() return -if self.background: -# Automatically prevent color codes from showing up in logs, -# since we're not displaying to a terminal anyway. -self.settings["NOCOLOR"] = "true" -self.settings["NO_COLOR"] = "true" - start_ipc_daemon = False if self._enable_ipc_daemon: self.settings.pop("PORTAGE_EBUILD_EXIT_FILE", None) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 37264114e0..dbd9707a82 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -2749,15 +2749,10 @@ def adjust_config(myopts, settings): if "--color" in myopts: if "y" == myopts["--color"]: portage.output.havecolor = 1 -settings["NO_COLOR"] = "" else: portage.output.havecolor = 0 -settings["NO_COLOR"] = "true" -settings.backup_changes("NO_COLOR") elif settings.get("TERM") == "dumb" or not sys.stdout.isatty(): portage.output.havecolor = 0 -settings["NO_COLOR"] = "true" -settings.backup_changes("NO_COLOR") if "--pkg-format" in myopts: settings["PORTAGE_BINPKG_FORMAT"] = myopts["--pkg-format"] diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 475c4aaac5..115800a606 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -591,9 +591,6 @@ class ResolverPlayground: "PORTAGE_TMPDIR": os.path.join(self.eroot, "var/tmp"), } -if portage.util.no_color(os.environ): -make_conf["NO_COLOR"] = os.environ["NO_COLOR"] - # Pass along PORTAGE_USERNAME and PORTAGE_GRPNAME since they # need to be inherited
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: 31832c7faf5bffde25a596ce62ecf84c478fac45 Author: Zac Medico gentoo org> AuthorDate: Wed Nov 29 16:14:27 2023 + Commit: Zac Medico gentoo org> CommitDate: Wed Nov 29 16:33:18 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=31832c7f Optimize runtime cycle ignore_priority leaf selection loop for topological sort Since increasing ignore_priority can only lead to a larger selection of leaf nodes, there is no need to increase ignore_priority to search for smaller groups of leaf nodes. It was the "only harvest one node at a time" part of commit 3487594cd8f4 that caused the test case to succeed. Fixes: 3487594cd8f4 ("Increase ignore_priority during topological sort for runtime cycle") Bug: https://bugs.gentoo.org/917259 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py| 31 ++ lib/portage/tests/resolver/test_merge_order.py | 8 +++ 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 9f041f83a9..15c3e3ca7b 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -9478,36 +9478,29 @@ class depgraph: ) selected_nodes = [] while cycle_digraph: -# Increase ignore_priority in order to find -# smaller groups of leaf nodes. This solves -# bug 917259 which happened because too many -# leaves were selected at once. -smallest_leaves = None +leaves = None for ignore_priority in ignore_priorities: leaves = cycle_digraph.leaf_nodes( ignore_priority=ignore_priority ) -if leaves and ( -smallest_leaves is None -or len(leaves) < len(smallest_leaves) -): -smallest_leaves = leaves -if len(smallest_leaves) == 1: -break +if leaves: +# Select leaves with minimum ignore_priority, +# in order to ingore as few deps as possible. +break -if smallest_leaves is None: -smallest_leaves = [cycle_digraph.order[-1]] +if leaves is None: +leaves = [cycle_digraph.order[-1]] # Prefer installed leaves, in order to avoid -# merging something too early. -installed_leaves = [pkg for pkg in smallest_leaves if pkg.installed] +# merging something too early as in bug 917259. +installed_leaves = [pkg for pkg in leaves if pkg.installed] if installed_leaves: -smallest_leaves = installed_leaves +leaves = installed_leaves # Only harvest one node at a time, in order to # minimize the number of ignored dependencies. -cycle_digraph.remove(smallest_leaves[0]) -selected_nodes.append(smallest_leaves[0]) +cycle_digraph.remove(leaves[0]) +selected_nodes.append(leaves[0]) if not selected_nodes and myblocker_uninstalls: # An Uninstall task needs to be executed in order to diff --git a/lib/portage/tests/resolver/test_merge_order.py b/lib/portage/tests/resolver/test_merge_order.py index e6d45c847b..a6c236a207 100644 --- a/lib/portage/tests/resolver/test_merge_order.py +++ b/lib/portage/tests/resolver/test_merge_order.py @@ -385,9 +385,9 @@ class MergeOrderTestCase(TestCase): # RDEPEND in the other. However, it is not respected because # it would result in a temporarily broken RDEPEND, so we instead # rely on satisfied installed build-time dependencies. -# merge_order_assertions=( -#("app-misc/circ-buildtime-a-1", "app-misc/circ-buildtime-c-1"), -# ), +merge_order_assertions=( +("app-misc/circ-buildtime-a-1", "app-misc/circ-buildtime-c-1"), +), mergelist=[ ( "app-misc/circ-buildtime-b-1", @@ -703,9 +703,9 @@ class MergeOrderTestCase(TestCase): "app-misc/circ-direct-b-1", "x11-base/xorg-server-1.14.1", "media-libs/mesa-9.1.3", +"app-misc/circ-buildtime-a-1", "app-misc/circ-buildtime-c-1", "app-misc/circ-buildtime-b-1", -
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 2b02d8f5495cd5004c294f87beb365fd490018bd Author: Sam James gentoo org> AuthorDate: Tue Nov 28 05:33:56 2023 + Commit: Sam James gentoo org> CommitDate: Tue Nov 28 22:07:46 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2b02d8f5 tests: add runtime cycle test case with binpkgs In the reported bug, net-misc/curl gets merged (binary), then dev-util/cmake gets bulit (from source) which fails because one of the built curl's dependencies (net-libs/nghttp2) is missing: ``` [binary R] net-misc/curl-8.4.0::test_repo USE="http2%*" 0 KiB [ebuild U ] dev-util/cmake-3.27.8::test_repo [3.26.5-r2::test_repo] 0 KiB [ebuild N ] net-libs/nghttp2-1.57.0::test_repo 0 KiB ``` We should consider the existing dev-util/cmake as sufficient for nghttp2 and instead do: 1. net-libs/nghttp2-1.57.0 2. net-misc/curl-8.4.0 (binary) 3. dev-util/cmake-3.27.8 (upgrade, we didn't need to do this first as we already had a CMake installed) Bug: https://bugs.gentoo.org/918683 Signed-off-by: Sam James gentoo.org> .../resolver/test_runtime_cycle_merge_order.py | 145 + 1 file changed, 145 insertions(+) diff --git a/lib/portage/tests/resolver/test_runtime_cycle_merge_order.py b/lib/portage/tests/resolver/test_runtime_cycle_merge_order.py index a955ac3dc3..26850ccad2 100644 --- a/lib/portage/tests/resolver/test_runtime_cycle_merge_order.py +++ b/lib/portage/tests/resolver/test_runtime_cycle_merge_order.py @@ -7,6 +7,8 @@ from portage.tests.resolver.ResolverPlayground import ( ResolverPlaygroundTestCase, ) +import pytest + class RuntimeCycleMergeOrderTestCase(TestCase): def testRuntimeCycleMergeOrder(self): @@ -74,3 +76,146 @@ class RuntimeCycleMergeOrderTestCase(TestCase): self.assertEqual(test_case.test_success, True, test_case.fail_msg) finally: playground.cleanup() + +@pytest.mark.xfail() +def testBuildtimeRuntimeCycleMergeOrder(self): +installed = { +"dev-util/cmake-3.26.5-r2": { +"EAPI": "8", +"KEYWORDS": "x86", +"DEPEND": "net-misc/curl", +"RDEPEND": "net-misc/curl", +}, +"net-dns/c-ares-1.21.0": { +"EAPI": "8", +"SLOT": "0", +"KEYWORDS": "x86", +"RDEPEND": "net-dns/c-ares", +}, +"net-misc/curl-8.4.0": { +"EAPI": "8", +"SLOT": "0", +"KEYWORDS": "x86", +"DEPEND": """ +net-dns/c-ares +http2? ( net-libs/nghttp2:= ) +""", +"RDEPEND": """ +net-dns/c-ares +http2? ( net-libs/nghttp2:= ) + """, +}, +"net-dns/c-ares-1.21.0": { +"EAPI": "8", +"SLOT": "0", +"KEYWORDS": "x86", +}, +} + +binpkgs = { +"net-misc/curl-8.4.0": { +"EAPI": "8", +"SLOT": "0", +"KEYWORDS": "x86", +"IUSE": "http2", +"USE": "http2", +"DEPEND": """ +net-dns/c-ares +http2? ( net-libs/nghttp2:= ) +""", +"RDEPEND": """ +net-dns/c-ares +http2? ( net-libs/nghttp2:= ) +""", +}, +"dev-util/cmake-3.26.5-r2": { +"EAPI": "8", +"KEYWORDS": "x86", +"DEPEND": "net-misc/curl", +"RDEPEND": "net-misc/curl", +}, +} + +ebuilds = { +"dev-util/cmake-3.26.5-r2": { +"EAPI": "8", +"SLOT": "0", +"KEYWORDS": "x86", +"DEPEND": "net-misc/curl", +"RDEPEND": "net-misc/curl", +}, +"dev-util/cmake-3.27.8": { +"EAPI": "8", +"SLOT": "0", +"KEYWORDS": "~x86", +"DEPEND": "net-misc/curl", +"RDEPEND": "net-misc/curl", +}, +"net-dns/c-ares-1.21.0": { +"EAPI": "8", +"SLOT": "0", +"KEYWORDS": "x86", +}, +"net-libs/nghttp2-1.57.0": { +"EAPI": "8", +"SLOT": "0", +"KEYWORDS": "x86", +"BDEPEND": "dev-util/cmake", +"RDEPEND": "net-dns/c-ares", +}, +"net-misc/curl-8.4.0": { +"EAPI": "8", +"SLOT": "0", +"KEYWORDS": "x86", +"IUSE": "http2", +"DEPEND": """ +net-dns/c-ares +http2? ( net-libs/nghttp2:= ) +""", +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: cdc781349337fa755bc15773e2a87e4b41f5ff1e Author: Zac Medico gentoo org> AuthorDate: Wed Nov 22 21:46:12 2023 + Commit: Zac Medico gentoo org> CommitDate: Wed Nov 22 22:26:13 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cdc78134 Revert "find_smallest_cycle: Increase ignore_priority to find smaller cycles" This reverts commit 9206d5a75ecd2d9ae0fe63e57d28aa8061b5927e. The len(smallest_cycle) == 1 loop termination condition is not optimal and it's too expensive as reported in bug 917660. Bug: https://bugs.gentoo.org/917660 Bug: https://bugs.gentoo.org/917259 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py| 7 +++ .../tests/resolver/test_alternatives_gzip.py | 7 +-- lib/portage/tests/resolver/test_merge_order.py | 24 ++ .../tests/resolver/test_rebuild_ghostscript.py | 6 +++--- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 0d3b37c698..e4305c18c9 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -9345,10 +9345,9 @@ class depgraph: smallest_cycle = selected_nodes ignore_priority = priority -if smallest_cycle is not None and len(smallest_cycle) == 1: -# The cycle can't get any smaller than this, -# so there is no need to search further since -# we try to minimize ignore_priority. +# Exit this loop with the lowest possible priority, which +# minimizes the use of installed packages to break cycles. +if smallest_cycle is not None: break return smallest_cycle, ignore_priority diff --git a/lib/portage/tests/resolver/test_alternatives_gzip.py b/lib/portage/tests/resolver/test_alternatives_gzip.py index 7cd1da25f1..602ed1756f 100644 --- a/lib/portage/tests/resolver/test_alternatives_gzip.py +++ b/lib/portage/tests/resolver/test_alternatives_gzip.py @@ -1,6 +1,8 @@ # Copyright 2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +import pytest + from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import ( ResolverPlayground, @@ -8,6 +10,7 @@ from portage.tests.resolver.ResolverPlayground import ( ) +@pytest.mark.xfail() class AlternativesGzipTestCase(TestCase): def testAlternativesGzip(self): """ @@ -16,8 +19,8 @@ class AlternativesGzipTestCase(TestCase): find_smallest_cycle selects a large cycle and the topological sort produces poor results when leaf_nodes returns app-alternatives/gzip as part of a large group of nodes. -This problem was solved by increasing ignore_priority in order -to find a smaller cycle. +This problem might be solved by implementing a finer-grained +ignore_priority for leaf_nodes calls. """ ebuilds = { "app-alternatives/gzip-1": { diff --git a/lib/portage/tests/resolver/test_merge_order.py b/lib/portage/tests/resolver/test_merge_order.py index 671543ca29..940eb3bbbe 100644 --- a/lib/portage/tests/resolver/test_merge_order.py +++ b/lib/portage/tests/resolver/test_merge_order.py @@ -382,12 +382,10 @@ class MergeOrderTestCase(TestCase): ambiguous_merge_order=True, # The following merge order assertion reflects optimal order for # a circular relationship which is DEPEND in one direction and -# RDEPEND in the other. However, it is not respected because -# it would result in a temporarily broken RDEPEND, so we instead -# rely on satisfied installed build-time dependencies. -# merge_order_assertions=( -#("app-misc/circ-buildtime-a-1", "app-misc/circ-buildtime-c-1"), -# ), +# RDEPEND in the other. +merge_order_assertions=( +("app-misc/circ-buildtime-a-1", "app-misc/circ-buildtime-c-1"), +), mergelist=[ ( "app-misc/circ-buildtime-b-1", @@ -701,15 +699,15 @@ class MergeOrderTestCase(TestCase): "!app-misc/installed-blocker-a", "app-misc/circ-direct-a-1", "app-misc/circ-direct-b-1", -"app-misc/circ-satisfied-a-1", -"app-misc/circ-satisfied-c-1", -"app-misc/circ-satisfied-b-1", -"app-misc/circ-buildtime-c-1", -"app-misc/circ-buildtime-b-1", -"app-misc/circ-buildtime-a-1", -
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 1525b51fb1df477f8801470509e786558ab153dc Author: Zac Medico gentoo org> AuthorDate: Fri Nov 17 07:47:07 2023 + Commit: Zac Medico gentoo org> CommitDate: Fri Nov 17 07:57:15 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1525b51f Add test case to reproduce bug 917259 Test bug 917259, where app-alternatives/gzip is upgraded before its pigz RDEPEND is installed. This is triggered when find_smallest_cycle selects a large cycle and the topological sort produces poor results when leaf_nodes returns app-alternatives/gzip as part of a large group of nodes. This problem might be solved by implementing a finer-grained ignore_priority for leaf_nodes calls. Bug: https://bugs.gentoo.org/917259 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/meson.build | 1 + .../tests/resolver/test_alternatives_gzip.py | 248 + 2 files changed, 249 insertions(+) diff --git a/lib/portage/tests/resolver/meson.build b/lib/portage/tests/resolver/meson.build index 0d8c2921e1..7d2bd367d4 100644 --- a/lib/portage/tests/resolver/meson.build +++ b/lib/portage/tests/resolver/meson.build @@ -1,6 +1,7 @@ py.install_sources( [ 'ResolverPlayground.py', +'test_alternatives_gzip.py', 'test_aggressive_backtrack_downgrade.py', 'test_autounmask.py', 'test_autounmask_binpkg_use.py', diff --git a/lib/portage/tests/resolver/test_alternatives_gzip.py b/lib/portage/tests/resolver/test_alternatives_gzip.py new file mode 100644 index 00..602ed1756f --- /dev/null +++ b/lib/portage/tests/resolver/test_alternatives_gzip.py @@ -0,0 +1,248 @@ +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +import pytest + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( +ResolverPlayground, +ResolverPlaygroundTestCase, +) + + +@pytest.mark.xfail() +class AlternativesGzipTestCase(TestCase): +def testAlternativesGzip(self): +""" +Test bug 917259, where app-alternatives/gzip is upgraded before +its pigz RDEPEND is installed. This is triggered when +find_smallest_cycle selects a large cycle and the topological +sort produces poor results when leaf_nodes returns +app-alternatives/gzip as part of a large group of nodes. +This problem might be solved by implementing a finer-grained +ignore_priority for leaf_nodes calls. +""" +ebuilds = { +"app-alternatives/gzip-1": { +"EAPI": "8", +"RDEPEND": "reference? ( >=app-arch/gzip-1.12-r3 ) pigz? ( >=app-arch/pigz-2.8[-symlink(-)] )", +"IUSE": "reference pigz", +"REQUIRED_USE": "^^ ( reference pigz )", +}, +"app-alternatives/gzip-0": { +"EAPI": "8", +"RDEPEND": "reference? ( >=app-arch/gzip-1.12-r3 ) pigz? ( app-arch/pigz[-symlink(-)] )", +"IUSE": "reference pigz", +"REQUIRED_USE": "^^ ( reference pigz )", +}, +"app-arch/gzip-1.13": { +"EAPI": "8", +"RDEPEND": "!app-arch/pigz[symlink(-)]", +"PDEPEND": "app-alternatives/gzip", +}, +"app-arch/zstd-1.5.5": { +"EAPI": "8", +"DEPEND": ">=sys-libs/zlib-1.2.3", +"RDEPEND": ">=sys-libs/zlib-1.2.3", +}, +"app-arch/pigz-2.8": { +"EAPI": "8", +"DEPEND": ">=sys-libs/zlib-1.2.3", +"RDEPEND": ">=sys-libs/zlib-1.2.3", +"PDEPEND": "app-alternatives/gzip", +}, +"dev-lang/perl-5.36.1-r3": { +"EAPI": "8", +"BDEPEND": ">=sys-libs/zlib-1.2.12 virtual/libcrypt:=", +"RDEPEND": ">=sys-libs/zlib-1.2.12 virtual/libcrypt:=", +"DEPEND": ">=sys-libs/zlib-1.2.12 virtual/libcrypt:=", +}, +"dev-libs/libgcrypt-1.10.2": { +"EAPI": "8", +"SLOT": "0", +"BDEPEND": ">=sys-devel/automake-1.16.5", +"DEPEND": "sys-libs/glibc", +"RDEPEND": "sys-libs/glibc", +}, +"dev-libs/libpcre2-10.42-r1": { +"EAPI": "8", +"SLOT": "0/3", +"DEPEND": "sys-libs/zlib", +"RDEPEND": "sys-libs/zlib", +}, +"sys-apps/locale-gen-2.23-r1": { +"EAPI": "8", +"RDEPEND": "app-alternatives/gzip", +}, +"sys-apps/systemd-253.6": { +"EAPI": "8", +"SLOT": "0/2", +"BDEPEND": "dev-lang/perl", +"DEPEND": ">=sys-apps/util-linux-2.30:= >=dev-libs/libgcrypt-1.4.5:0= virtual/libcrypt:=
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/soname/, lib/_emerge/, lib/portage/dep/
commit: 4978b913df39abbb3369739e370856cf8292a203 Author: Zac Medico gentoo org> AuthorDate: Thu Oct 12 18:05:29 2023 + Commit: Zac Medico gentoo org> CommitDate: Thu Oct 12 18:37:26 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4978b913 Detect and handle unnecessary package reinstall Compare package rebuilds/reinstalls to installed packages of the same exact version, and eliminate unecessary rebuilds/reinstalls triggered solely by the @__auto_slot_operator_replace_installed__ set. This is careful to obey the user's wishes if they have explicitly requested for a package to be rebuilt or reinstalled for some reason. The SonameSkipUpdateTestCase::testSonameSkipUpdateNoPruneRebuilds test case shows that the new depgraph._eliminate_rebuilds method eliminates a backtracking run that is needed for the testSonameSkipUpdate test case to succeed via prune_rebuilds backtracking which was added for bug 439688. Bug: https://bugs.gentoo.org/915494 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py| 206 ++--- lib/portage/dep/_slot_operator.py | 8 +- .../tests/resolver/soname/test_skip_update.py | 19 +- 3 files changed, 199 insertions(+), 34 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index ad835ac06a..4e4452dad1 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -53,6 +53,7 @@ from portage.package.ebuild.config import _get_feature_flags from portage.package.ebuild.getmaskingstatus import _getmaskingstatus, _MaskReason from portage._sets import SETPREFIX from portage._sets.base import InternalPackageSet +from portage.dep._slot_operator import evaluate_slot_operator_equal_deps from portage.util import ConfigProtect, shlex_split, new_protect_filename from portage.util import cmp_sort_key, writemsg, writemsg_stdout from portage.util import ensure_dirs, normalize_path @@ -448,6 +449,8 @@ class _dynamic_depgraph_config: """ +_ENABLE_PRUNE_REBUILDS = True + def __init__(self, depgraph, myparams, allow_backtracking, backtrack_parameters): self.myparams = myparams.copy() self._vdb_loaded = False @@ -459,7 +462,7 @@ class _dynamic_depgraph_config: self._filtered_trees = {} # Contains installed packages and new packages that have been added # to the graph. -self._graph_trees = {} +self._graph_trees = portage._trees_dict() # Caches visible packages returned from _select_package, for use in # depgraph._iter_atoms_for_pkg() SLOT logic. self._visible_pkgs = {} @@ -570,6 +573,12 @@ class _dynamic_depgraph_config: graph_tree.dbapi = fakedb self._graph_trees[myroot] = {} +self._graph_trees._running_eroot = ( +depgraph._frozen_config._trees_orig._running_eroot +) +self._graph_trees._target_eroot = ( +depgraph._frozen_config._trees_orig._target_eroot +) self._filtered_trees[myroot] = {} # Substitute the graph tree for the vartree in dep_check() since we # want atom selections to be consistent with package selections @@ -3588,7 +3597,148 @@ class depgraph: return False return True -def _remove_pkg(self, pkg): +def _eliminate_rebuilds(self): +""" +Compare package rebuilds/reinstalls to installed packages of the same +exact version, and eliminate unnecessary rebuilds/reinstalls triggered +solely by the @__auto_slot_operator_replace_installed__ set. This is +careful to obey the user's wishes if they have explicitly requested +for a package to be rebuilt or reinstalled for some reason. +""" +modified = False +selective = "selective" in self._dynamic_config.myparams +for root, atom in self._dynamic_config._slot_operator_replace_installed: +for pkg in self._dynamic_config._package_tracker.match( +root, atom, installed=False +): +installed_instance = self._frozen_config.trees[root][ +"vartree" +].dbapi.match_pkgs(pkg.slot_atom) +if not installed_instance: +continue +installed_instance = installed_instance[0] +if installed_instance.cpv != pkg.cpv: +continue +if pkg in self._dynamic_config._reinstall_nodes: +# --newuse, --changed-use +continue + +if self._dynamic_config.myparams.get("changed_slot") and ( +self._changed_slot(pkg) or self._changed_slot(installed_instance) +): +continue + +unsatisfied_parent = any( +not atom.match(installed_instance)
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/portage/dbapi/
commit: c9fb98b4913b286ed404d1df408e51d4f17b1dfb Author: John Helmert III gentoo org> AuthorDate: Tue Jan 17 03:16:17 2023 + Commit: Sam James gentoo org> CommitDate: Tue Sep 19 07:15:59 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c9fb98b4 ResolverPlayground: produce pkgdir indexes Tests expect the index to be generated anyway, so let's not rely on implicit FEATURES=-pkgdir-index-trusted. Signed-off-by: John Helmert III gentoo.org> Signed-off-by: Sam James gentoo.org> lib/portage/dbapi/bintree.py | 9 - lib/portage/tests/resolver/ResolverPlayground.py | 4 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py index ec31b52d00..9d7c45577b 100644 --- a/lib/portage/dbapi/bintree.py +++ b/lib/portage/dbapi/bintree.py @@ -803,7 +803,13 @@ class binarytree: except PortageException: pass -def populate(self, getbinpkgs=False, getbinpkg_refresh=False, add_repos=()): +def populate( +self, +getbinpkgs=False, +getbinpkg_refresh=False, +add_repos=(), +force_reindex=False, +): """ Populates the binarytree with package metadata. @@ -833,6 +839,7 @@ class binarytree: try: update_pkgindex = self._populate_local( reindex="pkgdir-index-trusted" not in self.settings.features +or force_reindex ) if update_pkgindex and self.dbapi.writable: diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 7f97d3100c..f1cd844708 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -17,6 +17,7 @@ from portage.const import ( ) from portage.process import find_binary from portage.dep import Atom, _repo_separator +from portage.dbapi.bintree import binarytree from portage.package.ebuild.config import config from portage.package.ebuild.digestgen import digestgen from portage._sets import load_default_config @@ -397,6 +398,9 @@ class ResolverPlayground: else: raise InvalidBinaryPackageFormat(binpkg_format) +bintree = binarytree(pkgdir=self.pkgdir, settings=self.settings) +bintree.populate(force_reindex=True) + def _create_installed(self, installed): for cpv in installed: a = Atom("=" + cpv, allow_repo=True)
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/, /
commit: a2da08b6dfbfd2ef803aac6302f9de1f7c00a143 Author: Sam James gentoo org> AuthorDate: Wed Jun 21 18:54:24 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jun 21 18:55:45 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a2da08b6 Revert "depgraph: Don't ignore downgrades as missed_updates" This reverts commit 44afa8445dc46464200fe46c1e09e0c7475067bf. This is just so we can make a release for the other fixes in master like the Perl bits and keep a linear history. Signed-off-by: Sam James gentoo.org> NEWS | 2 -- lib/_emerge/depgraph.py| 4 +++- lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index cb68579f4..f2f716073 100644 --- a/NEWS +++ b/NEWS @@ -5,8 +5,6 @@ Bug fixes: * Adjust write tests for DISTDIR and PORTAGE_TMPDIR to work with automount directories (bug #485100, bug #890812). -* depgraph: Don't ignore downgrades as missed_updates (bug #622270). - * depgraph: Do not allow slotted deps to be satisfied by wrong slots (bug #463976, bug #592880, bug #596664, bug #631490, bug #764365, bug #793992). diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 28acfed9d..a36ab6351 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -1287,7 +1287,9 @@ class depgraph: pkg.root, pkg.slot_atom ): any_selected = True -if not chosen_pkg.installed and chosen_pkg.version == pkg.version: +if chosen_pkg > pkg or ( +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 b23126d5f..14e98cd00 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=[], +mergelist=["x11-base/xwayland-23.1.1"], ), )
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: ed1314f10623b25365a697c74eb25d557eb91edd Author: Sam James gentoo org> AuthorDate: Mon Jun 19 20:25:34 2023 + Commit: Sam James gentoo org> CommitDate: Mon Jun 19 21:17:37 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ed1314f1 tests: rename test_unecessary_slot_upgrade.py -> test_unnecessary_slot_upgrade.py Signed-off-by: Sam James gentoo.org> .../{test_unecessary_slot_upgrade.py => test_unnecessary_slot_upgrade.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/lib/portage/tests/resolver/test_unecessary_slot_upgrade.py b/lib/portage/tests/resolver/test_unnecessary_slot_upgrade.py similarity index 100% rename from lib/portage/tests/resolver/test_unecessary_slot_upgrade.py rename to lib/portage/tests/resolver/test_unnecessary_slot_upgrade.py
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 2af4bc17d1b4ea1581bb191dfa7f34ec64ab140b Author: YiFei Zhu gmail com> AuthorDate: Mon Jun 12 02:07:39 2023 + Commit: Sam James gentoo org> CommitDate: Fri Jun 16 03:34:46 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2af4bc17 tests: resolver: Test the (bad) behavior of bug #622270 Without fixing the bug. This is so we have a baseline behavior to compare against. Bug: https://bugs.gentoo.org/439688 Bug: https://bugs.gentoo.org/622270 Signed-off-by: YiFei Zhu gmail.com> Signed-off-by: Sam James gentoo.org> .../resolver/test_slot_conflict_blocked_prune.py | 78 ++ 1 file changed, 78 insertions(+) diff --git a/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py b/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py new file mode 100644 index 0..14e98cd00 --- /dev/null +++ b/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py @@ -0,0 +1,78 @@ +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( +ResolverPlayground, +ResolverPlaygroundTestCase, +) + + +class SlotConflictBlockedPruneTestCase(TestCase): +def testSlotConflictBlockedPrune(self): +""" +Bug 622270 +Downgrading package (as openssl here) due to un-accepting unstable. +Dependent package (as rustup here) cannot be rebuilt due to missing +keyword, so dependee downgrade is cancelled, but other dependents +(such as xwayland here) are rebuilt nevertheless. This should not +happen and the rebuilds should be pruned. +""" +ebuilds = { +"x11-base/xwayland-23.1.1": { +"EAPI": "5", +"RDEPEND": "dev-libs/openssl:=", +}, +"dev-util/rustup-1.25.2": { +"EAPI": "5", +"RDEPEND": "dev-libs/openssl:0=", +"KEYWORDS": "~x86", +}, +"dev-libs/openssl-1.1.1u": { +"EAPI": "5", +"SLOT": "0/1.1", +}, +"dev-libs/openssl-3.1.1": { +"EAPI": "5", +"SLOT": "0/3", +"KEYWORDS": "~x86", +}, +} + +installed = { +"x11-base/xwayland-23.1.1": { +"EAPI": "5", +"RDEPEND": "dev-libs/openssl:0/3=", +}, +"dev-util/rustup-1.25.2": { +"EAPI": "5", +"RDEPEND": "dev-libs/openssl:0/3=", +"KEYWORDS": "~x86", +}, +"dev-libs/openssl-3.1.1": { +"EAPI": "5", +"SLOT": "0/3", +"KEYWORDS": "~x86", +}, +} + +world = ["x11-base/xwayland", "dev-util/rustup"] + +test_cases = ( +ResolverPlaygroundTestCase( +["@world"], +options={"--deep": True, "--update": True, "--verbose": True}, +success=True, +mergelist=["x11-base/xwayland-23.1.1"], +), +) + +playground = ResolverPlayground( +ebuilds=ebuilds, installed=installed, world=world +) +try: +for test_case in test_cases: +playground.run_TestCase(test_case) +self.assertEqual(test_case.test_success, True, test_case.fail_msg) +finally: +playground.cleanup()
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: ff457f742b513a65e6609054e5310f8beee488ec Author: YiFei Zhu gmail com> AuthorDate: Tue Jun 13 08:08:51 2023 + Commit: Sam James gentoo org> CommitDate: Fri Jun 16 03:34:46 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ff457f74 tests: resolver: Test the broken behavior of Perl rebuild bug Bug: https://bugs.gentoo.org/463976 Bug: https://bugs.gentoo.org/592880 Bug: https://bugs.gentoo.org/596664 Bug: https://bugs.gentoo.org/631490 Bug: https://bugs.gentoo.org/764365 Bug: https://bugs.gentoo.org/793992 Signed-off-by: YiFei Zhu gmail.com> Signed-off-by: Sam James gentoo.org> .../tests/resolver/test_perl_rebuild_bug.py| 121 + 1 file changed, 121 insertions(+) diff --git a/lib/portage/tests/resolver/test_perl_rebuild_bug.py b/lib/portage/tests/resolver/test_perl_rebuild_bug.py new file mode 100644 index 0..928fd47d7 --- /dev/null +++ b/lib/portage/tests/resolver/test_perl_rebuild_bug.py @@ -0,0 +1,121 @@ +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( +ResolverPlayground, +ResolverPlaygroundTestCase, +) + + +class PerlRebuildBugTestCase(TestCase): +def __init__(self, *args, **kwargs): +super().__init__(*args, **kwargs) + +def testPerlRebuildBug(self): +""" +The infamous Perl rebuild bug. + +A non-slotted build-time dependency cycle is created by: +dev-lang/perl -> sys-libs/zlib -> sys-devel/automake -> dev-lang/perl +Everything else depends on this cycle. + +Bug in solving for smallest cycle causes slot in RDEPEND of +dev-perl/Locale-gettext to be ignored, so all dependencies other than +perl's >=sys-libs/zlib-1.2.12 are satisfied by already-installed +packages. dev-perl/Locale-gettext and sys-devel/automake become leaves +of the depgraph after satisfied packages are ignored. They become +emerged first. This causes an issue because dev-perl/Locale-gettext is +now built before the slot upgrade of dev-lang/perl. +""" +ebuilds = { +"dev-lang/perl-5.36.0-r2": { +"EAPI": "5", +"DEPEND": ">=sys-libs/zlib-1.2.12", +"RDEPEND": ">=sys-libs/zlib-1.2.12", +"SLOT": "0/5.36", +}, +"dev-perl/Locale-gettext-1.70.0-r1": { +"EAPI": "5", +"DEPEND": "dev-lang/perl", +"RDEPEND": "dev-lang/perl:=", +}, +"sys-apps/help2man-1.49.3": { +"EAPI": "5", +"DEPEND": "dev-lang/perl dev-perl/Locale-gettext", +"RDEPEND": "dev-lang/perl dev-perl/Locale-gettext", +}, +"sys-devel/automake-1.16.5": { +"EAPI": "5", +"DEPEND": "dev-lang/perl", +"RDEPEND": "dev-lang/perl", +}, +"sys-libs/zlib-1.2.13-r1": { +"EAPI": "5", +"DEPEND": "sys-devel/automake", +}, +} + +installed = { +"dev-lang/perl-5.34.0-r3": { +"EAPI": "5", +"DEPEND": "sys-libs/zlib", +"RDEPEND": "sys-libs/zlib", +"SLOT": "0/5.34", +}, +"dev-perl/Locale-gettext-1.70.0-r1": { +"EAPI": "5", +"DEPEND": "dev-lang/perl", +"RDEPEND": "dev-lang/perl:0/5.34=", +}, +"sys-apps/help2man-1.48.5": { +"EAPI": "5", +"DEPEND": "dev-lang/perl dev-perl/Locale-gettext", +"RDEPEND": "dev-lang/perl dev-perl/Locale-gettext", +}, +"sys-devel/automake-1.16.4": { +"EAPI": "5", +"DEPEND": "dev-lang/perl", +"RDEPEND": "dev-lang/perl", +}, +"sys-libs/zlib-1.2.11-r4": { +"EAPI": "5", +"DEPEND": "sys-devel/automake", +}, +} + +world = ["sys-apps/help2man"] + +test_cases = ( +ResolverPlaygroundTestCase( +["@world"], +options={"--deep": True, "--update": True, "--verbose": True}, +success=True, +ambiguous_merge_order=True, +merge_order_assertions=( +( +"dev-perl/Locale-gettext-1.70.0-r1", +"dev-lang/perl-5.36.0-r2", +), +), +mergelist=[ +"dev-perl/Locale-gettext-1.70.0-r1", +"sys-devel/automake-1.16.5", +"sys-libs/zlib-1.2.13-r1", +"dev-lang/perl-5.36.0-r2", +"sys-apps/help2man-1.49.3", +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 43f6dc219035bacd1bb3013c457fd3ea64f2d0d8 Author: David Palao gmail com> AuthorDate: Mon May 1 09:26:54 2023 + Commit: Sam James gentoo org> CommitDate: Fri May 26 15:44:36 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=43f6dc21 tests: resolver: port testAutounmaskMultilibUse to pytest using xfail ...instead of the addTodo mechanism. Signed-off-by: David Palao gmail.com> Signed-off-by: Sam James gentoo.org> lib/portage/tests/resolver/test_autounmask_multilib_use.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/portage/tests/resolver/test_autounmask_multilib_use.py b/lib/portage/tests/resolver/test_autounmask_multilib_use.py index b25318343..9be0f09cf 100644 --- a/lib/portage/tests/resolver/test_autounmask_multilib_use.py +++ b/lib/portage/tests/resolver/test_autounmask_multilib_use.py @@ -1,6 +1,8 @@ # Copyright 2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import pytest + from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import ( ResolverPlayground, @@ -9,6 +11,7 @@ from portage.tests.resolver.ResolverPlayground import ( class AutounmaskMultilibUseTestCase(TestCase): +@pytest.mark.xfail() def testAutounmaskMultilibUse(self): self.todo = True
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 8469e5fa81f34466a15d3a422b0bb04a19f19869 Author: David Palao gmail com> AuthorDate: Fri May 5 13:17:20 2023 + Commit: Sam James gentoo org> CommitDate: Fri May 26 15:44:36 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8469e5fa tests: resolver: port testAutounmaskUseSlotConflict to pytest using xfail Signed-off-by: David Palao gmail.com> Signed-off-by: Sam James gentoo.org> lib/portage/tests/resolver/test_autounmask_use_slot_conflict.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/portage/tests/resolver/test_autounmask_use_slot_conflict.py b/lib/portage/tests/resolver/test_autounmask_use_slot_conflict.py index 5f3e03b56..2db1396bc 100644 --- a/lib/portage/tests/resolver/test_autounmask_use_slot_conflict.py +++ b/lib/portage/tests/resolver/test_autounmask_use_slot_conflict.py @@ -1,6 +1,8 @@ -# Copyright 2017-2021 Gentoo Authors +# Copyright 2017-2021, 2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +import pytest + from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import ( ResolverPlayground, @@ -9,6 +11,7 @@ from portage.tests.resolver.ResolverPlayground import ( class AutounmaskUseSlotConflictTestCase(TestCase): +@pytest.mark.xfail() def testAutounmaskUseSlotConflict(self): self.todo = True
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 811fcbc046bb4657af311c98936abdf0e26c58a2 Author: David Palao gmail com> AuthorDate: Fri Apr 28 14:19:37 2023 + Commit: Sam James gentoo org> CommitDate: Fri May 26 15:44:36 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=811fcbc0 tests: resolver: use xfail w/ pytest Signed-off-by: David Palao gmail.com> Signed-off-by: Sam James gentoo.org> lib/portage/tests/resolver/test_or_choices.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py index 9e2c0980b..19ecfe31c 100644 --- a/lib/portage/tests/resolver/test_or_choices.py +++ b/lib/portage/tests/resolver/test_or_choices.py @@ -3,6 +3,8 @@ import itertools +import pytest + from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import ( ResolverPlayground, @@ -637,6 +639,7 @@ class OrChoicesTestCase(TestCase): class OrChoicesLibpostprocTestCase(TestCase): +@pytest.mark.xfail(reason="Irrelevant blocker conflict") def testOrChoicesLibpostproc(self): # This test case is expected to fail after the fix for bug 706278, # since the "undesirable" slot upgrade which triggers a blocker conflict
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 996babb5aa005edef4abb86de1dc585d630ac21d Author: Sam James gentoo org> AuthorDate: Sat Feb 18 13:26:47 2023 + Commit: Sam James gentoo org> CommitDate: Sun Feb 19 19:19:44 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=996babb5 tests: resolver: add basic BDEPEND + IDEPEND tests These aren't very interesting but they at least check that BDEPEND/IDEPEND affect dependency resolution. I started to look at testing --with-bdeps but got into the weeds. Signed-off-by: Sam James gentoo.org> lib/portage/tests/resolver/test_eapi.py | 43 + 1 file changed, 43 insertions(+) diff --git a/lib/portage/tests/resolver/test_eapi.py b/lib/portage/tests/resolver/test_eapi.py index 1d6c58633..5d425ccdb 100644 --- a/lib/portage/tests/resolver/test_eapi.py +++ b/lib/portage/tests/resolver/test_eapi.py @@ -185,3 +185,46 @@ class EAPITestCase(TestCase): self.assertEqual(test_case.test_success, True, test_case.fail_msg) finally: playground.cleanup() + +def testBdepend(self): +ebuilds = { +"dev-libs/A-1.0": {"EAPI": 7}, +"dev-libs/B-1.0": {"EAPI": 7, "BDEPEND": "dev-libs/A"}, +} + +# Verify that BDEPEND is considered at all. +test_case = ResolverPlaygroundTestCase( +["=dev-libs/B-1.0"], +success=True, +mergelist=["dev-libs/A-1.0", "dev-libs/B-1.0"], +) + +playground = ResolverPlayground(ebuilds=ebuilds, debug=True) +try: +playground.run_TestCase(test_case) +self.assertEqual(test_case.test_success, True, test_case.fail_msg) +finally: +playground.cleanup() + +def testIdepend(self): +ebuilds = { +"dev-libs/A-1.0": {"EAPI": 8}, +"dev-libs/B-1.0": {"EAPI": 8, "IDEPEND": "dev-libs/A"}, +} + +test_cases = ( +# Verify that IDEPEND is considered at all. +ResolverPlaygroundTestCase( +["=dev-libs/B-1.0"], +success=True, +mergelist=["dev-libs/A-1.0", "dev-libs/B-1.0"], +), +) + +playground = ResolverPlayground(ebuilds=ebuilds) +try: +for test_case in test_cases: +playground.run_TestCase(test_case) +self.assertEqual(test_case.test_success, True, test_case.fail_msg) +finally: +playground.cleanup()
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: d1eedbb56386e2e7509c6140a238280aaf55eb17 Author: Mike Gilbert gentoo org> AuthorDate: Sat Dec 31 22:52:25 2022 + Commit: Mike Gilbert gentoo org> CommitDate: Mon Jan 2 20:35:29 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d1eedbb5 ResolverPlayground: include PATH in env passed to portage.create_trees() Fixes failing tests after previous change to _doebuild_path. Signed-off-by: Mike Gilbert gentoo.org> lib/portage/tests/resolver/ResolverPlayground.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index e43b12dd3..6cd10acda 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -686,6 +686,7 @@ class ResolverPlayground: create_trees_kwargs["target_root"] = self.target_root env = { +"PATH": os.environ["PATH"], "PORTAGE_REPOSITORIES": "\n".join( "[%s]\n%s" % ( @@ -693,7 +694,7 @@ class ResolverPlayground: "\n".join("{} = {}".format(k, v) for k, v in repo_config.items()), ) for repo_name, repo_config in self._repositories.items() -) +), } if self.debug:
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 44ea72efd7378cb26cb58cea7534449b1f4968c6 Author: Zac Medico gentoo org> AuthorDate: Mon Jul 25 21:36:16 2022 + Commit: Zac Medico gentoo org> CommitDate: Mon Jul 25 21:37:04 2022 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=44ea72ef ResolverPlayground: unconditionally setup essential_binaries Closes: https://bugs.gentoo.org/861077 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/ResolverPlayground.py | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 788334f89..361de16af 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -129,8 +129,11 @@ class ResolverPlayground: """ self.debug = debug -if eprefix is None: -self.eprefix = normalize_path(tempfile.mkdtemp()) +if True: +if eprefix is None: +self.eprefix = normalize_path(tempfile.mkdtemp()) +else: +self.eprefix = normalize_path(eprefix) # EPREFIX/bin is used by fake true_binaries. Real binaries goes into EPREFIX/usr/bin eubin = os.path.join(self.eprefix, "usr", "bin") @@ -192,8 +195,6 @@ class ResolverPlayground: os.symlink(path, os.path.join(eubin, x)) finally: os.environ["PATH"] = orig_path -else: -self.eprefix = normalize_path(eprefix) # Tests may override portage.const.EPREFIX in order to # simulate a prefix installation. It's reasonable to do
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 377af689e165db987981385a1f683444c9cdfcda Author: Mike Gilbert gentoo org> AuthorDate: Mon Jul 25 20:19:26 2022 + Commit: Mike Gilbert gentoo org> CommitDate: Mon Jul 25 20:19:26 2022 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=377af689 ResolverPlayground: add "bash" to essential_binaries Signed-off-by: Mike Gilbert gentoo.org> lib/portage/tests/resolver/ResolverPlayground.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index ec69ee068..788334f89 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -146,6 +146,7 @@ class ResolverPlayground: essential_binaries = ( "awk", "basename", +"bash", "bzip2", "cat", "chgrp",
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/, lib/portage/package/ebuild/_config/, ...
commit: dd81609ed029884a17171d42948313d42b3fd5e8 Author: Matt Turner gentoo org> AuthorDate: Sat Apr 2 18:47:14 2022 + Commit: Matt Turner gentoo org> CommitDate: Sat Apr 2 19:14:04 2022 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=dd81609e Eliminate USE aliases These were part of the 4-python and 5-progress EAPIs and were a branch of the code deep enough to warrant its removal in its own patch. Signed-off-by: Matt Turner gentoo.org> lib/_emerge/Package.py | 39 ++--- lib/_emerge/depgraph.py | 16 +-- lib/_emerge/resolver/slot_collision.py | 8 +- lib/portage/dbapi/__init__.py| 28 ++-- lib/portage/package/ebuild/_config/UseManager.py | 175 --- lib/portage/tests/resolver/ResolverPlayground.py | 2 - 6 files changed, 30 insertions(+), 238 deletions(-) diff --git a/lib/_emerge/Package.py b/lib/_emerge/Package.py index 7c4997aab..db42d836e 100644 --- a/lib/_emerge/Package.py +++ b/lib/_emerge/Package.py @@ -140,9 +140,8 @@ class Package(Task): implicit_match = db._iuse_implicit_cnstr(self.cpv, self._metadata) else: implicit_match = db._repoman_iuse_implicit_cnstr(self.cpv, self._metadata) -usealiases = self.root_config.settings._use_manager.getUseAliases(self) self.iuse = self._iuse( -self, self._metadata["IUSE"].split(), implicit_match, usealiases, self.eapi +self, self._metadata["IUSE"].split(), implicit_match, self.eapi ) if (self.iuse.enabled or self.iuse.disabled) and not eapi_attrs.iuse_defaults: @@ -735,25 +734,19 @@ class Package(Task): "__weakref__", "_iuse_implicit_match", "_pkg", -"alias_mapping", "all", -"all_aliases", "enabled", "disabled", "tokens", ) -def __init__(self, pkg, tokens, iuse_implicit_match, aliases, eapi): +def __init__(self, pkg, tokens, iuse_implicit_match, eapi): self._pkg = pkg self.tokens = tuple(tokens) self._iuse_implicit_match = iuse_implicit_match enabled = [] disabled = [] other = [] -enabled_aliases = [] -disabled_aliases = [] -other_aliases = [] -self.alias_mapping = {} for x in tokens: prefix = x[:1] if prefix == "+": @@ -762,12 +755,9 @@ class Package(Task): disabled.append(x[1:]) else: other.append(x) -self.enabled = frozenset(chain(enabled, enabled_aliases)) -self.disabled = frozenset(chain(disabled, disabled_aliases)) +self.enabled = frozenset(enabled) +self.disabled = frozenset(disabled) self.all = frozenset(chain(enabled, disabled, other)) -self.all_aliases = frozenset( -chain(enabled_aliases, disabled_aliases, other_aliases) -) def is_valid_flag(self, flags): """ @@ -778,11 +768,7 @@ class Package(Task): flags = [flags] for flag in flags: -if ( -not flag in self.all -and not flag in self.all_aliases -and not self._iuse_implicit_match(flag) -): +if self.get_flag(flag) is None: return False return True @@ -794,27 +780,18 @@ class Package(Task): flags = [flags] missing_iuse = [] for flag in flags: -if ( -not flag in self.all -and not flag in self.all_aliases -and not self._iuse_implicit_match(flag) -): +if self.get_flag(flag) is None: missing_iuse.append(flag) return missing_iuse -def get_real_flag(self, flag): +def get_flag(self, flag): """ Returns the flag's name within the scope of this package -(accounting for aliases), or None if the flag is unknown. +or None if the flag is unknown. """ if flag in self.all: return flag -if flag in self.all_aliases: -for k, v in self.alias_mapping.items(): -if flag in v: -return k - if self._iuse_implicit_match(flag): return flag diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 14a71a610..c3f872c43 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -7182,21 +7182,21 @@ class depgraph: new_changes = {} for flag, state in target_use.items(): -
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 041763a8b7cda7dac0b75aa4a85eb73f333b7e55 Author: Zac Medico gentoo org> AuthorDate: Mon Feb 14 00:11:43 2022 + Commit: Zac Medico gentoo org> CommitDate: Mon Feb 14 00:13:05 2022 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=041763a8 Add unit test to reproduce bug 833014 Bug: https://bugs.gentoo.org/833014 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_installkernel.py | 111 +++ 1 file changed, 111 insertions(+) diff --git a/lib/portage/tests/resolver/test_installkernel.py b/lib/portage/tests/resolver/test_installkernel.py new file mode 100644 index 0..b73bbe5bb --- /dev/null +++ b/lib/portage/tests/resolver/test_installkernel.py @@ -0,0 +1,111 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( +ResolverPlayground, +ResolverPlaygroundTestCase, +) + + +class InstallKernelTestCase(TestCase): +def testInstallKernel(self): +ebuilds = { +"sys-kernel/installkernel-systemd-boot-1": { +"EAPI": "8", +"RDEPEND": "!sys-kernel/installkernel-gentoo", +}, +"sys-kernel/installkernel-gentoo-3": { +"EAPI": "8", +"RDEPEND": "!sys-kernel/installkernel-systemd-boot", +}, +"sys-kernel/gentoo-kernel-5.15.23": { +"EAPI": "8", +"PDEPEND": ">=virtual/dist-kernel-5.15.23", +"RDEPEND": "|| ( sys-kernel/installkernel-gentoo sys-kernel/installkernel-systemd-boot )", +}, +"sys-kernel/gentoo-kernel-bin-5.15.23": { +"EAPI": "8", +"PDEPEND": ">=virtual/dist-kernel-5.15.23", +"RDEPEND": "|| ( sys-kernel/installkernel-gentoo sys-kernel/installkernel-systemd-boot )", +}, +"virtual/dist-kernel-5.15.23": { +"EAPI": "8", +"PDEPEND": "|| ( ~sys-kernel/gentoo-kernel-5.15.23 ~sys-kernel/gentoo-kernel-bin-5.15.23 )", +}, +} + +installed = { +"sys-kernel/installkernel-gentoo-3": { +"EAPI": "8", +"RDEPEND": "!sys-kernel/installkernel-systemd-boot", +}, +} + +test_cases = ( +ResolverPlaygroundTestCase( +[ +"sys-kernel/installkernel-systemd-boot", +], +ambiguous_merge_order=True, +success=True, +mergelist=[ +"sys-kernel/installkernel-systemd-boot-1", +"[uninstall]sys-kernel/installkernel-gentoo-3", +( +"!sys-kernel/installkernel-gentoo", +"!sys-kernel/installkernel-systemd-boot", +), +], +), +# Demonstrate bug 833014, where the calculation fails unless +# --update and --deep are specified. +ResolverPlaygroundTestCase( +[ +"sys-kernel/installkernel-systemd-boot", +"sys-kernel/gentoo-kernel-bin", +], +ambiguous_merge_order=True, +success=False, +mergelist=[ +"sys-kernel/installkernel-systemd-boot-1", +"sys-kernel/gentoo-kernel-bin-5.15.23", +"virtual/dist-kernel-5.15.23", +( +"!sys-kernel/installkernel-gentoo", +"!sys-kernel/installkernel-systemd-boot", +), +], +), +ResolverPlaygroundTestCase( +[ +"sys-kernel/installkernel-systemd-boot", +"sys-kernel/gentoo-kernel-bin", +], +ambiguous_merge_order=True, +success=True, +options={"--deep": True, "--update": True}, +mergelist=[ +"virtual/dist-kernel-5.15.23", +"sys-kernel/installkernel-systemd-boot-1", +"sys-kernel/gentoo-kernel-bin-5.15.23", +"[uninstall]sys-kernel/installkernel-gentoo-3", +( +"!sys-kernel/installkernel-systemd-boot", +"!sys-kernel/installkernel-gentoo", +), +], +), +) + +playground = ResolverPlayground( +debug=False, ebuilds=ebuilds, installed=installed +) + +try: +for test_case in test_cases: +playground.run_TestCase(test_case) +self.assertEqual(test_case.test_success, True, test_case.fail_msg) +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/portage/dbapi/, lib/portage/
commit: ad7882a1cba4cedf6288abeff0fd2b8052b5302a Author: Sheng Yu protonmail com> AuthorDate: Wed Feb 2 11:54:18 2022 + Commit: Sam James gentoo org> CommitDate: Wed Feb 9 10:40:35 2022 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ad7882a1 Ignore all XPAK when "binpkg-request-signature" enabled. XPAK format does not support signature and should be avoided when mandatory signature is expected. Signed-off-by: Sheng Yu protonmail.com> Closes: https://github.com/gentoo/portage/pull/785 Signed-off-by: Sam James gentoo.org> lib/portage/dbapi/bintree.py | 83 +++- lib/portage/exception.py | 8 +-- lib/portage/tests/resolver/ResolverPlayground.py | 7 +- 3 files changed, 90 insertions(+), 8 deletions(-) diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py index 8bfe5e97d..b441fff9a 100644 --- a/lib/portage/dbapi/bintree.py +++ b/lib/portage/dbapi/bintree.py @@ -42,8 +42,10 @@ from portage.exception import ( ParseError, PortageException, PortagePackageException, +SignatureException, ) from portage.localization import _ +from portage.output import colorize from portage.package.ebuild.profile_iuse import iter_iuse_vars from portage.util.file_copy import copyfile from portage.util.futures import asyncio @@ -887,6 +889,14 @@ class binarytree: # the Packages file will not be needlessly re-written due to # missing digests. minimum_keys = self._pkgindex_keys.difference(self._pkgindex_hashes) + +if "binpkg-request-signature" in self.settings.features: +gpkg_only = True +else: +gpkg_only = False + +gpkg_only_warned = False + if True: pkg_paths = {} self._pkg_paths = pkg_paths @@ -911,6 +921,17 @@ class binarytree: if not path: binpkg_format = d["BINPKG_FORMAT"] if binpkg_format == "xpak": +if gpkg_only: +if not gpkg_only_warned: +writemsg( +colorize( +"WARN", +"Local XPAK packages are ignored due to 'binpkg-request-signature'.\n", +), +noiselevel=-1, +) +gpkg_only_warned = True +continue path = cpv + ".tbz2" elif binpkg_format == "gpkg": path = cpv + ".gpkg.tar" @@ -944,6 +965,19 @@ class binarytree: SUPPORTED_XPAK_EXTENSIONS + SUPPORTED_GPKG_EXTENSIONS ): continue + +if myfile.endswith(SUPPORTED_XPAK_EXTENSIONS) and gpkg_only: +if not gpkg_only_warned: +writemsg( +colorize( +"WARN", +"Local XPAK packages are ignored due to 'binpkg-request-signature'.\n", +), +noiselevel=-1, +) +gpkg_only_warned = True +continue + mypath = os.path.join(mydir, myfile) full_path = os.path.join(self.pkgdir, mypath) s = os.lstat(full_path) @@ -1004,6 +1038,22 @@ class binarytree: binpkg_format = None if match: binpkg_format = match.get("BINPKG_FORMAT", None) + +if gpkg_only: +if binpkg_format != "gpkg": +if not gpkg_only_warned: +writemsg( +colorize( +"WARN", +"Local XPAK packages are ignored due to 'binpkg-request-signature'.\n", +), +noiselevel=-1, +) +gpkg_only_warned = True +continue +else: +binpkg_format = "gpkg" + try: pkg_metadata = self._read_metadata( full_path, @@ -1011,7 +1061,7 @@ class binarytree: keys=chain(self.dbapi._aux_cache_keys, ("PF", "CATEGORY")), binpkg_format=binpkg_format, ) -except PortagePackageException as e: +except
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 8d442378bbb03b1c95595d0a21a012291245bda7 Author: Felix Bier gmail com> AuthorDate: Tue May 11 21:46:49 2021 + Commit: Zac Medico gentoo org> CommitDate: Mon May 24 06:22:38 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8d442378 unmerge: Add tests for unmerge order This commit adds unit tests for verifying the unmerge order that is calculated by unmerge_display(). Signed-off-by: Felix Bier rohde-schwarz.com> Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_unmerge_order.py | 179 +++ 1 file changed, 179 insertions(+) diff --git a/lib/portage/tests/resolver/test_unmerge_order.py b/lib/portage/tests/resolver/test_unmerge_order.py new file mode 100644 index 0..298bfd9ea --- /dev/null +++ b/lib/portage/tests/resolver/test_unmerge_order.py @@ -0,0 +1,179 @@ +# Copyright 2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +import os + +from _emerge.unmerge import _unmerge_display + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ResolverPlayground + +class _TestData: + def __init__(self, unmerge_files, expected_pkgmap): + self.unmerge_files = unmerge_files + + # The pkgmap created by unmerge_display is a list where each entry is of the form + # {"selected": list(...), "omitted": set(...), "protected": set(...) }. + # To simplify the notation of the test data, we receive a list with entries of the form + # (s1,o1) + # The entries are then translated to the expected form: + # {"selected": s1, "omitted": o1, "protected": set()} + # The "protected" field is not relevant for testing ordering. + # The ordering of the "omitted" field is not relevant. + expand = lambda x: {"selected": x[0], "omitted": set(x[1]), "protected": set()} + self.expected_pkgmap = list(map(expand, expected_pkgmap)) + +class UnmergeOrderTestCase(TestCase): + + def testUnmergeOrder(self): + ebuilds = { + "c/x-1": {}, + + "c/y-2": {}, + "c/y-3": {}, + + "c/z-4": {}, + "c/z-5": {}, + "c/z-6": {}, + + "c/zz-4": {}, + "c/zz-5": {}, + "c/zz-6": {}, + } + installed = { + "c/x-1": {}, + + "c/y-2": {}, + + "c/z-4": {}, + "c/z-5": {}, + "c/z-6": {}, + + "c/zz-4": {}, + "c/zz-5": {}, + "c/zz-6": {}, + } + test_cases = ( + + # cp = category/package + # cpv = category/package-version + + # Single cpv atom, representing the only available instance of the cp. + # The pkgmap should contain exactly that cpv and no omitted packages. + _TestData(["c/x-1"], [ (["c/x-1"],[]) ]), + + # Single cp atom. The pkgmap should contain the only available cpv to + # which the cp expands, no omitted packages. + _TestData(["c/x"], [ (["c/x-1"],[]) ]), + + # Duplicate cpv atom, representing the only available instance of the cp. + # The pkgmap should contain the cpv with no omitted packages, and an empty + # entry representing the duplicate. + _TestData(["c/x-1", "c/x-1"], [ (["c/x-1"],[]), ([],[]) ]), + + # Duplicate cp atom, representing the only available instance. The pkgmap + # should contain the only available cpv to which the cp expands, with no + # omitted packages, and a second empty entry representing the duplicate. + _TestData(["c/x", "c/x"], [ (["c/x-1"],[]), ([],[]) ]), + + # Single cpv atom, representing one of the two available instances. The + # pkgmap should contain exactly that cpv. Since the other instance is not + # installed, there should be no omitted packages. + _TestData(["c/y-2"], [ (["c/y-2"],[]) ]), + + # Single cp atom. The pkgmap should contain exactly the only installed + # instance and no omitted packages. + _TestData(["c/y"], [ (["c/y-2"],[]) ]), + + # Single cpv atom, representing one of the three available instances. + # The pkgmap should contain exactly the cpv. Since all three instances +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/binpkg_multi_instance/
commit: e8c526fbb278890512f75558f3e5424af66863ec Author: Zac Medico gentoo org> AuthorDate: Sun Mar 28 09:56:52 2021 + Commit: Zac Medico gentoo org> CommitDate: Sun Mar 28 09:58:09 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e8c526fb BuildIdProfileFormatTestCase: add package.unmask Signed-off-by: Zac Medico gentoo.org> .../tests/resolver/binpkg_multi_instance/test_build_id_profile_format.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/portage/tests/resolver/binpkg_multi_instance/test_build_id_profile_format.py b/lib/portage/tests/resolver/binpkg_multi_instance/test_build_id_profile_format.py index 97a54bd24..f9b1abb35 100644 --- a/lib/portage/tests/resolver/binpkg_multi_instance/test_build_id_profile_format.py +++ b/lib/portage/tests/resolver/binpkg_multi_instance/test_build_id_profile_format.py @@ -13,6 +13,7 @@ class BuildIdProfileFormatTestCase(TestCase): "packages": ("=app-misc/A-1-2::test_repo",), "package.mask": ("=app-misc/A-1::test_repo",), "package.use": ("app-misc/A-1::test_repo foo",), "package.use.mask": ("app-misc/A-1::test_repo -foo",), "package.use.stable.mask": ("app-misc/A-1::test_repo -foo",),
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: a86016cb736f0da83fa88031d66192f28edd3c96 Author: Zac Medico gentoo org> AuthorDate: Sun Mar 28 06:12:13 2021 + Commit: Zac Medico gentoo org> CommitDate: Sun Mar 28 06:20:20 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a86016cb ResolverPlayground: enable package.use.{force,mask} Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/ResolverPlayground.py | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 89feea47a..4575156f2 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -1,4 +1,4 @@ -# Copyright 2010-2020 Gentoo Authors +# Copyright 2010-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import bz2 @@ -44,7 +44,13 @@ class ResolverPlayground: config_files = frozenset(("eapi", "layout.conf", "make.conf", "modules", "package.accept_keywords", "package.keywords", "package.license", "package.mask", "package.properties", "package.provided", "packages", - "package.unmask", "package.use", "package.use.aliases", "package.use.stable.mask", + "package.unmask", + "package.use", + "package.use.aliases", + "package.use.force", + "package.use.mask", + "package.use.stable.force", + "package.use.stable.mask", "soname.provided", "unpack_dependencies", "use.aliases", "use.force", "use.mask", "layout.conf"))
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: a607bed25cb7d9cad7ef9533879b5ab93c94277c Author: Zac Medico gentoo org> AuthorDate: Sat Mar 6 09:51:33 2021 + Commit: Zac Medico gentoo org> CommitDate: Sat Mar 6 09:52:52 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a607bed2 Remove unit tests for deprecated EAPI-progress Fixes: 67cf9c2b0504 ("Mark EAPIs 4-python and 5-progress as deprecated") Signed-off-by: Zac Medico gentoo.org> .../tests/resolver/test_unpack_dependencies.py | 65 -- lib/portage/tests/resolver/test_use_aliases.py | 131 - 2 files changed, 196 deletions(-) diff --git a/lib/portage/tests/resolver/test_unpack_dependencies.py b/lib/portage/tests/resolver/test_unpack_dependencies.py deleted file mode 100644 index cfceff4b1..0 --- a/lib/portage/tests/resolver/test_unpack_dependencies.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright 2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -from portage.tests import TestCase -from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase - -class UnpackDependenciesTestCase(TestCase): - def testUnpackDependencies(self): - distfiles = { - "A-1.tar.gz": b"binary\0content", - "B-1.TAR.XZ": b"binary\0content", - "B-docs-1.tar.bz2": b"binary\0content", - "C-1.TAR.XZ": b"binary\0content", - "C-docs-1.tar.bz2": b"binary\0content", - } - - ebuilds = { - "dev-libs/A-1": {"SRC_URI": "A-1.tar.gz", "EAPI": "5-progress"}, - "dev-libs/B-1": {"IUSE": "doc", "SRC_URI": "B-1.TAR.XZ doc? ( B-docs-1.tar.bz2 )", "EAPI": "5-progress"}, - "dev-libs/C-1": {"IUSE": "doc", "SRC_URI": "C-1.TAR.XZ doc? ( C-docs-1.tar.bz2 )", "EAPI": "5-progress"}, - "app-arch/bzip2-1": {}, - "app-arch/gzip-1": {}, - "app-arch/tar-1": {}, - "app-arch/xz-utils-1": {}, - } - - repo_configs = { - "test_repo": { - "unpack_dependencies/5-progress": ( - "tar.bz2 app-arch/tar app-arch/bzip2", - "tar.gz app-arch/tar app-arch/gzip", - "tar.xz app-arch/tar app-arch/xz-utils", - ), - }, - } - - test_cases = ( - ResolverPlaygroundTestCase( - ["dev-libs/A"], - success = True, - ignore_mergelist_order = True, - mergelist = ["app-arch/tar-1", "app-arch/gzip-1", "dev-libs/A-1"]), - ResolverPlaygroundTestCase( - ["dev-libs/B"], - success = True, - ignore_mergelist_order = True, - mergelist = ["app-arch/tar-1", "app-arch/xz-utils-1", "dev-libs/B-1"]), - ResolverPlaygroundTestCase( - ["dev-libs/C"], - success = True, - ignore_mergelist_order = True, - mergelist = ["app-arch/tar-1", "app-arch/xz-utils-1", "app-arch/bzip2-1", "dev-libs/C-1"]), - ) - - user_config = { - "package.use": ("dev-libs/C doc",) - } - - playground = ResolverPlayground(distfiles=distfiles, ebuilds=ebuilds, repo_configs=repo_configs, user_config=user_config) - try: - for test_case in test_cases: - playground.run_TestCase(test_case) - self.assertEqual(test_case.test_success, True, test_case.fail_msg) - finally: - playground.cleanup() diff --git a/lib/portage/tests/resolver/test_use_aliases.py b/lib/portage/tests/resolver/test_use_aliases.py deleted file mode 100644 index 7c2debbb1..0 --- a/lib/portage/tests/resolver/test_use_aliases.py +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright 2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -from portage.tests import TestCase -from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase - -class UseAliasesTestCase(TestCase): - def testUseAliases(self): - ebuilds = { - "dev-libs/A-1": {"DEPEND": "dev-libs/K[x]", "RDEPEND": "dev-libs/K[x]", "EAPI": "5"}, - "dev-libs/B-1": {"DEPEND": "dev-libs/L[x]",
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 2c322a4274fafcc04423baecd6880737e1639168 Author: Zac Medico gentoo org> AuthorDate: Mon Mar 1 07:58:33 2021 + Commit: Zac Medico gentoo org> CommitDate: Mon Mar 1 08:55:18 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2c322a42 Include --autounmask-backtrack in unit test for bug 773469 The --autounmask-backtrack option is needed in order to trigger the --binpkg-respect-use=y behavior that appears confusingly similar to --binpkg-respect-use=n behavior. Bug: https://bugs.gentoo.org/773469 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_useflags.py | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/portage/tests/resolver/test_useflags.py b/lib/portage/tests/resolver/test_useflags.py index 7439dc306..d66da0866 100644 --- a/lib/portage/tests/resolver/test_useflags.py +++ b/lib/portage/tests/resolver/test_useflags.py @@ -46,13 +46,15 @@ class UseFlagsTestCase(TestCase): success = True, mergelist = ["dev-libs/A-1"]), - # Bug 773469 - Demonstrate --autounmask-use interference with --binpkg-respect-use=y + # In the unit test case for bug 773469, the --autounmask-backtrack option + # is needed in order to trigger the --binpkg-respect-use=y behavior that + # appears confusingly similar to --binpkg-respect-use=n behavior. ResolverPlaygroundTestCase( ["dev-libs/C", "dev-libs/D"], - options={"--usepkg": True, "--binpkg-respect-use": "y"}, - success=False, + options={"--usepkg": True, "--binpkg-respect-use": "y", "--autounmask-backtrack": "y"}, + success=True, use_changes={"dev-libs/C-1": {"abi_x86_32": True}}, - mergelist=["dev-libs/C-1", "[binary]dev-libs/D-1"], + mergelist=["[binary]dev-libs/C-1", "[binary]dev-libs/D-1"], ), #--binpkg-respect-use=n: use binpkgs with different use flags
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 7a683809e4f7f61590a770df7f79cfa633a18d8e Author: Zac Medico gentoo org> AuthorDate: Mon Mar 1 06:36:29 2021 + Commit: Zac Medico gentoo org> CommitDate: Mon Mar 1 06:40:26 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7a683809 Add unit test demonstrating --autounmask-use / --binpkg-respect-use=y conflict Bug: https://bugs.gentoo.org/773469 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_useflags.py | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/portage/tests/resolver/test_useflags.py b/lib/portage/tests/resolver/test_useflags.py index 0a5f3b3ff..7439dc306 100644 --- a/lib/portage/tests/resolver/test_useflags.py +++ b/lib/portage/tests/resolver/test_useflags.py @@ -10,17 +10,24 @@ class UseFlagsTestCase(TestCase): ebuilds = { "dev-libs/A-1": { "IUSE": "X", }, "dev-libs/B-1": { "IUSE": "X Y", }, + "dev-libs/C-1": { "IUSE": "abi_x86_32", "EAPI": "7" }, + "dev-libs/D-1": { "IUSE": "abi_x86_32", "EAPI": "7", "RDEPEND": "dev-libs/C[abi_x86_32?]" }, } installed = { "dev-libs/A-1": { "IUSE": "X", }, "dev-libs/B-1": { "IUSE": "X", }, + "dev-libs/C-1": { "IUSE": "abi_x86_32", "USE": "abi_x86_32", "EAPI": "7" }, + "dev-libs/D-1": { "IUSE": "abi_x86_32", "USE": "abi_x86_32", "EAPI": "7", "RDEPEND": "dev-libs/C[abi_x86_32]" }, } binpkgs = installed user_config = { - "package.use": ( "dev-libs/A X", ), + "package.use": ( + "dev-libs/A X", + "dev-libs/D abi_x86_32", + ), "use.force": ( "Y", ), } @@ -39,6 +46,15 @@ class UseFlagsTestCase(TestCase): success = True, mergelist = ["dev-libs/A-1"]), + # Bug 773469 - Demonstrate --autounmask-use interference with --binpkg-respect-use=y + ResolverPlaygroundTestCase( + ["dev-libs/C", "dev-libs/D"], + options={"--usepkg": True, "--binpkg-respect-use": "y"}, + success=False, + use_changes={"dev-libs/C-1": {"abi_x86_32": True}}, + mergelist=["dev-libs/C-1", "[binary]dev-libs/D-1"], + ), + #--binpkg-respect-use=n: use binpkgs with different use flags ResolverPlaygroundTestCase( ["dev-libs/A"],
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: f5a58b3f2e2adc7f9d2794d4e91d44ec1419b56a Author: Zac Medico gentoo org> AuthorDate: Tue Feb 23 22:14:30 2021 + Commit: Zac Medico gentoo org> CommitDate: Tue Feb 23 22:37:34 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f5a58b3f Add USE conflict unit test for bug 615824 Test bug 615824, where an automask USE change results in a conflict which is not reported. In order to install L, foo must be disabled for both K and M, but autounmask disables foo for K and leaves it enabled for M: [ebuild N ] sci-libs/K-1 USE="-foo" [ebuild N ] sci-libs/L-1 [ebuild N ] sci-libs/M-1 USE="foo" The following USE changes are necessary to proceed: (see "package.use" in the portage(5) man page for more details) # required by sci-libs/L-1::test_repo # required by sci-libs/L (argument) >=sci-libs/K-1 -foo Bug: https://bugs.gentoo.org/615824 Signed-off-by: Zac Medico gentoo.org> .../resolver/test_autounmask_use_slot_conflict.py | 51 ++ 1 file changed, 51 insertions(+) diff --git a/lib/portage/tests/resolver/test_autounmask_use_slot_conflict.py b/lib/portage/tests/resolver/test_autounmask_use_slot_conflict.py new file mode 100644 index 0..2e090d45e --- /dev/null +++ b/lib/portage/tests/resolver/test_autounmask_use_slot_conflict.py @@ -0,0 +1,51 @@ +# Copyright 2017-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( + ResolverPlayground, + ResolverPlaygroundTestCase, +) + + +class AutounmaskUseSlotConflictTestCase(TestCase): + def testAutounmaskUseSlotConflict(self): + self.todo = True + + ebuilds = { + "sci-libs/K-1": {"IUSE": "+foo", "EAPI": 1}, + "sci-libs/L-1": {"DEPEND": "sci-libs/K[-foo]", "EAPI": 2}, + "sci-libs/M-1": {"DEPEND": "sci-libs/K[foo=]", "IUSE": "+foo", "EAPI": 2}, + } + + installed = {} + + test_cases = ( + # Test bug 615824, where an automask USE change results in + # a conflict which is not reported. In order to install L, + # foo must be disabled for both K and M, but autounmask + # disables foo for K and leaves it enabled for M. + ResolverPlaygroundTestCase( + ["sci-libs/L", "sci-libs/M"], + options={"--backtrack": 0}, + success=False, + mergelist=[ + "sci-libs/L-1", + "sci-libs/M-1", + "sci-libs/K-1", + ], + ignore_mergelist_order=True, + slot_collision_solutions=[ + {"sci-libs/K-1": {"foo": False}, "sci-libs/M-1": {"foo": False}} + ], + ), + ) + + playground = ResolverPlayground(ebuilds=ebuilds, installed=installed) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.debug = False + playground.cleanup()
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: 4c25c0d7af7ad71fccbfafe1e5019116c691968e Author: Zac Medico gentoo org> AuthorDate: Mon Jan 11 00:19:06 2021 + Commit: Zac Medico gentoo org> CommitDate: Mon Jan 11 03:32:45 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4c25c0d7 check_reverse_dependencies: dereference virtual expansions (bug 764764) If an atom is the result of virtual expansion, then derefrence it to _orig_atom in check_reverse_dependencies so that it will be correctly handled as a built slot operator dependency when appropriate. This solves a case triggered in bug 764764 where a virtual expansion from virtual/dist-kernel:0/5.10.5= to =virtual/dist-kernel-5.10.5 prevented the atom from being handled as a built slot operator dependency, which prevented rebuilds from being triggered. Bug: https://bugs.gentoo.org/764764 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py| 22 ++ .../resolver/test_slot_operator_reverse_deps.py| 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index f3e834a60..2bf04406f 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -2073,6 +2073,12 @@ class depgraph: for parent, atom in self._dynamic_config._parent_atoms.get(existing_pkg, []): if isinstance(parent, Package): if parent in built_slot_operator_parents: + if hasattr(atom, '_orig_atom'): + # If atom is the result of virtual expansion, then + # derefrence it to _orig_atom so that it will be correctly + # handled as a built slot operator dependency when + # appropriate (see bug 764764). + atom = atom._orig_atom # This parent may need to be rebuilt, therefore # discard its soname and built slot operator # dependency components which are not necessarily @@ -2131,6 +2137,22 @@ class depgraph: allow_repo=True) if not atom_set.findAtomForPackage(candidate_pkg, modified_use=self._pkg_use_enabled(candidate_pkg)): + if debug: + parent_atoms = [] + for other_parent, other_atom in self._dynamic_config._parent_atoms.get(existing_pkg, []): + if other_parent is parent: + parent_atoms.append(other_atom) + msg = ( + "", + "", + "check_reverse_dependencies:", + " candidate package does not match atom '%s': %s" % (atom, candidate_pkg), + " parent: %s" % parent, + " parent atoms: %s" % " ".join(parent_atoms), + "", + ) + writemsg_level("\n".join(msg), + noiselevel=-1, level=logging.DEBUG) return False return True diff --git a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py index 6e7214043..ef884f8ca 100644 --- a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py +++ b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py @@ -284,7 +284,7 @@ class SlotOperatorReverseDepsVirtualTestCase(TestCase): ["@world"], options = {"--update": True, "--deep": True}, success = True, - mergelist = [] + mergelist = ['sys-kernel/gentoo-kernel-5.10.6', 'virtual/dist-kernel-5.10.6', 'app-emulation/virtualbox-modules-6.1.16-r1', 'x11-drivers/nvidia-drivers-460.32.03'] ), )
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 9b6417f527aa98742a51d7859051342b6fb1383f Author: Zac Medico gentoo org> AuthorDate: Mon Jan 11 01:57:44 2021 + Commit: Zac Medico gentoo org> CommitDate: Mon Jan 11 03:04:28 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9b6417f5 Add unit test demonstrating bug 764764 Bug: https://bugs.gentoo.org/764764 Signed-off-by: Zac Medico gentoo.org> .../resolver/test_slot_operator_reverse_deps.py| 98 +- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py index 6641e9987..6e7214043 100644 --- a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py +++ b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py @@ -1,4 +1,4 @@ -# Copyright 2016-2020 Gentoo Authors +# Copyright 2016-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -202,3 +202,99 @@ class SlotOperatorReverseDepsLibGit2TestCase(TestCase): finally: playground.debug = False playground.cleanup() + + +class SlotOperatorReverseDepsVirtualTestCase(TestCase): + + def testSlotOperatorReverseDepsVirtual(self): + """ + Demonstrate bug #764764, where slot operator rebuilds were + not triggered for reverse deps of virtual/dist-kernel. + """ + + ebuilds = { + + "app-emulation/virtualbox-modules-6.1.16-r1": { + "EAPI": "7", + "DEPEND": "virtual/dist-kernel", + "RDEPEND": "virtual/dist-kernel:=", + }, + + "sys-kernel/gentoo-kernel-5.10.6": { + "EAPI": "7", + "SLOT": "5.10.6", + }, + + "sys-kernel/gentoo-kernel-5.10.5": { + "EAPI": "7", + "SLOT": "5.10.5", + }, + + "virtual/dist-kernel-5.10.5" : { + "EAPI": "7", + "SLOT": "0/5.10.5", + "RDEPEND": "~sys-kernel/gentoo-kernel-5.10.5", + }, + + "virtual/dist-kernel-5.10.6" : { + "EAPI": "7", + "SLOT": "0/5.10.6", + "RDEPEND": "~sys-kernel/gentoo-kernel-5.10.6" + }, + + "x11-drivers/nvidia-drivers-460.32.03" : { + "EAPI": "7", + "DEPEND": "virtual/dist-kernel", + "RDEPEND": "virtual/dist-kernel:=", + }, + + } + + installed = { + + "app-emulation/virtualbox-modules-6.1.16-r1": { + "EAPI": "7", + "DEPEND": "virtual/dist-kernel", + "RDEPEND": "virtual/dist-kernel:0/5.10.5=", + }, + + "sys-kernel/gentoo-kernel-5.10.5": { + "EAPI": "7", + "SLOT": "5.10.5", + }, + + "virtual/dist-kernel-5.10.5" : { + "EAPI": "7", + "SLOT": "0/5.10.5", + "RDEPEND": "~sys-kernel/gentoo-kernel-5.10.5" + }, + + "x11-drivers/nvidia-drivers-460.32.03" : { + "EAPI": "7", + "DEPEND": "virtual/dist-kernel", + "RDEPEND": "virtual/dist-kernel:0/5.10.5=" + }, + + } + + world = ["app-emulation/virtualbox-modules", "x11-drivers/nvidia-drivers"] + + test_cases = ( + ResolverPlaygroundTestCase( + ["@world"], + options = {"--update": True, "--deep": True}, + success = True, + mergelist = [] + ), + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, world=world, debug=False) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, + test_case.fail_msg) + finally: +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: c1671591dc2b46038c871f9038ff4cb46dccc160 Author: Zac Medico gentoo org> AuthorDate: Wed Dec 2 17:28:45 2020 + Commit: Zac Medico gentoo org> CommitDate: Wed Dec 2 17:32:36 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c1671591 MergeOrderTestCase: fix x11-drivers/xf86-video-fbdev slot operator deps The real ebuild has the x11-base/xorg-server:= dependency in RDEPEND rather than DEPEND. Fixes: 07a604537e74 ("find_smallest_cycle: don't merge satisfied PDEPEND too early") Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_merge_order.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/portage/tests/resolver/test_merge_order.py b/lib/portage/tests/resolver/test_merge_order.py index 0510a0636..db063ed9d 100644 --- a/lib/portage/tests/resolver/test_merge_order.py +++ b/lib/portage/tests/resolver/test_merge_order.py @@ -231,8 +231,8 @@ class MergeOrderTestCase(TestCase): }, "x11-drivers/xf86-video-fbdev-0.5.0-r1": { "EAPI": "7", - "DEPEND": "x11-base/xorg-server:=", - "RDEPEND": "x11-base/xorg-server", + "DEPEND": "x11-base/xorg-server", + "RDEPEND": "x11-base/xorg-server:=", } } @@ -325,8 +325,8 @@ class MergeOrderTestCase(TestCase): }, "x11-drivers/xf86-video-fbdev-0.5.0-r1": { "EAPI": "7", - "DEPEND": "x11-base/xorg-server:0/1.14.1=", - "RDEPEND": "x11-base/xorg-server", + "DEPEND": "x11-base/xorg-server", + "RDEPEND": "x11-base/xorg-server:0/1.14.1=", } }
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: 07a604537e746814613dc171a5c09072ef0266af Author: Zac Medico gentoo org> AuthorDate: Wed Dec 2 07:08:04 2020 + Commit: Zac Medico gentoo org> CommitDate: Wed Dec 2 08:06:27 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=07a60453 find_smallest_cycle: don't merge satisfied PDEPEND too early After PDEPENDs have been neglected by the find_smallest_cycle function, do not try to merge them too early if they are already satisfied by an installed package. This fixes incorrect merge order for PDEPEND cycles involving xorg-server and xorg-drivers, which was triggered by commit 5095c2023595a75e2848f1ad3dbe25b5fb451a44 because it gave PDEPEND higher priority than satisfied buildtime dependencies. Fixes: 5095c2023595 ("find_smallest_cycle: enhance search prioritization") Reported-by: josef64 in #gentoo-portage Bug: https://bugs.gentoo.org/754903 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/DepPrioritySatisfiedRange.py | 1 + lib/_emerge/depgraph.py| 8 lib/portage/tests/resolver/test_merge_order.py | 27 -- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/_emerge/DepPrioritySatisfiedRange.py b/lib/_emerge/DepPrioritySatisfiedRange.py index fb0d7db4e..f546590e0 100644 --- a/lib/_emerge/DepPrioritySatisfiedRange.py +++ b/lib/_emerge/DepPrioritySatisfiedRange.py @@ -93,6 +93,7 @@ class DepPrioritySatisfiedRange: ignore_medium = _ignore_runtime ignore_medium_soft = _ignore_satisfied_buildtime_slot_op ignore_medium_post = _ignore_runtime_post + ignore_medium_post_satisifed = _ignore_satisfied_runtime_post ignore_soft= _ignore_optional diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 1271bda3e..0450291d4 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -8052,18 +8052,18 @@ class depgraph: (selected_nodes[0],), noiselevel=-1) if selected_nodes and ignore_priority is not None: - # Try to merge ignored medium_post deps as soon as possible + # Try to merge neglected medium_post deps as soon as possible # if they're not satisfied by installed packages. for node in selected_nodes: children = set(mygraph.child_nodes(node)) - soft = children.difference( + medium_post_satisifed = children.difference( mygraph.child_nodes(node, ignore_priority = \ - DepPrioritySatisfiedRange.ignore_soft)) + DepPrioritySatisfiedRange.ignore_medium_post_satisifed)) medium_post = children.difference( mygraph.child_nodes(node, ignore_priority=DepPrioritySatisfiedRange.ignore_medium_post)) - medium_post -= soft + medium_post -= medium_post_satisifed for child in medium_post: if child in selected_nodes: continue diff --git a/lib/portage/tests/resolver/test_merge_order.py b/lib/portage/tests/resolver/test_merge_order.py index f81fd2f6f..0510a0636 100644 --- a/lib/portage/tests/resolver/test_merge_order.py +++ b/lib/portage/tests/resolver/test_merge_order.py @@ -217,12 +217,23 @@ class MergeOrderTestCase(TestCase): "IUSE" : "X +encode", "RDEPEND" : "|| ( >=media-video/ffmpeg-0.6.90_rc0-r2[X=,encode=] >=media-video/libav-0.6.90_rc[X=,encode=] )", }, + "x11-base/xorg-drivers-1.20-r2": { + "EAPI": "7", + "IUSE": "+video_cards_fbdev", + "PDEPEND": "x11-base/xorg-server video_cards_fbdev? ( x11-drivers/xf86-video-fbdev )", + }, "x11-base/xorg-server-1.14.1" : { "EAPI" : "5", "SLOT": "0/1.14.1", "DEPEND" : "media-libs/mesa", "RDEPEND" : "media-libs/mesa", + "PDEPEND": "x11-base/xorg-drivers", }, + "x11-drivers/xf86-video-fbdev-0.5.0-r1": { +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/, lib/portage/dep/
commit: b991f23ad915d1fc37088f11ca855c8c8374f5ae Author: Zac Medico gentoo org> AuthorDate: Sat Nov 28 01:57:14 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Nov 28 20:50:13 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b991f23a Allow a package to replace its own buildtime dependency If a package has a buildtime dependency on a previous version that it will replace, then do not treat it as a slot conflict. This solves inappropriate behavior for dev-lang/rust[system-bootstrap]. This requires adjustments to package selection logic in several locations, in order to ensure that an installed package instance will be selected to satisfy a buildtime dependency when appropriate. Dependencies of the installed package will be entirely ignored, but that has already been the case when using installed package to break cycles, as discussed in bug 199856. Bug: https://bugs.gentoo.org/756793 Bug: https://bugs.gentoo.org/756961 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py| 68 +--- lib/portage/dep/dep_check.py | 24 +++--- .../tests/resolver/test_circular_choices_rust.py | 94 ++ 3 files changed, 164 insertions(+), 22 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index d10474ab3..1271bda3e 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -85,6 +85,8 @@ from _emerge.resolver.output import Display, format_unmatched_atom # Exposes a depgraph interface to dep_check. _dep_check_graph_interface = collections.namedtuple('_dep_check_graph_interface',( + # Checks if parent package will replace child. + 'will_replace_child', # Indicates a removal action, like depclean or prune. 'removal_action', # Checks if update is desirable for a given package. @@ -507,6 +509,7 @@ class _dynamic_depgraph_config: # Track missed updates caused by solved conflicts. self._conflict_missed_update = collections.defaultdict(dict) dep_check_iface = _dep_check_graph_interface( + will_replace_child=depgraph._will_replace_child, removal_action="remove" in myparams, want_update_pkg=depgraph._want_update_pkg, ) @@ -3104,6 +3107,22 @@ class depgraph: self._frozen_config.myopts, modified_use=self._pkg_use_enabled(pkg))), level=logging.DEBUG, noiselevel=-1) + elif (pkg.installed and myparent and + pkg.root == myparent.root and + pkg.slot_atom == myparent.slot_atom): + # If the parent package is replacing the child package then + # there's no slot conflict. Since the child will be replaced, + # do not add it to the graph. No attempt will be made to + # satisfy its dependencies, which is unsafe if it has any + # missing dependencies, as discussed in bug 199856. + if debug: + writemsg_level( + "%s%s %s\n" % ("Replace Child:".ljust(15), + pkg, pkg_use_display(pkg, + self._frozen_config.myopts, + modified_use=self._pkg_use_enabled(pkg))), + level=logging.DEBUG, noiselevel=-1) + return 1 else: if debug: @@ -5877,6 +5896,27 @@ class depgraph: (arg_atoms or update) and not self._too_deep(depth)) + def _will_replace_child(self, parent, root, atom): + """ + Check if a given parent package will replace a child package + for the given root and atom. + + @param parent: parent package + @type parent: Package + @param root: child root + @type root: str + @param atom: child atom + @type atom: Atom + @rtype: Package + @return: child package to replace, or None + """ + if parent.root != root or parent.cp != atom.cp: + return None + for child in
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: e9c0ef7609e8e2068af8c9c7138f1a2dc22fcfb0 Author: Zac Medico gentoo org> AuthorDate: Sun Nov 15 04:25:22 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun Nov 15 05:54:37 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e9c0ef76 Add slot operator := BDEPEND unit tests for bug 752153 Test these two distinct cases: 1) Regular dev-lang/go upgrade, with rebuild of packages that have dev-lang/go:= in BDEPEND. 2) Rebuild of packages that have dev-lang/go:= in BDEPEND, after the built slot operator deps have already been broken by an earlier dev-lang/go upgrade. Bug: https://bugs.gentoo.org/752153 Signed-off-by: Zac Medico gentoo.org> .../tests/resolver/test_slot_operator_bdeps.py | 209 + 1 file changed, 209 insertions(+) diff --git a/lib/portage/tests/resolver/test_slot_operator_bdeps.py b/lib/portage/tests/resolver/test_slot_operator_bdeps.py new file mode 100644 index 0..f5b1bce1b --- /dev/null +++ b/lib/portage/tests/resolver/test_slot_operator_bdeps.py @@ -0,0 +1,209 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import (ResolverPlayground, + ResolverPlaygroundTestCase) + +class SlotOperatorBdependTestCase(TestCase): + + def testSlotOperatorBdepend(self): + """ + Test regular dev-lang/go upgrade, with rebuild of packages + that have dev-lang/go:= in BDEPEND. + """ + + ebuilds = { + "app-emulation/buildah-1.16.1":{ + "EAPI": "7", + "BDEPEND": "dev-lang/go:=", + }, + + "app-emulation/libpod-2.1.0":{ + "EAPI": "7", + "BDEPEND": "dev-lang/go:=", + }, + + "dev-lang/go-1.15.5":{ + "EAPI": "7", + "SLOT": "0/1.15.5" + }, + + "dev-lang/go-1.14.12" : { + "EAPI": "7", + "SLOT": "0/1.14.12" + }, + } + + binpkgs = { + "app-emulation/buildah-1.16.1":{ + "EAPI": "7", + "BDEPEND": "dev-lang/go:0/1.14.12=", + }, + "app-emulation/libpod-2.1.0":{ + "EAPI": "7", + "BDEPEND": "dev-lang/go:0/1.14.12=", + }, + "dev-lang/go-1.14.12" : { + "EAPI": "7", + "SLOT": "0/1.14.12" + }, + } + + installed = { + "app-emulation/buildah-1.16.1":{ + "EAPI": "7", + "BDEPEND": "dev-lang/go:0/1.14.12=", + }, + "app-emulation/libpod-2.1.0":{ + "EAPI": "7", + "BDEPEND": "dev-lang/go:0/1.14.12=", + }, + "dev-lang/go-1.14.12" : { + "EAPI": "7", + "SLOT": "0/1.14.12" + }, + } + + world = ["app-emulation/buildah", "app-emulation/libpod"] + + test_cases = ( + + # Test rebuild triggered by slot operator := dependency in BDEPEND. + ResolverPlaygroundTestCase( + ["@world"], + options = { + "--update": True, + "--deep": True, + }, + success = True, + mergelist = ["dev-lang/go-1.15.5", "app-emulation/buildah-1.16.1", "app-emulation/libpod-2.1.0"] + ), + + # Test the above case with --usepkg --with-bdeps=y. It should not use the + # binary packages because rebuild is needed. + ResolverPlaygroundTestCase( + ["@world"], + options = { + "--usepkg": True, + "--with-bdeps": "y", + "--update": True, + "--deep": True, + }, + success = True, + mergelist = ["dev-lang/go-1.15.5",
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 302a93e5857ff56d43ee0b9dabee9f00d907a8ad Author: Zac Medico gentoo org> AuthorDate: Sun Sep 13 01:42:30 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Sep 19 20:22:41 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=302a93e5 Add unit test demonstrating excessive backtracking for bug 743115 Due to excessive backtracking, this test case currently needs at least --backtrack=21 to succeed. Bug: https://bugs.gentoo.org/743115 Signed-off-by: Zac Medico gentoo.org> .../resolver/test_slot_operator_missed_update.py | 112 + 1 file changed, 112 insertions(+) diff --git a/lib/portage/tests/resolver/test_slot_operator_missed_update.py b/lib/portage/tests/resolver/test_slot_operator_missed_update.py new file mode 100644 index 0..fce012f62 --- /dev/null +++ b/lib/portage/tests/resolver/test_slot_operator_missed_update.py @@ -0,0 +1,112 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( + ResolverPlayground, + ResolverPlaygroundTestCase, +) + + +class BacktrackMissedUpdateTestCase(TestCase): + def testBacktrackMissedUpdateTestCase(self): + + ebuilds = { + "dev-lang/python-2.7.18-r2": { + "EAPI": "7", + "SLOT": "2.7", + }, + "dev-python/pypy3-7.3.2_rc2_p37-r1": { + "EAPI": "7", + "SLOT": "0/pypy37-pp73", + }, + "dev-python/pypy3-7.3.1-r3": { + "EAPI": "7", + "SLOT": "0/pypy36-pp73", + }, + "dev-python/setuptools-50.3.0": { + "EAPI": "7", + "IUSE": "python_targets_pypy3", + "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )", + }, + "dev-python/setuptools-50.2.0": { + "EAPI": "7", + "IUSE": "python_targets_pypy3", + "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )", + }, + "dev-python/setuptools-50.1.0": { + "EAPI": "7", + "IUSE": "python_targets_pypy3", + "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )", + }, + "dev-python/setuptools-49.6.0": { + "EAPI": "7", + "IUSE": "python_targets_pypy3", + "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )", + }, + "dev-python/setuptools-46.4.0-r2": { + "EAPI": "7", + "IUSE": "+python_targets_pypy3 +python_targets_python2_7", + "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )", + }, + "dev-lang/python-2.7.18-r2": { + "EAPI": "7", + "IUSE": "+python_targets_pypy3 +python_targets_python2_7", + "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )", + }, + "dev-vcs/mercurial-5.5.1": { + "EAPI": "7", + "IUSE": "+python_targets_pypy3 +python_targets_python2_7", + "RDEPEND": "dev-python/setuptools[python_targets_pypy3?,python_targets_python2_7?] python_targets_python2_7? ( dev-lang/python:2.7 ) python_targets_pypy3? ( dev-python/pypy3:= )", + }, + } + + installed = { + "dev-lang/python-2.7.18-r2": { + "EAPI": "7", + "SLOT": "2.7", + }, + "dev-python/pypy3-7.3.1-r3": { + "EAPI": "7", + "SLOT": "0/pypy36-pp73", + }, + "dev-python/setuptools-46.4.0-r2": { + "EAPI": "7", + "IUSE": "+python_targets_pypy3 +python_targets_python2_7", + "USE": "python_targets_pypy3 python_targets_python2_7", + "RDEPEND": "dev-python/pypy3:0/pypy36-pp73=", + }, + "dev-vcs/mercurial-5.5.1": { + "EAPI": "7", +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: 67423a3606db72f45ffe4dec325253a30508bd9d Author: Zac Medico gentoo org> AuthorDate: Sun Aug 30 23:21:25 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun Aug 30 23:39:41 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=67423a36 dephgraph: Allow elimination of highest version after slot conflict (bug 439688) After a slot conflict occurs, allow the highest version to be eliminated from the graph when appropriate. This is needed for correct behavior in cases the highest version cannot be installed because an older version is required by some package. This reverts a change related to bug 531656 from commit a9064d08ef4c92a5d0d1bfb3dc8a01b7850812b0, and that change no longer appears to be necessary, since the unit tests related to bug 531656 now pass without it. Due to this change in slot conflict handling, the --changed-slot test case related to bug 456208 will now fail unless we use an @world update to trigger rebuilds, therefore fix it to do so. Bug: https://bugs.gentoo.org/439688 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py| 9 - lib/portage/tests/resolver/test_slot_change_without_revbump.py | 4 ++-- lib/portage/tests/resolver/test_slot_conflict_rebuild.py | 3 --- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index e071be8df..3f864aefc 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -1501,15 +1501,6 @@ class depgraph: matched = [] for pkg in conflict: - if (pkg is highest_pkg and - not highest_pkg.installed and - inst_pkg is not None and - inst_pkg.sub_slot != highest_pkg.sub_slot and - not self._downgrade_probe(highest_pkg)): - # If an upgrade is desired, force the highest - # version into the graph (bug #531656). - non_matching_forced.add(highest_pkg) - if atom.match(pkg.with_use( self._pkg_use_enabled(pkg))) and \ not (is_arg_parent and pkg.installed): diff --git a/lib/portage/tests/resolver/test_slot_change_without_revbump.py b/lib/portage/tests/resolver/test_slot_change_without_revbump.py index 5cd8c53d1..e05705671 100644 --- a/lib/portage/tests/resolver/test_slot_change_without_revbump.py +++ b/lib/portage/tests/resolver/test_slot_change_without_revbump.py @@ -71,8 +71,8 @@ class SlotChangeWithoutRevBumpTestCase(TestCase): # Test --changed-slot ResolverPlaygroundTestCase( - ["app-arch/libarchive"], - options = {"--changed-slot": True, "--usepkg": True}, + ["@world"], + options = {"--changed-slot": True, "--usepkg": True, "--update": True, "--deep": True}, success = True, mergelist = ["app-arch/libarchive-3.1.1", "kde-base/ark-4.10.0"]), diff --git a/lib/portage/tests/resolver/test_slot_conflict_rebuild.py b/lib/portage/tests/resolver/test_slot_conflict_rebuild.py index b3bcf44d0..d650d42ae 100644 --- a/lib/portage/tests/resolver/test_slot_conflict_rebuild.py +++ b/lib/portage/tests/resolver/test_slot_conflict_rebuild.py @@ -454,10 +454,7 @@ class SlotConflictRebuildTestCase(TestCase): finally: playground.cleanup() -class SlotConflictRebuildGolangTestCase(TestCase): - def testSlotConflictRebuildGolang(self): - self.todo = True ebuilds = {
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 8b9345976c95ff41c7f075f7917d498f77d7d155 Author: Zac Medico gentoo org> AuthorDate: Sun Aug 30 22:18:35 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun Aug 30 22:38:42 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8b934597 test_slot_conflict_rebuild: Add dev-lang/go case for bug 439688 Demonstrate this unwanted dev-lang/go rebuild triggered by a missed update due to a slot conflict: [ebuild R] dev-lang/go-1.14.7 WARNING: One or more updates/rebuilds have been skipped due to a dependency conflict: dev-lang/go:0 (dev-lang/go-1.15:0/1.15::test_repo, ebuild scheduled for merge) USE="" conflicts with =dev-lang/go-1.14* required by (net-p2p/syncthing-1.3.4-r1:0/0::test_repo, installed) USE="" ^^ Bug: https://bugs.gentoo.org/439688 Bug: https://bugs.gentoo.org/739648 Signed-off-by: Zac Medico gentoo.org> .../tests/resolver/test_slot_conflict_rebuild.py | 64 +- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/lib/portage/tests/resolver/test_slot_conflict_rebuild.py b/lib/portage/tests/resolver/test_slot_conflict_rebuild.py index 95b6396ba..b3bcf44d0 100644 --- a/lib/portage/tests/resolver/test_slot_conflict_rebuild.py +++ b/lib/portage/tests/resolver/test_slot_conflict_rebuild.py @@ -1,4 +1,4 @@ -# Copyright 2012-2014 Gentoo Foundation +# Copyright 2012-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -453,3 +453,65 @@ class SlotConflictRebuildTestCase(TestCase): self.assertEqual(test_case.test_success, True, test_case.fail_msg) finally: playground.cleanup() + +class SlotConflictRebuildGolangTestCase(TestCase): + + def testSlotConflictRebuildGolang(self): + self.todo = True + + ebuilds = { + + "dev-lang/go-1.14.7" : { + "EAPI": "7", + "SLOT": "0/1.14.7" + }, + + "dev-lang/go-1.15" : { + "EAPI": "7", + "SLOT": "0/1.15" + }, + + "net-p2p/syncthing-1.3.4-r1" : { + "EAPI": "7", + "BDEPEND": "=dev-lang/go-1.14* >=dev-lang/go-1.12" + }, + + } + + installed = { + + "dev-lang/go-1.14.7" : { + "EAPI": "7", + "SLOT": "0/1.14.7" + }, + + "net-p2p/syncthing-1.3.4-r1" : { + "EAPI": "7", + "BDEPEND": "=dev-lang/go-1.14* >=dev-lang/go-1.12" + }, + + } + + world = ["dev-lang/go", "net-p2p/syncthing"] + + test_cases = ( + + # Demonstrate an unwanted dev-lang/go rebuild triggered by a missed + # update due to a slot conflict (bug #439688). + ResolverPlaygroundTestCase( + ["@world"], + options = {"--update": True, "--deep": True}, + success = True, + mergelist = []), + + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, world=world, debug=False) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.debug = False + playground.cleanup()
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/portage/sync/, lib/portage/_sets/, lib/_emerge/, ...
commit: 897be5c2874ed3edda7b3af84e6ddb34c3095b71 Author: Aaron Bauman gentoo org> AuthorDate: Thu Aug 6 04:05:20 2020 + Commit: Zac Medico gentoo org> CommitDate: Thu Aug 6 06:06:07 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=897be5c2 lib/*: fix superfluous-parens and enable check Signed-off-by: Aaron Bauman gentoo.org> Signed-off-by: Zac Medico gentoo.org> lib/_emerge/actions.py | 14 +++--- lib/_emerge/resolver/slot_collision.py | 4 ++-- lib/_emerge/stdout_spinner.py| 2 +- lib/_emerge/unmerge.py | 4 ++-- lib/portage/_sets/dbapi.py | 6 +++--- lib/portage/cache/template.py| 2 +- lib/portage/dep/__init__.py | 10 +- lib/portage/dep/dep_check.py | 2 +- lib/portage/getbinpkg.py | 6 +++--- lib/portage/glsa.py | 2 +- lib/portage/localization.py | 2 +- lib/portage/locks.py | 2 +- lib/portage/manifest.py | 2 +- lib/portage/news.py | 4 ++-- lib/portage/package/ebuild/config.py | 2 +- lib/portage/process.py | 6 +++--- lib/portage/sync/controller.py | 4 ++-- lib/portage/sync/modules/rsync/rsync.py | 8 lib/portage/tests/resolver/ResolverPlayground.py | 2 +- lib/portage/util/__init__.py | 4 ++-- lib/portage/util/env_update.py | 2 +- lib/portage/xpak.py | 10 +- pylintrc | 1 + 23 files changed, 51 insertions(+), 50 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 43e9de43a..7d2d9b315 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -333,7 +333,7 @@ def action_build(emerge_config, trees=DeprecationWarning, return 1 else: - if ("--resume" in myopts): + if "--resume" in myopts: print(darkgreen("emerge: It seems we have nothing to resume...")) return os.EX_OK @@ -450,7 +450,7 @@ def action_build(emerge_config, trees=DeprecationWarning, myopts.pop("--ask", None) if ("--pretend" in myopts) and not ("--fetchonly" in myopts or "--fetch-all-uri" in myopts): - if ("--resume" in myopts): + if "--resume" in myopts: mymergelist = mydepgraph.altlist() if len(mymergelist) == 0: print(colorize("INFORM", "emerge: It seems we have nothing to resume...")) @@ -522,7 +522,7 @@ def action_build(emerge_config, trees=DeprecationWarning, level=logging.ERROR, noiselevel=-1) return 1 - if ("--resume" in myopts): + if "--resume" in myopts: favorites=mtimedb["resume"]["favorites"] else: @@ -2319,7 +2319,7 @@ def adjust_config(myopts, settings): settings.backup_changes("PORTAGE_VERBOSE") # Set so that configs will be merged regardless of remembered status - if ("--noconfmem" in myopts): + if "--noconfmem" in myopts: settings["NOCONFMEM"]="1" settings.backup_changes("NOCONFMEM") @@ -2424,7 +2424,7 @@ def getportageversion(portdir, _unused, profile, chost, vardb): if profilever is None: try: profilever = "!" + os.readlink(profile) - except (OSError): + except OSError: pass if profilever is None: @@ -3057,7 +3057,7 @@ def run_action(emerge_config): level=logging.ERROR, noiselevel=-1) return 1 - if ("--quiet" in emerge_config.opts): + if "--quiet" in emerge_config.opts: spinner.update = spinner.update_quiet portage.util.noiselimit = -1 @@ -3085,7 +3085,7 @@ def run_action(emerge_config): if "python-trace" in emerge_config.target_config.settings.features: portage.debug.set_trace(True) - if not ("--quiet" in emerge_config.opts): + if not "--quiet" in emerge_config.opts: if '--nospinner' in emerge_config.opts or \ emerge_config.target_config.settings.get('TERM') == 'dumb' or \ not sys.stdout.isatty(): diff --git a/lib/_emerge/resolver/slot_collision.py b/lib/_emerge/resolver/slot_collision.py index
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 2351a19ed4406e944eaaa28b1926f70ae2825150 Author: Aaron Bauman gentoo org> AuthorDate: Mon Aug 3 22:43:05 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Aug 3 23:28:00 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2351a19e lib/portage/tests/resolver/test_simple.py: fix whitespace Signed-off-by: Aaron Bauman gentoo.org> Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_simple.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/resolver/test_simple.py b/lib/portage/tests/resolver/test_simple.py index 324ffa2a6..b457b9d7a 100644 --- a/lib/portage/tests/resolver/test_simple.py +++ b/lib/portage/tests/resolver/test_simple.py @@ -1,4 +1,4 @@ -# Copyright 2010-2012 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -8,7 +8,7 @@ class SimpleResolverTestCase(TestCase): def testSimple(self): ebuilds = { - "dev-libs/A-1": { "KEYWORDS": "x86" }, + "dev-libs/A-1": { "KEYWORDS": "x86" }, "dev-libs/A-2": { "KEYWORDS": "~x86" }, "dev-libs/B-1.2": {},
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: a791a8a076690ef357939583de6478fe7dd1d3f6 Author: Aaron Bauman gentoo org> AuthorDate: Mon Aug 3 22:43:04 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Aug 3 23:28:00 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a791a8a0 lib/portage/tests/resolver/test_slot_collisions.py: fix whitespace Signed-off-by: Aaron Bauman gentoo.org> Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_slot_collisions.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/portage/tests/resolver/test_slot_collisions.py b/lib/portage/tests/resolver/test_slot_collisions.py index a15ebf4e0..d84ccfcef 100644 --- a/lib/portage/tests/resolver/test_slot_collisions.py +++ b/lib/portage/tests/resolver/test_slot_collisions.py @@ -1,4 +1,4 @@ -# Copyright 2010-2019 Gentoo Authors +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -9,7 +9,7 @@ class SlotCollisionTestCase(TestCase): def testSlotCollision(self): ebuilds = { - "dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo" }, + "dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo" }, "dev-libs/B-1": { "IUSE": "foo" }, "dev-libs/C-1": { "DEPEND": "dev-libs/A[foo]", "EAPI": 2 }, "dev-libs/D-1": { "DEPEND": "dev-libs/A[foo=] dev-libs/B[foo=]", "IUSE": "foo", "EAPI": 2 }, @@ -50,11 +50,11 @@ class SlotCollisionTestCase(TestCase): "dev-lang/perl-5.16": {"SLOT": "0/5.16", "EAPI": "5"}, } installed = { - "dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo", "USE": "foo" }, + "dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo", "USE": "foo" }, "dev-libs/B-1": { "IUSE": "foo", "USE": "foo" }, "dev-libs/C-1": { "DEPEND": "dev-libs/A[foo]", "EAPI": 2 }, "dev-libs/D-1": { "DEPEND": "dev-libs/A[foo=] dev-libs/B[foo=]", "IUSE": "foo", "USE": "foo", "EAPI": 2 }, - + "sci-libs/K-1": { "IUSE": "foo", "USE": "" }, "sci-libs/L-1": { "DEPEND": "sci-libs/K[-foo]" },
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: e0ca1855bc60925f56f625737afe117317b3278c Author: Aaron Bauman gentoo org> AuthorDate: Mon Aug 3 22:43:21 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Aug 3 23:28:04 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e0ca1855 lib/portage/tests/resolver/test_old_dep_chain_display.py: fix whitespace Signed-off-by: Aaron Bauman gentoo.org> Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_old_dep_chain_display.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/tests/resolver/test_old_dep_chain_display.py b/lib/portage/tests/resolver/test_old_dep_chain_display.py index 8aedf5999..7ab21e8e9 100644 --- a/lib/portage/tests/resolver/test_old_dep_chain_display.py +++ b/lib/portage/tests/resolver/test_old_dep_chain_display.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -8,8 +8,8 @@ class OldDepChainDisplayTestCase(TestCase): def testOldDepChainDisplay(self): ebuilds = { - "dev-libs/A-1": { "DEPEND": "foo? ( dev-libs/B[-bar] )", "IUSE": "+foo", "EAPI": "2" }, - "dev-libs/A-2": { "DEPEND": "foo? ( dev-libs/C )", "IUSE": "+foo", "EAPI": "1" }, + "dev-libs/A-1": { "DEPEND": "foo? ( dev-libs/B[-bar] )", "IUSE": "+foo", "EAPI": "2" }, + "dev-libs/A-2": { "DEPEND": "foo? ( dev-libs/C )", "IUSE": "+foo", "EAPI": "1" }, "dev-libs/B-1": { "IUSE": "bar", "DEPEND": "!bar? ( dev-libs/D[-baz] )", "EAPI": "2" }, "dev-libs/C-1": { "KEYWORDS": "~x86" }, "dev-libs/D-1": { "IUSE": "+baz", "EAPI": "1" },
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 649727ede1079a700bf296061287298d28cc1f37 Author: Aaron Bauman gentoo org> AuthorDate: Mon Aug 3 20:20:29 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Aug 3 21:25:53 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=649727ed lib/portage/tests/resolver/ResolverPlayground.py: drop unused-import * Drop unused-import * Slight refactor on imports Signed-off-by: Aaron Bauman gentoo.org> Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/ResolverPlayground.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index b15cc7f36..1e382002a 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -2,14 +2,14 @@ # Distributed under the terms of the GNU General Public License v2 import bz2 -from itertools import permutations import fnmatch import tempfile import portage + +from itertools import permutations from portage import os from portage import shutil -from portage.const import (GLOBAL_CONFIG_PATH, PORTAGE_BASE_PATH, - USER_CONFIG_PATH) +from portage.const import (GLOBAL_CONFIG_PATH, USER_CONFIG_PATH) from portage.process import find_binary from portage.dep import Atom, _repo_separator from portage.package.ebuild.config import config
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 7cee10a961965b02db75833ac01bac7b2866756f Author: Aaron Bauman gentoo org> AuthorDate: Mon Aug 3 19:05:44 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Aug 3 19:21:27 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7cee10a9 lib/portage/tests/resolver/test_merge_order.py: fix unused-import Signed-off-by: Aaron Bauman gentoo.org> Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_merge_order.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/portage/tests/resolver/test_merge_order.py b/lib/portage/tests/resolver/test_merge_order.py index 11752d71e..0003cd7d8 100644 --- a/lib/portage/tests/resolver/test_merge_order.py +++ b/lib/portage/tests/resolver/test_merge_order.py @@ -1,7 +1,6 @@ -# Copyright 2011-2019 Gentoo Authors +# Copyright 2011-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -import portage from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import (ResolverPlayground, ResolverPlaygroundTestCase)
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/resolver/, ...
tage/tests/util/futures/asyncio/test_pipe_closed.py lib/portage/tests/util/futures/asyncio/test_subprocess_exec.py lib/portage/tests/util/futures/test_retry.py lib/portage/tests/util/test_socks5.py lib/portage/util/_async/PipeLogger.py lib/portage/util/_compare_files.py lib/portage/util/_desktop_entry.py lib/portage/util/_dyn_libs/LinkageMapELF.py lib/portage/util/_dyn_libs/NeededEntry.py lib/portage/util/_dyn_libs/PreservedLibsRegistry.py lib/portage/util/_eventloop/EventLoop.py lib/portage/util/_eventloop/global_event_loop.py lib/portage/util/_urlopen.py lib/portage/util/compression_probe.py lib/portage/util/configparser.py lib/portage/util/digraph.py lib/portage/util/env_update.py lib/portage/util/install_mask.py lib/portage/util/listdir.py lib/portage/util/movefile.py lib/portage/util/mtimedb.py lib/portage/util/whirlpool.py lib/portage/versions.py lib/portage/xml/metadata.py lib/portage/xpak.py X-VCS-Directories: lib/portage/util/_eventloop/ lib/portage/tests/unicode/ lib/portage/tests/ebuild/ lib/portage/ lib/portage/dep/soname/ lib/portage/tests/process/ lib/portage/proxy/ lib/portage/tests/lint/ lib/portage/util/ lib/portage/sync/modules/rsync/ lib/portage/tests/util/futures/asyncio/ lib/portage/tests/util/ lib/portage/cache/ lib/portage/tests/util/futures/ lib/portage/elog/ lib/portage/package/ebuild/ lib/portage/dbapi/ lib/portage/emaint/modules/binhost/ lib/portage/tests/dep/ lib/portage/cache/index/ lib/portage/tests/sync/ lib/portage/emaint/modules/sync/ lib/portage/tests/resolver/ lib/_emerge/resolver/ lib/portage/_sets/ lib/portage/_emirrordist/ lib/portage/repository/ lib/portage/xml/ lib/portage/sync/ lib/_emerge/ lib/portage/util/_async/ lib/portage/util/_dyn_libs/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: be20b37180f709ab0e451e4e07b6e82ac3a87b56 X-VCS-Branch: master Date: Thu, 23 Jul 2020 02:59:58 + (UTC) commit: be20b37180f709ab0e451e4e07b6e82ac3a87b56 Author: Alec Warner gentoo org> AuthorDate: Thu Jul 23 00:34:59 2020 + Commit: Zac Medico gentoo org> CommitDate: Thu Jul 23 02:59:00 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=be20b371 Fix 'unused-import' for stdlib imports. This is part of a cleanup to enable pylint. This is only stdlib modules; there are hundreds of unused imports of other modules but its less clear how safe those are to remove due to side effects. Signed-off-by: Alec Warner gentoo.org> Change-Id: If9bee83bbbe1620b34a0f8d153637909af2b8512 Closes: https://github.com/gentoo/portage/pull/585 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AbstractPollTask.py| 1 - lib/_emerge/BlockerCache.py| 1 - lib/_emerge/BlockerDB.py | 1 - lib/_emerge/DependencyArg.py | 1 - lib/_emerge/FakeVartree.py | 1 - lib/_emerge/FifoIpcDaemon.py | 1 - lib/_emerge/Package.py | 2 -- lib/_emerge/PackageVirtualDbapi.py | 1 - lib/_emerge/PipeReader.py | 1 - lib/_emerge/SequentialTaskQueue.py | 1 - lib/_emerge/TaskSequence.py| 1 - lib/_emerge/UseFlagDisplay.py | 1 - lib/_emerge/actions.py | 4 lib/_emerge/create_world_atom.py | 1 - lib/_emerge/depgraph.py| 1 - lib/_emerge/emergelog.py | 1 - lib/_emerge/resolver/DbapiProvidesIndex.py | 1 - lib/_emerge/resolver/output.py | 1 - lib/_emerge/resolver/output_helpers.py | 1 - lib/_emerge/resolver/slot_collision.py | 1 - lib/portage/_emirrordist/Config.py | 1 - lib/portage/_emirrordist/FetchTask.py | 2 -- lib/portage/_emirrordist/MirrorDistTask.py | 1 - lib/portage/_selinux.py| 1 - lib/portage/_sets/base.py | 1 - lib/portage/cache/anydbm.py| 1 - lib/portage/cache/flat_hash.py | 1 - lib/portage/cache/fs_template.py | 1 - lib/portage/cache/index/pkg_desc_index.py | 1 - lib/portage/cache/mappings.py | 1 - lib/portage/cache/metadata.py | 1 - lib/portage/cache/sql_template.py | 1 - lib/portage/cache/sqlite.py| 1 - lib/portage/cache/template.py
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/portage/_sets/, lib/portage/tests/unicode/, ...
n/__init__.py repoman/lib/repoman/main.py repoman/lib/repoman/metadata.py repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py repoman/lib/repoman/utilities.py X-VCS-Directories: lib/portage/ lib/portage/sync/modules/rsync/ lib/portage/package/ebuild/ lib/portage/elog/ lib/portage/emaint/modules/binhost/ lib/portage/tests/dep/ lib/portage/_sets/ lib/portage/tests/resolver/ lib/portage/tests/unicode/ lib/portage/xml/ lib/portage/util/_dyn_libs/ repoman/lib/repoman/ lib/portage/repository/ lib/_emerge/resolver/ lib/portage/proxy/ lib/portage/sync/ lib/portage/dep/ lib/portage/cache/ repoman/lib/repoman/modules/scan/metadata/ lib/portage/_emirrordist/ lib/portage/cache/index/ lib/portage/emaint/modules/sync/ lib/portage/util/ lib/_emerge/ bin/ lib/portage/dbapi/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 5e9fe0f2a5afb71a2aa8425c33103c36bfc1a238 X-VCS-Branch: master Date: Thu, 16 Jul 2020 02:49:35 + (UTC) commit: 5e9fe0f2a5afb71a2aa8425c33103c36bfc1a238 Author: Michał Górny gentoo org> AuthorDate: Wed Jul 15 06:06:55 2020 + Commit: Michał Górny gentoo org> CommitDate: Thu Jul 16 02:48:57 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5e9fe0f2 Eliminate basestring/long/_unicode py3 compat Replace basestring and _unicode hacks with str, and long with int. Reviewed-by: Zac Medico gentoo.org> Closes: https://github.com/gentoo/portage/pull/570 Signed-off-by: Michał Górny gentoo.org> bin/egencache | 7 +-- lib/_emerge/BinpkgFetcher.py | 5 +- lib/_emerge/BlockerCache.py| 19 +++- lib/_emerge/BlockerDB.py | 4 +- lib/_emerge/FakeVartree.py | 11 ++--- lib/_emerge/JobStatusDisplay.py| 7 +-- lib/_emerge/Package.py | 27 --- lib/_emerge/Scheduler.py | 5 +- lib/_emerge/actions.py | 21 - lib/_emerge/create_world_atom.py | 8 +--- lib/_emerge/depgraph.py| 15 ++ lib/_emerge/main.py| 4 +- lib/_emerge/resolver/output.py | 26 -- lib/_emerge/resolver/output_helpers.py | 6 +-- lib/_emerge/resolver/slot_collision.py | 6 +-- lib/portage/__init__.py| 12 ++--- lib/portage/_emirrordist/MirrorDistTask.py | 7 +-- lib/portage/_emirrordist/main.py | 9 ++-- lib/portage/_sets/base.py | 7 +-- lib/portage/cache/flat_hash.py | 5 +- lib/portage/cache/fs_template.py | 7 +-- lib/portage/cache/index/pkg_desc_index.py | 10 ++-- lib/portage/cache/metadata.py | 8 +--- lib/portage/cache/sqlite.py| 7 +-- lib/portage/cache/template.py | 19 +++- lib/portage/cvstree.py | 3 -- lib/portage/dbapi/bintree.py | 55 ++ lib/portage/dbapi/porttree.py | 6 +-- lib/portage/dbapi/vartree.py | 33 + lib/portage/dep/__init__.py| 50 +--- lib/portage/eclass_cache.py| 10 ++-- lib/portage/elog/__init__.py | 5 +- lib/portage/elog/mod_echo.py | 5 +- lib/portage/elog/mod_syslog.py | 5 +- lib/portage/emaint/modules/binhost/binhost.py | 9 ++-- lib/portage/emaint/modules/sync/sync.py| 9 +--- lib/portage/exception.py | 9 ++-- lib/portage/getbinpkg.py | 5 +- lib/portage/locks.py | 17 +++ lib/portage/mail.py| 7 +-- lib/portage/manifest.py| 12 ++--- lib/portage/package/ebuild/config.py | 11 ++--- lib/portage/package/ebuild/doebuild.py | 8 +--- lib/portage/package/ebuild/getmaskingstatus.py | 7 +-- lib/portage/process.py | 5 +- lib/portage/proxy/lazyimport.py| 7 +-- lib/portage/repository/config.py | 5 +- lib/portage/sync/getaddrinfo_validate.py | 6 +-- lib/portage/sync/modules/rsync/rsync.py| 7 +-- lib/portage/tests/dep/test_match_from_list.py | 7 +-- lib/portage/tests/resolver/ResolverPlayground.py | 9 ++-- lib/portage/tests/unicode/test_string_format.py| 7 +-- lib/portage/update.py | 16 ++- lib/portage/util/__init__.py | 8 +--- lib/portage/util/_dyn_libs/LinkageMapELF.py| 6 +--
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, man/, cnf/, lib/portage/_compat_upgrade/, /
commit: 230595cf600cae6beb6ebf6f817d08ace433c3ea Author: Zac Medico gentoo org> AuthorDate: Mon May 11 01:23:41 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun May 24 22:26:29 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=230595cf Default BINPKG_COMPRESSION to zstd (bug 715108) This includes a _compat_upgrade.binpkg_compression script that the ebuild can call in pkg_preinst in order to maintain a backward-compatible bzip2 default when appropriate, ensuring that binary package consumers are not caught off guard. Bug: https://bugs.gentoo.org/715108 Reviewed-by: Brian Dolbec gentoo.org> Signed-off-by: Zac Medico gentoo.org> .travis.yml | 4 +++ cnf/make.globals | 5 +-- lib/portage/_compat_upgrade/binpkg_compression.py | 40 +++ lib/portage/tests/resolver/ResolverPlayground.py | 1 + man/make.conf.5 | 4 +-- 5 files changed, 50 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9269d4034..2132c8c87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: bionic language: python python: - 2.7 @@ -8,6 +9,9 @@ python: - pypy3 # command to install dependencies +before_install: +# Use "dist: bionic" to get a zstd with --long support. +- sudo apt-get -y install zstd install: - pip install tox diff --git a/cnf/make.globals b/cnf/make.globals index 4a59dbe3c..dd3f28f70 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -34,8 +34,9 @@ RPMDIR="/var/cache/rpm" # Temporary build directory PORTAGE_TMPDIR="/var/tmp" -# The compression used for binary packages. Defaults to zstd when USE=zstd is enabled. -BINPKG_COMPRESS="bzip2" +# The compression used for binary packages. Defaults to zstd except for +# existing installs where bzip2 is used for backward compatibility. +BINPKG_COMPRESS="zstd" # Fetching command (3 tries, passive ftp for firewall compatibility) FETCHCOMMAND="wget -t 3 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" diff --git a/lib/portage/_compat_upgrade/binpkg_compression.py b/lib/portage/_compat_upgrade/binpkg_compression.py new file mode 100644 index 0..0f5704733 --- /dev/null +++ b/lib/portage/_compat_upgrade/binpkg_compression.py @@ -0,0 +1,40 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +import re + +import portage +from portage import os +from portage.const import GLOBAL_CONFIG_PATH + +COMPAT_BINPKG_COMPRESS = 'bzip2' + + +def main(): + """ + If the current installation is still configured to use the old + default BINPKG_COMPRESS=bzip2 setting, then patch make.globals + inside ${ED} to maintain backward compatibility, ensuring that + binary package consumers are not caught off guard. This is + intended to be called from the ebuild as follows: + + pkg_preinst() { + python_setup + env -u BINPKG_COMPRESS + PYTHONPATH="${D%/}$(python_get_sitedir)${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die + } + """ + if portage.settings.get('BINPKG_COMPRESS', COMPAT_BINPKG_COMPRESS) == COMPAT_BINPKG_COMPRESS: + config_path = os.path.join(os.environ['ED'], GLOBAL_CONFIG_PATH.lstrip(os.sep), 'make.globals') + with open(config_path) as f: + content = f.read() + compat_setting = 'BINPKG_COMPRESS="{}"'.format(COMPAT_BINPKG_COMPRESS) + portage.output.EOutput().einfo('Setting make.globals default {} for backward compatibility'.format(compat_setting)) + content = re.sub('^BINPKG_COMPRESS=.*$', compat_setting, content, flags=re.MULTILINE) + with open(config_path, 'wt') as f: + f.write(content) + + +if __name__ == '__main__': + main() diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 98831e000..de80a0cc1 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -112,6 +112,7 @@ class ResolverPlayground(object): "uname", "uniq", "xargs", + "zstd", ) # Exclude internal wrappers from PATH lookup. orig_path = os.environ['PATH'] diff --git a/man/make.conf.5 b/man/make.conf.5 index f82fed65a..a3bd662ae 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -1,4 +1,4 @@ -.TH "MAKE.CONF" "5" "Nov 2019" "Portage VERSION" "Portage" +.TH "MAKE.CONF" "5" "May 2020" "Portage VERSION" "Portage" .SH "NAME" make.conf \-
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/portage/tests/dbapi/
commit: e4b3d6e57855ae635e0d9fffddb195d8f819e7c9 Author: Zac Medico gentoo org> AuthorDate: Sat May 2 21:41:30 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat May 2 22:00:50 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e4b3d6e5 AuxdbTestCase: test eclass inheritance Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/dbapi/test_auxdb.py| 32 +++- lib/portage/tests/resolver/ResolverPlayground.py | 16 +--- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/lib/portage/tests/dbapi/test_auxdb.py b/lib/portage/tests/dbapi/test_auxdb.py index cfcabc8bb..85d64c15e 100644 --- a/lib/portage/tests/dbapi/test_auxdb.py +++ b/lib/portage/tests/dbapi/test_auxdb.py @@ -34,24 +34,44 @@ class AuxdbTestCase(TestCase): def _test_mod(self, auxdbmodule): ebuilds = { "cat/A-1": { - "EAPI": "7" + "EAPI": "7", + "MISC_CONTENT": "inherit foo", }, "cat/B-1": { - "EAPI": "7" + "EAPI": "7", + "MISC_CONTENT": "inherit foo", }, } - playground = ResolverPlayground(ebuilds=ebuilds, + ebuild_inherited = frozenset(["bar", "foo"]) + eclass_defined_phases = "prepare" + eclass_depend = "bar/foo" + + eclasses = { + "foo": ( + "inherit bar", + ), + "bar": ( + "EXPORT_FUNCTIONS src_prepare", + "DEPEND=\"{}\"".format(eclass_depend), + "bar_src_prepare() { default; }", + ), + } + + playground = ResolverPlayground(ebuilds=ebuilds, eclasses=eclasses, user_config={'modules': ('portdbapi.auxdbmodule = %s' % auxdbmodule,)}) portdb = playground.trees[playground.eroot]["porttree"].dbapi loop = asyncio._wrap_loop() - loop.run_until_complete(self._test_mod_async(ebuilds, portdb)) + loop.run_until_complete(self._test_mod_async(ebuilds, ebuild_inherited, eclass_defined_phases, eclass_depend, portdb)) @coroutine - def _test_mod_async(self, ebuilds, portdb): + def _test_mod_async(self, ebuilds, ebuild_inherited, eclass_defined_phases, eclass_depend, portdb): for cpv, metadata in ebuilds.items(): - eapi, = yield portdb.async_aux_get(cpv, ['EAPI']) + defined_phases, depend, eapi, inherited = yield portdb.async_aux_get(cpv, ['DEFINED_PHASES', 'DEPEND', 'EAPI', 'INHERITED']) + self.assertEqual(defined_phases, eclass_defined_phases) + self.assertEqual(depend, eclass_depend) self.assertEqual(eapi, metadata['EAPI']) + self.assertEqual(frozenset(inherited.split()), ebuild_inherited) diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 0456ce2e2..98831e000 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -67,7 +67,7 @@ class ResolverPlayground(object): """ def __init__(self, ebuilds={}, binpkgs={}, installed={}, profile={}, repo_configs={}, \ - user_config={}, sets={}, world=[], world_sets=[], distfiles={}, + user_config={}, sets={}, world=[], world_sets=[], distfiles={}, eclasses={}, eprefix=None, targetroot=False, debug=False): """ ebuilds: cpv -> metadata mapping simulating available ebuilds. @@ -159,7 +159,7 @@ class ResolverPlayground(object): self._create_ebuilds(ebuilds) self._create_binpkgs(binpkgs) self._create_installed(installed) - self._create_profile(ebuilds, installed, profile, repo_configs, user_config, sets) + self._create_profile(ebuilds, eclasses, installed, profile, repo_configs, user_config, sets) self._create_world(world, world_sets) self.settings, self.trees = self._load_config() @@ -346,7 +346,7 @@ class ResolverPlayground(object): with open(ebuild_path, 'rb') as inputfile: f.write(inputfile.read()) - def _create_profile(self, ebuilds, installed, profile, repo_configs, user_config, sets): + def _create_profile(self, ebuilds, eclasses, installed, profile, repo_configs, user_config, sets): user_config_dir =
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: 9b755b46f9e88f25fecada0a32095ea614a73b57 Author: Zac Medico gentoo org> AuthorDate: Sun Apr 12 00:01:05 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun Apr 12 00:56:43 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9b755b46 depgraph: respect https://bugs.gentoo.org/717140 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py | 12 +--- .../tests/resolver/test_slot_operator_reverse_deps.py| 3 +-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 6d1f62178..ec90e59df 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -2068,9 +2068,15 @@ class depgraph(object): for parent, atom in self._dynamic_config._parent_atoms.get(existing_pkg, []): if isinstance(parent, Package): if parent in built_slot_operator_parents: - # This parent may need to be rebuilt, so its - # dependencies aren't necessarily relevant. - continue + # This parent may need to be rebuilt, therefore + # discard its soname and built slot operator + # dependency components which are not necessarily + # relevant. + if atom.soname: + continue + elif atom.package and atom.slot_operator_built: + # This discards the slot/subslot component. + atom = atom.with_slot("=") if replacement_parent is not None and \ (replacement_parent.slot_atom == parent.slot_atom diff --git a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py index 5c5295510..6641e9987 100644 --- a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py +++ b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py @@ -1,4 +1,4 @@ -# Copyright 2020 Gentoo Authors +# Copyright 2016-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -122,7 +122,6 @@ class SlotOperatorReverseDepsLibGit2TestCase(TestCase): trigger an upgrade to dev-libs/libgit2-1.0.0-r1, ultimately resulting in an undesirable downgrade to dev-libs/libgit2-0.28.4-r1. """ - self.todo = True ebuilds = {
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: f049604664bff616b297a5c022b6a8277542eac9 Author: Zac Medico gentoo org> AuthorDate: Sat Apr 11 23:45:33 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Apr 11 23:50:21 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f0496046 Add test case to reproduce bug 717140 Bug: https://bugs.gentoo.org/717140 Signed-off-by: Zac Medico gentoo.org> .../resolver/test_slot_operator_reverse_deps.py| 94 +- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py index ce614a4dc..5c5295510 100644 --- a/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py +++ b/lib/portage/tests/resolver/test_slot_operator_reverse_deps.py @@ -1,4 +1,4 @@ -# Copyright 2016 Gentoo Foundation +# Copyright 2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -111,3 +111,95 @@ class SlotOperatorReverseDepsTestCase(TestCase): test_case.fail_msg) finally: playground.cleanup() + + +class SlotOperatorReverseDepsLibGit2TestCase(TestCase): + + def testSlotOperatorReverseDepsLibGit2(self): + """ + Test bug #717140, where the depgraph _slot_operator_update_probe + method ignored =dev-libs/libgit2-0.26.0", + }, + + "dev-libs/libgit2-glib-0.99.0.1" : { + "EAPI": "7", + "SLOT": "0", + "RDEPEND": "=dev-libs/libgit2-0.26.0", + }, + + "dev-vcs/gitg-3.32.1-r1" : { + "EAPI": "7", + "SLOT": "0", + "RDEPEND": "dev-libs/libgit2:= >=dev-libs/libgit2-glib-0.27 =dev-libs/libgit2-0.26.0", + }, + + "dev-vcs/gitg-3.32.1-r1" : { + "EAPI": "7", + "SLOT": "0", + "RDEPEND": "dev-libs/libgit2:0/0.99= >=dev-libs/libgit2-glib-0.27
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: 3e7d37b7cec0978363fc99b089bd69caefe1b826 Author: Zac Medico gentoo org> AuthorDate: Sat Mar 14 19:59:22 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Mar 14 20:35:35 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3e7d37b7 depgraph: respect --deep= with --update (bug 712298) Fix the _wrapped_select_pkg_highest_available_imp method to select an installed package when appropriate for the current --deep= setting, even with --update enabled. This prevents violation of the current --deep= setting in cases where an installed package which satisfies a dependency is masked for any reason. Bug: https://bugs.gentoo.org/712298 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py | 8 ++-- lib/portage/tests/resolver/test_depth.py | 18 -- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index a8ccd270d..6d1f62178 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -1,4 +1,4 @@ -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from __future__ import division, print_function, unicode_literals @@ -6371,7 +6371,11 @@ class depgraph(object): cpv = pkg.cpv reinstall_for_flags = None - if not pkg.installed or \ + if pkg.installed and parent is not None and not self._want_update_pkg(parent, pkg): + # Ensure that --deep= is respected even when the + # installed package is masked and --update is enabled. + pass + elif not pkg.installed or \ (matched_packages and not avoid_update): # Only enforce visibility on installed packages # if there is at least one other visible package diff --git a/lib/portage/tests/resolver/test_depth.py b/lib/portage/tests/resolver/test_depth.py index cb1e2dd5d..ea7c803bb 100644 --- a/lib/portage/tests/resolver/test_depth.py +++ b/lib/portage/tests/resolver/test_depth.py @@ -1,4 +1,4 @@ -# Copyright 2011 Gentoo Foundation +# Copyright 2011-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -9,6 +9,17 @@ class ResolverDepthTestCase(TestCase): def testResolverDepth(self): + profile = { + "package.mask": + ( + # Mask an installed package (for which an update is + # available) in order to test for bug 712298, where + # --update caused --deep= to be violated for + # such a package. + " + # to be violated for dependencies that were masked. In this + # case, the installed dev-libs/B-1 dependency is masked. ResolverPlaygroundTestCase( ["dev-libs/A"], options = {"--update": True, "--deep": 0}, @@ -243,7 +257,7 @@ class ResolverDepthTestCase(TestCase): ) playground = ResolverPlayground(ebuilds=ebuilds, installed=installed, - world=world) + profile=profile, world=world) try: for test_case in test_cases: playground.run_TestCase(test_case)
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: b3a945a9dad98a6d2064a9120206ad3cc9d46675 Author: Zac Medico gentoo org> AuthorDate: Sat Feb 15 00:53:00 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Feb 15 00:56:45 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b3a945a9 _expand_set_args: un-reverse nested set traversal Un-reverse traversal order for @profile @selected @system. Bug: https://bugs.gentoo.org/649622 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py | 6 ++ lib/portage/tests/resolver/test_or_choices.py | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 27696ad40..a8ccd270d 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -2788,10 +2788,8 @@ class depgraph(object): # Traverse nested sets and add them to the stack # if they're not already in the graph. Also, graph - # edges between parent and nested sets. Traverse in - # sorted order for consistent results, using reverse - # sort since we pop these sets from a stack. - for token in sorted(arg.pset.getNonAtoms(), reverse=True): + # edges between parent and nested sets. + for token in sorted(arg.pset.getNonAtoms()): if not token.startswith(SETPREFIX): continue s = token[len(SETPREFIX):] diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py index 5c6803784..f9d9687f3 100644 --- a/lib/portage/tests/resolver/test_or_choices.py +++ b/lib/portage/tests/resolver/test_or_choices.py @@ -676,7 +676,7 @@ class OrChoicesTestCase(TestCase): options = {'--update': True, '--deep': True}, success = True, mergelist=['virtual/w3m-0'], - graph_order=['@world', '@system', '@selected', '@profile', '[nomerge]app-misc/neofetch-6.1.0', '[nomerge]mail-client/neomutt-20191207', '[nomerge]www-client/lynx-2.9.0_pre4', '[nomerge]x11-base/xorg-server-1.20.7', '[nomerge]app-text/xmlto-0.0.28-r1', '[nomerge]www-client/w3m-0.5.3_p20190105', 'virtual/w3m-0'], + graph_order=['@world', '@profile', '@selected', '@system', '[nomerge]app-misc/neofetch-6.1.0', '[nomerge]mail-client/neomutt-20191207', '[nomerge]www-client/lynx-2.9.0_pre4', '[nomerge]x11-base/xorg-server-1.20.7', '[nomerge]app-text/xmlto-0.0.28-r1', '[nomerge]www-client/w3m-0.5.3_p20190105', 'virtual/w3m-0'], ), ) @@ -715,7 +715,7 @@ class OrChoicesTestCase(TestCase): options={'--depclean': True}, success=True, cleanlist=[], - graph_order=['@world', '@system', '@selected', '@profile', '@depclean_protected_set', '[nomerge]app-misc/neofetch-6.1.0', '[nomerge]mail-client/neomutt-20191207', '[nomerge]www-client/lynx-2.9.0_pre4', '[nomerge]x11-base/xorg-server-1.20.7', '[nomerge]app-text/xmlto-0.0.28-r1', '[nomerge]www-client/w3m-0.5.3_p20190105', '[nomerge]virtual/w3m-0'], + graph_order=['@world', '@depclean_protected_set', '@profile', '@selected', '@system', '[nomerge]app-misc/neofetch-6.1.0', '[nomerge]mail-client/neomutt-20191207', '[nomerge]www-client/lynx-2.9.0_pre4', '[nomerge]x11-base/xorg-server-1.20.7', '[nomerge]app-text/xmlto-0.0.28-r1', '[nomerge]www-client/w3m-0.5.3_p20190105', '[nomerge]virtual/w3m-0'], ), )
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 240e7124f02a84a572a7a115e9f0df22579e1c55 Author: Zac Medico gentoo org> AuthorDate: Mon Feb 10 03:18:26 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Feb 10 03:18:53 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=240e7124 ResolverPlayground: set PORTAGE_DEBUG=1 for debug mode Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/ResolverPlayground.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index d7fbe4390..cc0aa46e9 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -555,6 +555,9 @@ class ResolverPlayground(object): "PORTAGE_REPOSITORIES": "\n".join("[%s]\n%s" % (repo_name, "\n".join("%s = %s" % (k, v) for k, v in repo_config.items())) for repo_name, repo_config in self._repositories.items()) } + if self.debug: + env["PORTAGE_DEBUG"] = "1" + trees = portage.create_trees(env=env, eprefix=self.eprefix, **create_trees_kwargs)
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: b98dbb357b711f64c8fc1e305c5bca38be203f1d Author: Zac Medico gentoo org> AuthorDate: Mon Feb 10 01:10:14 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Feb 10 02:24:11 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b98dbb35 test_virtual_w3m: add realistic case, deps copied from real ebuilds Since virtual/w3m-0 is not removed in the depclean case, this test fails to reproduce bug 649622. Bug: https://bugs.gentoo.org/649622 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_or_choices.py | 142 ++ 1 file changed, 142 insertions(+) diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py index a7ede1fac..f31a5ff22 100644 --- a/lib/portage/tests/resolver/test_or_choices.py +++ b/lib/portage/tests/resolver/test_or_choices.py @@ -581,6 +581,148 @@ class OrChoicesTestCase(TestCase): playground.cleanup() + def test_virtual_w3m_realistic(self): + """ + Test for bug 649622 with realistic www-client/w3m dependencies copied + from real ebuilds. + """ + ebuilds = { + + 'app-misc/neofetch-6.1.0': { + 'EAPI': '7', + 'RDEPEND': 'www-client/w3m' + }, + + 'app-text/xmlto-0.0.28-r1' : { + 'EAPI': '7', + 'RDEPEND': '|| ( virtual/w3m www-client/lynx www-client/elinks )' + }, + + 'mail-client/neomutt-20191207': { + 'EAPI': '7', + 'RDEPEND': '|| ( www-client/lynx www-client/w3m www-client/elinks )' + }, + + 'www-client/elinks-0.13_pre_pre20180225' : { + 'EAPI': '7', + }, + + 'www-client/lynx-2.9.0_pre4' : { + 'EAPI': '7', + }, + + 'virtual/w3m-0' : { + 'EAPI': '7', + 'RDEPEND': '|| ( www-client/w3m www-client/w3mmee )' + }, + + 'www-client/w3m-0.5.3_p20190105' : { + 'EAPI': '7', + }, + + 'www-client/w3mmee-0.3.2_p24-r10' : { + 'EAPI': '7', + }, + + 'x11-base/xorg-server-1.20.7' : { + 'EAPI': '7', + 'RDEPEND': '|| ( www-client/links www-client/lynx www-client/w3m ) app-text/xmlto', + } + } + + installed = { + + 'app-misc/neofetch-6.1.0': { + 'EAPI': '7', + 'RDEPEND': 'www-client/w3m' + }, + + 'app-text/xmlto-0.0.28-r1' : { + 'EAPI': '7', + 'RDEPEND': '|| ( virtual/w3m www-client/lynx www-client/elinks )' + }, + + 'mail-client/neomutt-20191207': { + 'EAPI': '7', + 'RDEPEND': '|| ( www-client/lynx www-client/w3m www-client/elinks )' + }, + + 'www-client/lynx-2.9.0_pre4' : { + 'EAPI': '7', + }, + + 'www-client/w3m-0.5.3_p20190105' : { + 'EAPI': '7', + }, + + 'x11-base/xorg-server-1.20.7' : { + 'EAPI': '7', + 'RDEPEND': '|| ( www-client/links www-client/lynx www-client/w3m ) app-text/xmlto', + } + } + + world = ['app-misc/neofetch', 'mail-client/neomutt', 'www-client/lynx', 'x11-base/xorg-server'] + + test_cases = ( + + # Test for bug 649622 (with www-client/w3m installed via + # xorg-server dependency), where virtual/w3m was pulled in + # only to be removed by the next emerge --depclean. + ResolverPlaygroundTestCase( + ['@world'], + options = {'--update': True, '--deep': True}, + success = True, + mergelist=['virtual/w3m-0'], + ), + + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, world=world, debug=False) + try: +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: c3e9a0fe26434edcc2c034c6b863789eb6afbc34 Author: Zac Medico gentoo org> AuthorDate: Sun Feb 9 23:53:42 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun Feb 9 23:56:16 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c3e9a0fe test_virtual_w3m: test without www-client/w3m installed Add test case showing that virtual/w3m-0 is not pulled in when www-client/w3m is not installed and not in @world. Bug: https://bugs.gentoo.org/649622 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_or_choices.py | 39 +++ 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py index a295c9a22..a7ede1fac 100644 --- a/lib/portage/tests/resolver/test_or_choices.py +++ b/lib/portage/tests/resolver/test_or_choices.py @@ -455,18 +455,47 @@ class OrChoicesTestCase(TestCase): 'EAPI': '7', }, + } + + world = ['app-text/xmlto', 'www-client/elinks', 'www-client/lynx'] + + test_cases = ( + + # Test for bug 649622 (without www-client/w3m installed), + # where virtual/w3m was pulled in only to be removed by the + # next emerge --depclean. + ResolverPlaygroundTestCase( + ['@world'], + options = {'--update': True, '--deep': True}, + success = True, + mergelist = [] + ), + + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, world=world, debug=False) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.debug = False + playground.cleanup() + + installed = dict(itertools.chain(installed.items(), { + 'www-client/w3m-0.5.3_p20190105' : { 'EAPI': '7', }, - } - - world = ['app-text/xmlto', 'www-client/elinks', 'www-client/lynx'] + }.items())) test_cases = ( - # Test for bug 649622, where virtual/w3m was pulled in only - # to be removed by the next emerge --depclean. + # Test for bug 649622 (with www-client/w3m installed), + # where virtual/w3m was pulled in only to be removed by the + # next emerge --depclean. ResolverPlaygroundTestCase( ['@world'], options = {'--update': True, '--deep': True},
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 21d9b579dc3fda2105caf3328ac5f0afbd80b9a2 Author: Zac Medico gentoo org> AuthorDate: Sun Feb 9 23:04:50 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun Feb 9 23:15:01 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=21d9b579 test_virtual_w3m: test with www-client/w3m in @world Test for behavior reported in bug 649622 comment #10, where depclean removed virtual/w3m-0 even though www-client/w3m was in the world file. Since nothing is removed here, it means that we have not reproduced the behavior reported in this comment. Bug: https://bugs.gentoo.org/649622#c19 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_or_choices.py | 29 +++ 1 file changed, 29 insertions(+) diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py index 5679d0b5b..a295c9a22 100644 --- a/lib/portage/tests/resolver/test_or_choices.py +++ b/lib/portage/tests/resolver/test_or_choices.py @@ -523,6 +523,35 @@ class OrChoicesTestCase(TestCase): playground.cleanup() + test_cases = ( + + # Test for behavior reported in bug 649622 comment #10, where + # depclean removed virtual/w3m-0 even though www-client/w3m + # was in the world file. Since nothing is removed here, it + # means that we have not reproduced the behavior reported in + # this comment. + ResolverPlaygroundTestCase( + [], + options={'--depclean': True}, + success=True, + cleanlist=[], + ), + + ) + + world += ['www-client/w3m'] + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, world=world, debug=False) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.debug = False + playground.cleanup() + + class OrChoicesLibpostprocTestCase(TestCase): def testOrChoicesLibpostproc(self):
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 1aaed33429f390957514eb81b050cae8c7201d67 Author: Zac Medico gentoo org> AuthorDate: Sat Feb 8 07:05:02 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Feb 8 08:24:04 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1aaed334 Add unit test for virtual/w3m depclean inconsistency (bug 649622) Bug: https://bugs.gentoo.org/649622 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_or_choices.py | 114 +- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py index 10c613e39..f1cc75499 100644 --- a/lib/portage/tests/resolver/test_or_choices.py +++ b/lib/portage/tests/resolver/test_or_choices.py @@ -1,6 +1,8 @@ -# Copyright 2013-2015 Gentoo Foundation +# Copyright 2013-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +import itertools + from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import (ResolverPlayground, ResolverPlaygroundTestCase) @@ -407,6 +409,116 @@ class OrChoicesTestCase(TestCase): playground.debug = False playground.cleanup() + def test_virtual_w3m(self): + ebuilds = { + + 'app-text/xmlto-0.0.28-r1' : { + 'EAPI': '7', + 'RDEPEND': '|| ( virtual/w3m www-client/lynx www-client/elinks )' + }, + + 'www-client/elinks-0.13_pre_pre20180225' : { + 'EAPI': '7', + }, + + 'www-client/lynx-2.9.0_pre4' : { + 'EAPI': '7', + }, + + 'virtual/w3m-0' : { + 'EAPI': '7', + 'RDEPEND': '|| ( www-client/w3m www-client/w3mmee )' + }, + + 'www-client/w3m-0.5.3_p20190105' : { + 'EAPI': '7', + }, + + 'www-client/w3mmee-0.3.2_p24-r10' : { + 'EAPI': '7', + }, + + } + + installed = { + + 'app-text/xmlto-0.0.28-r1' : { + 'EAPI': '7', + 'RDEPEND': '|| ( virtual/w3m www-client/lynx www-client/elinks )' + }, + + 'www-client/elinks-0.13_pre_pre20180225' : { + 'EAPI': '7', + }, + + 'www-client/lynx-2.9.0_pre4' : { + 'EAPI': '7', + }, + + 'www-client/w3m-0.5.3_p20190105' : { + 'EAPI': '7', + }, + + } + + world = ['app-text/xmlto', 'www-client/elinks', 'www-client/lynx'] + + test_cases = ( + + # Test for bug 649622, where virtual/w3m is installed only + # to be removed by the next emerge --depclean. + ResolverPlaygroundTestCase( + ['@world'], + options = {'--update': True, '--deep': True}, + success = True, + mergelist = ['virtual/w3m-0'] + ), + + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, world=world, debug=False) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.debug = False + playground.cleanup() + + installed = dict(itertools.chain(installed.items(), { + + 'virtual/w3m-0' : { + 'EAPI': '7', + 'RDEPEND': '|| ( www-client/w3m www-client/w3mmee )' + }, + + }.items())) + + test_cases = ( + + # Test for bug 649622, where virtual/w3m is removed by + # emerge --depclean immediately after it's installed + # by a world update. + ResolverPlaygroundTestCase( + [], + options={'--depclean': True}, + success=True, + cleanlist=['virtual/w3m-0', 'www-client/w3m-0.5.3_p20190105'], +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 1419af8b0830af4a93adda4a4b63d6bba8f3deb6 Author: Zac Medico gentoo org> AuthorDate: Fri Jan 31 03:25:26 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Feb 1 04:47:36 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1419af8b Add test case that demonstrates bug 707108 Bug: https://bugs.gentoo.org/707108 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_or_choices.py | 123 ++ 1 file changed, 123 insertions(+) diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py index a50ad0151..78946ccec 100644 --- a/lib/portage/tests/resolver/test_or_choices.py +++ b/lib/portage/tests/resolver/test_or_choices.py @@ -285,6 +285,129 @@ class OrChoicesTestCase(TestCase): playground.debug = False playground.cleanup() + def test_python_slot(self): + ebuilds = { + + "dev-lang/python-3.8" : { + "EAPI": "7", + "SLOT": "3.8" + }, + + "dev-lang/python-3.7" : { + "EAPI": "7", + "SLOT": "3.7" + }, + + "dev-lang/python-3.6" : { + "EAPI": "7", + "SLOT": "3.6" + }, + + "app-misc/bar-1" : { + "EAPI": "7", + "IUSE": "python_targets_python3_6 +python_targets_python3_7", + "RDEPEND": "python_targets_python3_7? ( dev-lang/python:3.7 ) python_targets_python3_6? ( dev-lang/python:3.6 )" + }, + + "app-misc/foo-1" : { + "EAPI": "7", + "RDEPEND": "|| ( dev-lang/python:3.8 dev-lang/python:3.7 dev-lang/python:3.6 )" + }, + + } + + installed = { + + "dev-lang/python-3.7" : { + "EAPI": "7", + "SLOT": "3.7" + }, + + "app-misc/bar-1" : { + "EAPI": "7", + "IUSE": "python_targets_python3_6 +python_targets_python3_7", + "USE": "python_targets_python3_7", + "RDEPEND": "dev-lang/python:3.7" + }, + + "app-misc/foo-1" : { + "EAPI": "7", + "RDEPEND": "|| ( dev-lang/python:3.8 dev-lang/python:3.7 dev-lang/python:3.6 )" + }, + + } + + world = ["app-misc/foo", "app-misc/bar"] + + test_cases = ( + + ResolverPlaygroundTestCase( + ["@world"], + options = {"--update": True, "--deep": True}, + success = True, + mergelist = ['dev-lang/python-3.8'] + ), + + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, world=world, debug=False) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.debug = False + playground.cleanup() + + installed = { + + "dev-lang/python-3.8" : { + "EAPI": "7", + "SLOT": "3.8" + }, + + "dev-lang/python-3.7" : { + "EAPI": "7", + "SLOT": "3.7" + }, + + "app-misc/bar-1" : { + "EAPI": "7", + "IUSE": "python_targets_python3_6 +python_targets_python3_7", + "USE": "python_targets_python3_7", + "RDEPEND": "dev-lang/python:3.7" + }, + + "app-misc/foo-1" : { + "EAPI": "7", + "RDEPEND": "|| ( dev-lang/python:3.8 dev-lang/python:3.7 dev-lang/python:3.6 )" + }, + + } + + test_cases = ( + # Demonstrate bug 707108, where a new python slot is erroneosly + # removed by emerge --depclean. +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/portage/dep/, lib/_emerge/
commit: f7d83d75c6b05a16ef07473917082dbd0cd9955c Author: Zac Medico gentoo org> AuthorDate: Sun Jan 26 01:44:14 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Jan 27 03:18:02 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f7d83d75 dep_zapdeps: adjust || preference for slot upgrades (bug 706278) Prefer choices that include a slot upgrade when appropriate, like for the || ( llvm:10 ... llvm:7 ) case reported in bug 706278. In order to avoid pulling in inappropriate slot upgrades, like those which should only be pulled in with --update and --deep, add a want_update flag to each choice which is True for choices that pull in a new slot for which an update is desirable. Mark the test case for bug 480736 as todo, since the "undesirable" slot upgrade which triggers a blocker conflict in this test case is practically indistinguishable from a desirable slot upgrade. This particular blocker conflict is no longer relevant, since current versions of media-libs/libpostproc are no longer compatible with any available media-video/ffmpeg slot. In order to solve this test case, some fancy backtracking (like for bug 382421) will be required. Bug: https://bugs.gentoo.org/706278 Bug: https://bugs.gentoo.org/480736 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py| 16 - lib/portage/dep/dep_check.py | 79 -- lib/portage/tests/resolver/test_or_choices.py | 9 +++ .../tests/resolver/test_or_upgrade_installed.py| 3 +- 4 files changed, 67 insertions(+), 40 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index bf8882774..cae1c4470 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -95,6 +95,14 @@ if sys.hexversion >= 0x300: else: _unicode = unicode +# Exposes a depgraph interface to dep_check. +_dep_check_graph_interface = collections.namedtuple('_dep_check_graph_interface',( + # Indicates a removal action, like depclean or prune. + 'removal_action', + # Checks if update is desirable for a given package. + 'want_update_pkg', +)) + class _scheduler_graph_config(object): def __init__(self, trees, pkg_cache, graph, mergelist): self.trees = trees @@ -510,6 +518,10 @@ class _dynamic_depgraph_config(object): soname_deps=depgraph._frozen_config.soname_deps_enabled) # Track missed updates caused by solved conflicts. self._conflict_missed_update = collections.defaultdict(dict) + dep_check_iface = _dep_check_graph_interface( + removal_action="remove" in myparams, + want_update_pkg=depgraph._want_update_pkg, + ) for myroot in depgraph._frozen_config.trees: self.sets[myroot] = _depgraph_sets() @@ -530,7 +542,7 @@ class _dynamic_depgraph_config(object): self._graph_trees[myroot]["vartree"]= graph_tree self._graph_trees[myroot]["graph_db"] = graph_tree.dbapi self._graph_trees[myroot]["graph"] = self.digraph - self._graph_trees[myroot]["want_update_pkg"] = depgraph._want_update_pkg + self._graph_trees[myroot]["graph_interface"] = dep_check_iface self._graph_trees[myroot]["downgrade_probe"] = depgraph._downgrade_probe def filtered_tree(): pass @@ -558,7 +570,7 @@ class _dynamic_depgraph_config(object): self._filtered_trees[myroot]["graph"]= self.digraph self._filtered_trees[myroot]["vartree"] = \ depgraph._frozen_config.trees[myroot]["vartree"] - self._filtered_trees[myroot]["want_update_pkg"] = depgraph._want_update_pkg + self._filtered_trees[myroot]["graph_interface"] = dep_check_iface self._filtered_trees[myroot]["downgrade_probe"] = depgraph._downgrade_probe dbs = [] diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py index 321d961dd..a7ae2cfa4 100644 --- a/lib/portage/dep/dep_check.py +++ b/lib/portage/dep/dep_check.py @@ -296,7 +296,7 @@ def dep_eval(deplist): class _dep_choice(SlotObject): __slots__ = ('atoms', 'slot_map', 'cp_map', 'all_available', - 'all_installed_slots', 'new_slot_count') + 'all_installed_slots', 'new_slot_count', 'want_update', 'all_in_graph') def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, minimize_slots=False): @@ -331,9 +331,9 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, # c) contains masked installed packages # d) is the first item -
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 097cf78c22b3d523f701ab36f47714c604690b23 Author: Zac Medico gentoo org> AuthorDate: Sun Jan 26 06:20:17 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun Jan 26 06:27:00 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=097cf78c OrChoicesTestCase: split out bug 480736 libpostproc test case This case will become an expected failure after bug 706278 is fixed. The packages that triggered bug 480736 not longer exist. Bug: https://bugs.gentoo.org/480736 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_or_choices.py | 115 +- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py index 63e62d010..c0316bfb3 100644 --- a/lib/portage/tests/resolver/test_or_choices.py +++ b/lib/portage/tests/resolver/test_or_choices.py @@ -78,62 +78,6 @@ class OrChoicesTestCase(TestCase): finally: playground.cleanup() - def testOrChoicesLibpostproc(self): - ebuilds = { - "media-video/ffmpeg-0.10" : { - "EAPI": "5", - "SLOT": "0.10" - }, - "media-video/ffmpeg-1.2.2" : { - "EAPI": "5", - "SLOT": "0" - }, - "media-libs/libpostproc-0.8.0.20121125" : { - "EAPI": "5" - }, - "media-plugins/gst-plugins-ffmpeg-0.10.13_p201211-r1" : { - "EAPI": "5", - "RDEPEND" : "|| ( media-video/ffmpeg:0 media-libs/libpostproc )" - }, - } - - installed = { - "media-video/ffmpeg-0.10" : { - "EAPI": "5", - "SLOT": "0.10" - }, - "media-libs/libpostproc-0.8.0.20121125" : { - "EAPI": "5" - }, - "media-plugins/gst-plugins-ffmpeg-0.10.13_p201211-r1" : { - "EAPI": "5", - "RDEPEND" : "|| ( media-video/ffmpeg:0 media-libs/libpostproc )" - }, - } - - world = ["media-plugins/gst-plugins-ffmpeg"] - - test_cases = ( - # Demonstrate that libpostproc is preferred - # over ffmpeg:0 for bug #480736. - ResolverPlaygroundTestCase( - ["@world"], - options = {"--update": True, "--deep": True}, - success=True, - all_permutations = True, - mergelist = []), - ) - - playground = ResolverPlayground(ebuilds=ebuilds, installed=installed, - world=world, debug=False) - try: - for test_case in test_cases: - playground.run_TestCase(test_case) - self.assertEqual(test_case.test_success, True, test_case.fail_msg) - finally: - playground.cleanup() - - def testInitiallyUnsatisfied(self): ebuilds = { @@ -340,3 +284,62 @@ class OrChoicesTestCase(TestCase): # Disable debug so that cleanup works. playground.debug = False playground.cleanup() + +class OrChoicesLibpostprocTestCase(TestCase): + + def testOrChoicesLibpostproc(self): + + ebuilds = { + "media-video/ffmpeg-0.10" : { + "EAPI": "5", + "SLOT": "0.10" + }, + "media-video/ffmpeg-1.2.2" : { + "EAPI": "5", + "SLOT": "0" + }, + "media-libs/libpostproc-0.8.0.20121125" : { + "EAPI": "5" + }, + "media-plugins/gst-plugins-ffmpeg-0.10.13_p201211-r1" : { + "EAPI": "5", + "RDEPEND" : "|| ( media-video/ffmpeg:0 media-libs/libpostproc )" + }, + } + + installed = { + "media-video/ffmpeg-0.10" : { + "EAPI": "5", + "SLOT": "0.10" + }, + "media-libs/libpostproc-0.8.0.20121125" : { + "EAPI":
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: e2a2adf4b2ff7291fd12dce43c1d4c542c399a9f Author: Zac Medico gentoo org> AuthorDate: Sun Jan 26 00:18:48 2020 + Commit: Zac Medico gentoo org> CommitDate: Sun Jan 26 00:19:44 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e2a2adf4 MultirepoTestCase: package.keywords -> package.accept_keywords Bug: https://bugs.gentoo.org/607852 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_multirepo.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/portage/tests/resolver/test_multirepo.py b/lib/portage/tests/resolver/test_multirepo.py index dabec6af9..bdfcf2120 100644 --- a/lib/portage/tests/resolver/test_multirepo.py +++ b/lib/portage/tests/resolver/test_multirepo.py @@ -1,4 +1,4 @@ -# Copyright 2010-2014 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -246,7 +246,7 @@ class MultirepoTestCase(TestCase): "dev-libs/B-2": { "DEPEND": "dev-libs/A[foo]", "EAPI": 2 }, "dev-libs/B-3": { "DEPEND": "dev-libs/A[-foo]", "EAPI": 2 }, - #package.keywords test + #package.accept_keywords test "dev-libs/C-1": { "KEYWORDS": "~x86" }, "dev-libs/C-1::repo1": { "KEYWORDS": "~x86" }, @@ -286,7 +286,7 @@ class MultirepoTestCase(TestCase): ( "dev-libs/A::repo1 foo", ), - "package.keywords": + "package.accept_keywords": ( "=dev-libs/C-1::test_repo", ), @@ -332,7 +332,7 @@ class MultirepoTestCase(TestCase): success = False, check_repo_names = True), - #package.keywords test + #package.accept_keywords test ResolverPlaygroundTestCase( ["dev-libs/C"], success = True,
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: a4d832db2da41240558c424710a00435a797f0d6 Author: Zac Medico gentoo org> AuthorDate: Sat Jan 25 22:17:54 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Jan 25 22:34:36 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a4d832db OrUpgradeInstalledTestCase: add test for bug 706278 Bug: https://bugs.gentoo.org/706278 Signed-off-by: Zac Medico gentoo.org> .../tests/resolver/test_or_upgrade_installed.py| 71 ++ 1 file changed, 71 insertions(+) diff --git a/lib/portage/tests/resolver/test_or_upgrade_installed.py b/lib/portage/tests/resolver/test_or_upgrade_installed.py index 7018e08de..c3efebf55 100644 --- a/lib/portage/tests/resolver/test_or_upgrade_installed.py +++ b/lib/portage/tests/resolver/test_or_upgrade_installed.py @@ -158,3 +158,74 @@ class OrUpgradeInstalledTestCase(TestCase): finally: playground.debug = False playground.cleanup() + + + def test_llvm_slot_operator(self): + ebuilds = { + 'media-libs/mesa-19.2.8': { + 'EAPI': '7', + 'RDEPEND': '''|| ( + sys-devel/llvm:10 + sys-devel/llvm:9 + sys-devel/llvm:8 + sys-devel/llvm:7 + ) + sys-devel/llvm:=''' + }, + 'sys-devel/llvm-10': { + 'EAPI': '7', + 'KEYWORDS': '', + 'SLOT': '10', + }, + 'sys-devel/llvm-9': { + 'EAPI': '7', + 'SLOT': '9', + }, + 'sys-devel/llvm-8': { + 'EAPI': '7', + 'SLOT': '8', + }, + } + + installed = { + 'media-libs/mesa-19.2.8': { + 'EAPI': '7', + 'RDEPEND': '''|| ( + sys-devel/llvm:10 + sys-devel/llvm:9 + sys-devel/llvm:8 + sys-devel/llvm:7 + ) + sys-devel/llvm:8/8=''' + }, + 'sys-devel/llvm-8': { + 'EAPI': '7', + 'SLOT': '8', + }, + } + + world = ['media-libs/mesa'] + + test_cases = ( + # Demonstrate bug 706278, where there is a missed slot operator + # rebuild that prevents upgrade from llvm-8 to llvm-9. + ResolverPlaygroundTestCase( + ['@world'], + options={'--update': True, '--deep': True}, + success=True, + mergelist=[], + #mergelist=['sys-devel/llvm-9'], + ), + ) + + playground = ResolverPlayground(debug=False, + ebuilds=ebuilds, installed=installed, world=world) + + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, + test_case.fail_msg) + finally: + playground.debug = False + playground.cleanup()
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: e5878170638a091db1331df7e7922c8a14e29e86 Author: Zac Medico gentoo org> AuthorDate: Tue Jan 21 01:59:30 2020 + Commit: Zac Medico gentoo org> CommitDate: Tue Jan 21 02:35:43 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e5878170 Add unit test which demonstrates bug 705986 This USE suggestion appears to prevent application of || preference adjustment to solve the cycle (pypy-exe-bin would solve it): * Error: circular dependencies: (dev-python/pypy-exe-7.3.0:7.3.0/7.3.0::test_repo, ebuild scheduled for merge) depends on (dev-python/pypy-7.3.0:0/73::test_repo, ebuild scheduled for merge) (buildtime) (dev-python/pypy-exe-7.3.0:7.3.0/7.3.0::test_repo, ebuild scheduled for merge) (buildtime) It might be possible to break this cycle by applying the following change: - dev-python/pypy-exe-7.3.0 (Change USE: +low-memory) Meanwhile, an explicit pypy-exe-bin argument adjusts the || preference and breaks the cycle: $ emerge -pq pypy pypy-exe-bin [ebuild N ] dev-python/pypy-exe-bin-7.3.0 [ebuild N ] dev-python/pypy-7.3.0 Bug: https://bugs.gentoo.org/705986 Signed-off-by: Zac Medico gentoo.org> .../tests/resolver/test_circular_choices.py| 48 ++ 1 file changed, 48 insertions(+) diff --git a/lib/portage/tests/resolver/test_circular_choices.py b/lib/portage/tests/resolver/test_circular_choices.py index a5c10b476..968677a46 100644 --- a/lib/portage/tests/resolver/test_circular_choices.py +++ b/lib/portage/tests/resolver/test_circular_choices.py @@ -160,3 +160,51 @@ class VirtualCircularChoicesTestCase(TestCase): self.assertEqual(test_case.test_success, True, test_case.fail_msg) finally: playground.cleanup() + + +class CircularPypyExeTestCase(TestCase): + def testCircularPypyExe(self): + + ebuilds = { + 'dev-python/pypy-7.3.0': { + 'EAPI': '7', + 'SLOT' : '0/73', + 'DEPEND': '|| ( dev-python/pypy-exe dev-python/pypy-exe-bin )' + }, + 'dev-python/pypy-exe-7.3.0': { + 'EAPI': '7', + 'IUSE': 'low-memory', + 'SLOT' : '7.3.0', + 'BDEPEND': '!low-memory? ( dev-python/pypy )' + }, + 'dev-python/pypy-exe-bin-7.3.0': { + 'EAPI': '7', + 'SLOT' : '7.3.0', + }, + } + + test_cases = ( + # Demonstrate bug 705986, where a USE change suggestion is given + # even though an || preference adjustment is available. + ResolverPlaygroundTestCase( + ['dev-python/pypy'], + circular_dependency_solutions = {'dev-python/pypy-7.3.0': {frozenset({('low-memory', True)})}}, + success = False, + ), + # Demonstrate explicit pypy-exe-bin argument used as a workaround + # for bug 705986. + ResolverPlaygroundTestCase( + ['dev-python/pypy', 'dev-python/pypy-exe-bin'], + mergelist=['dev-python/pypy-exe-bin-7.3.0', 'dev-python/pypy-7.3.0'], + success = True, + ), + ) + + playground = ResolverPlayground(ebuilds=ebuilds, debug=False) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.debug = False + playground.cleanup()
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: 680276cc4d4faa653203366cbe3c896ac3883cf2 Author: Zac Medico gentoo org> AuthorDate: Wed Dec 25 08:37:18 2019 + Commit: Zac Medico gentoo org> CommitDate: Thu Dec 26 22:56:39 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=680276cc _serialize_tasks: limit scope of dropped circular dependencies Ensure that all members of a buildtime dependency cycle are merged as a group, such that packages which depend on one or more members of the group will only be merged *after* the entire group has been merged. This extends runtime cycle handling to also handle buildtime cycles in cases where the buildtime dependencies happen to be satisfied by installed packages. In situations when this is necessary, it is desirable to rely on the old installed instances of these packages as little as possible, since they might have been broken by the upgrade of a package that is a member of the dependency cycle. Upgrading members of the cycle as a group effectively minimizes reliance on the old installed package instances, avoiding some cases of bug 199856. For example, it should avoid bug 703676, where libspectre reportedly failed to build against an old installed instance of ghostscript-gpl. Bug: https://bugs.gentoo.org/199856 Bug: https://bugs.gentoo.org/689644 Bug: https://bugs.gentoo.org/690436 Bug: https://bugs.gentoo.org/703676 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py| 94 +++--- lib/portage/tests/resolver/test_merge_order.py | 25 ++- 2 files changed, 78 insertions(+), 41 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 0ee50d5de..bf8882774 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -7640,21 +7640,6 @@ class depgraph(object): break removed_nodes.clear() self._merge_order_bias(mygraph) - def cmp_circular_bias(n1, n2): - """ - RDEPEND is stronger than PDEPEND and this function - measures such a strength bias within a circular - dependency relationship. - """ - n1_n2_medium = n2 in mygraph.child_nodes(n1, - ignore_priority=priority_range.ignore_medium_soft) - n2_n1_medium = n1 in mygraph.child_nodes(n2, - ignore_priority=priority_range.ignore_medium_soft) - if n1_n2_medium == n2_n1_medium: - return 0 - elif n1_n2_medium: - return 1 - return -1 myblocker_uninstalls = self._dynamic_config._blocker_uninstalls.copy() retlist=[] # Contains uninstall tasks that have been scheduled to @@ -7815,7 +7800,8 @@ class depgraph(object): self._spinner_update() selected_nodes = None ignore_priority = None - if drop_satisfied or (prefer_asap and asap_nodes): + cycle_digraph = None + if prefer_asap and asap_nodes: priority_range = DepPrioritySatisfiedRange else: priority_range = DepPriorityNormalRange @@ -7897,11 +7883,12 @@ class depgraph(object): break if not selected_nodes: - nodes = get_nodes(ignore_priority=priority_range.ignore_medium) - if nodes: - mergeable_nodes = set(nodes) + + def find_smallest_cycle(mergeable_nodes, priority_ranges): if prefer_asap and asap_nodes: nodes = asap_nodes + else: + nodes = mergeable_nodes # When gathering the nodes belonging to a runtime cycle, # we want to minimize the number of nodes gathered, since # this tends to produce a more optimal merge order. @@ -7912,21 +7899,44 @@ class depgraph(object): # that depend on them. Therefore, we search for the # smallest cycle in order to try and identify and prefer # these smaller independent cycles. - ignore_priority = priority_range.ignore_medium_soft smallest_cycle = None +
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 7dc4131eca73aee2a78fd5c4339cb41760f7a54f Author: Zac Medico gentoo org> AuthorDate: Wed Dec 25 07:55:24 2019 + Commit: Zac Medico gentoo org> CommitDate: Wed Dec 25 08:09:22 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7dc4131e MergeOrderTestCase: update circ-buildtime mergelist for bug 690436 Update mergelist for the circ-buildtime test case so that it will pass after the fix for bug 690436, and also add a commented merge order assertion which will succeed after the fix. Bug: https://bugs.gentoo.org/690436 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_merge_order.py | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/resolver/test_merge_order.py b/lib/portage/tests/resolver/test_merge_order.py index 5d000d12b..74e826661 100644 --- a/lib/portage/tests/resolver/test_merge_order.py +++ b/lib/portage/tests/resolver/test_merge_order.py @@ -1,4 +1,4 @@ -# Copyright 2011-2013 Gentoo Foundation +# Copyright 2011-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import portage @@ -319,7 +319,12 @@ class MergeOrderTestCase(TestCase): ["app-misc/some-app-c", "app-misc/circ-buildtime-a"], success = True, ambiguous_merge_order = True, - mergelist = [("app-misc/circ-buildtime-b-1", "app-misc/circ-buildtime-c-1"), "app-misc/circ-buildtime-a-1", "app-misc/some-app-c-1"]), + # The following merge order assertion reflects optimal order for + # a circular relationship which is DEPEND in one direction and + # RDEPEND in the other. The assertion currently fails, and the + # patch for bug 690436 will fix it. + #merge_order_assertions = (("app-misc/circ-buildtime-a-1", "app-misc/circ-buildtime-c-1"),), + mergelist = [("app-misc/circ-buildtime-b-1", "app-misc/circ-buildtime-c-1", "app-misc/circ-buildtime-a-1"), "app-misc/some-app-c-1"]), # Test optimal merge order for a circular dep that is # RDEPEND in one direction and PDEPEND in the other. ResolverPlaygroundTestCase(
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/portage/dep/, lib/_emerge/, ...
commit: 85f0dd173ab75bcc39c3616b5a3a967bdc88cf73 Author: Zac Medico gentoo org> AuthorDate: Fri Dec 20 06:58:58 2019 + Commit: Zac Medico gentoo org> CommitDate: Mon Dec 23 22:23:15 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=85f0dd17 emerge --with-test-deps: allow circular deps When USE=test is not enabled, allow circular test dependencies by treating them like PDEPEND. When USE=test is enabled, circular dependencies are still not allowed, as shown in unit tests. Suggested-by: Michał Górny gentoo.org> Bug: https://bugs.gentoo.org/703348 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py | 19 -- lib/portage/dep/__init__.py | 44 +- lib/portage/tests/dep/test_use_reduce.py | 72 ++- lib/portage/tests/resolver/test_with_test_deps.py | 39 +++- 4 files changed, 166 insertions(+), 8 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 1a5448c8f..83631fe70 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -3325,10 +3325,6 @@ class depgraph(object): pkg.iuse.is_valid_flag("test") and \ self._is_argument(pkg) - if with_test_deps: - use_enabled = set(use_enabled) - use_enabled.add("test") - if not pkg.built and \ "--buildpkgonly" in self._frozen_config.myopts and \ "deep" not in self._dynamic_config.myparams: @@ -3430,6 +3426,21 @@ class depgraph(object): noiselevel=-1, level=logging.DEBUG) try: + if (with_test_deps and 'test' not in use_enabled and + pkg.iuse.is_valid_flag('test')): + test_deps = portage.dep.use_reduce(dep_string, + uselist=use_enabled | {'test'}, + is_valid_flag=pkg.iuse.is_valid_flag, + opconvert=True, token_class=Atom, + eapi=pkg.eapi, + subset={'test'}) + + if test_deps and not self._add_pkg_dep_string( + pkg, dep_root, self._priority(runtime_post=True), + test_deps, + allow_unsatisfied): + return 0 + dep_string = portage.dep.use_reduce(dep_string, uselist=use_enabled, is_valid_flag=pkg.iuse.is_valid_flag, diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index f08f6ba4c..72988357a 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -405,7 +405,8 @@ def paren_enclose(mylist, unevaluated_atom=False, opconvert=False): return " ".join(mystrparts) def use_reduce(depstr, uselist=(), masklist=(), matchall=False, excludeall=(), is_src_uri=False, \ - eapi=None, opconvert=False, flat=False, is_valid_flag=None, token_class=None, matchnone=False): + eapi=None, opconvert=False, flat=False, is_valid_flag=None, token_class=None, matchnone=False, + subset=None): """ Takes a dep string and reduces the use? conditionals out, leaving an array with subarrays. All redundant brackets are removed. @@ -434,6 +435,8 @@ def use_reduce(depstr, uselist=(), masklist=(), matchall=False, excludeall=(), i @type token_class: Class @param matchnone: Treat all conditionals as inactive. Used by digestgen(). @type matchnone: Bool + @param subset: Select a subset of dependencies conditional on the given flags + @type subset: Sequence @rtype: List @return: The use reduced depend array """ @@ -491,6 +494,45 @@ def use_reduce(depstr, uselist=(), masklist=(), matchall=False, excludeall=(), i return (flag in uselist and not is_negated) or \ (flag not in uselist and is_negated) + if subset: + def select_subset(dep_struct, disjunction, selected): + result = [] + stack = list(dep_struct) + stack.reverse() + while stack: + token = stack.pop() + try: + conditional =
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: ff057e1002529be8b349fd7a1a3179141a7fda0e Author: Zac Medico gentoo org> AuthorDate: Sun Dec 22 00:33:50 2019 + Commit: Zac Medico gentoo org> CommitDate: Sun Dec 22 00:34:28 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ff057e10 testVirtualCmakeBootstrapUseConditional: use RDEPEND for virtual/cmake Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_circular_choices.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/tests/resolver/test_circular_choices.py b/lib/portage/tests/resolver/test_circular_choices.py index ef9e88eac..d963280b7 100644 --- a/lib/portage/tests/resolver/test_circular_choices.py +++ b/lib/portage/tests/resolver/test_circular_choices.py @@ -63,7 +63,7 @@ class CircularJsoncppCmakeBootstrapTestCase(TestCase): 'virtual/cmake-0': { 'EAPI': '7', 'IUSE': '+bootstrap', - 'BDEPEND': 'bootstrap? ( dev-util/cmake-bootstrap ) !bootstrap? ( dev-util/cmake )' + 'RDEPEND': 'bootstrap? ( dev-util/cmake-bootstrap ) !bootstrap? ( dev-util/cmake )' }, }
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: ae3e58e83b0a3e75990fd2cef04a0c14b3162650 Author: Zac Medico gentoo org> AuthorDate: Sun Dec 22 00:24:47 2019 + Commit: Zac Medico gentoo org> CommitDate: Sun Dec 22 00:26:17 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ae3e58e8 testVirtualCmakeBootstrapUseConditional: split out virtual/cmake If we split the dependency conditional on the bootstrap USE flag into a virtual, then it suffices to rebuild the virtual with USE=-bootstrap instead of rebuilding jsoncpp: * Error: circular dependencies: (dev-libs/jsoncpp-1.9.2:0/0::test_repo, ebuild scheduled for merge) depends on (virtual/cmake-0:0/0::test_repo, ebuild scheduled for merge) (buildtime) (dev-util/cmake-3.16.2:0/0::test_repo, ebuild scheduled for merge) (buildtime) (dev-libs/jsoncpp-1.9.2:0/0::test_repo, ebuild scheduled for merge) (buildtime_slot_op) It might be possible to break this cycle by applying the following change: - virtual/cmake-0 (Change USE: +bootstrap) Note that this change can be reverted, once the package has been installed. Bug: https://bugs.gentoo.org/703440 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_circular_choices.py | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/portage/tests/resolver/test_circular_choices.py b/lib/portage/tests/resolver/test_circular_choices.py index 366f2bc27..ef9e88eac 100644 --- a/lib/portage/tests/resolver/test_circular_choices.py +++ b/lib/portage/tests/resolver/test_circular_choices.py @@ -51,8 +51,7 @@ class CircularJsoncppCmakeBootstrapTestCase(TestCase): ebuilds = { 'dev-libs/jsoncpp-1.9.2': { 'EAPI': '7', - 'IUSE': '+bootstrap', - 'BDEPEND': 'bootstrap? ( dev-util/cmake-bootstrap ) !bootstrap? ( dev-util/cmake )' + 'BDEPEND': 'virtual/cmake' }, 'dev-util/cmake-bootstrap-3.16.2': { 'EAPI': '7', @@ -61,13 +60,18 @@ class CircularJsoncppCmakeBootstrapTestCase(TestCase): 'EAPI': '7', 'BDEPEND': '>=dev-libs/jsoncpp-0.6.0_rc2:0=', }, + 'virtual/cmake-0': { + 'EAPI': '7', + 'IUSE': '+bootstrap', + 'BDEPEND': 'bootstrap? ( dev-util/cmake-bootstrap ) !bootstrap? ( dev-util/cmake )' + }, } test_cases = ( # Solve bug 703440 with a dependency conditional on the bootstrap USE flag. ResolverPlaygroundTestCase( ['dev-util/cmake'], - mergelist = ['dev-util/cmake-bootstrap-3.16.2', 'dev-libs/jsoncpp-1.9.2', 'dev-util/cmake-3.16.2'], + mergelist = ['dev-util/cmake-bootstrap-3.16.2', 'virtual/cmake-0', 'dev-libs/jsoncpp-1.9.2', 'dev-util/cmake-3.16.2'], success = True, ), )
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 4e83e35467741535463c2f9284dcf21ab4229391 Author: Zac Medico gentoo org> AuthorDate: Sat Dec 21 22:55:34 2019 + Commit: Zac Medico gentoo org> CommitDate: Sat Dec 21 23:54:15 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4e83e354 test_circular_choices: add cases for bug 703440 The testCircularJsoncppCmakeBootstrapOrDeps method fails due to circular dependencies triggered when it ignores cmake-bootstrap in order to eliminate redundant packages. Meanwhile, the testVirtualCmakeBootstrapUseConditional method solves the problem by using a dependency conditional on the bootstrap USE flag. Bug: https://bugs.gentoo.org/703440 Signed-off-by: Zac Medico gentoo.org> .../tests/resolver/test_circular_choices.py| 75 ++ 1 file changed, 75 insertions(+) diff --git a/lib/portage/tests/resolver/test_circular_choices.py b/lib/portage/tests/resolver/test_circular_choices.py index 418173689..366f2bc27 100644 --- a/lib/portage/tests/resolver/test_circular_choices.py +++ b/lib/portage/tests/resolver/test_circular_choices.py @@ -5,6 +5,81 @@ from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import (ResolverPlayground, ResolverPlaygroundTestCase) +class CircularJsoncppCmakeBootstrapTestCase(TestCase): + + def testCircularJsoncppCmakeBootstrapOrDeps(self): + + ebuilds = { + 'dev-libs/jsoncpp-1.9.2': { + 'EAPI': '7', + 'BDEPEND': '|| ( dev-util/cmake-bootstrap dev-util/cmake )' + }, + 'dev-util/cmake-bootstrap-3.16.2': { + 'EAPI': '7', + }, + 'dev-util/cmake-3.16.2': { + 'EAPI': '7', + 'BDEPEND': '>=dev-libs/jsoncpp-0.6.0_rc2:0=', + }, + } + + test_cases = ( + # Demonstrate bug 703440. It ignores cmake-bootstrap in order to eliminate redundant packages. + # + # * Error: circular dependencies: + # + # (dev-libs/jsoncpp-1.9.2:0/0::test_repo, ebuild scheduled for merge) depends on + # (dev-util/cmake-3.16.2:0/0::test_repo, ebuild scheduled for merge) (buildtime) + #(dev-libs/jsoncpp-1.9.2:0/0::test_repo, ebuild scheduled for merge) (buildtime_slot_op) + ResolverPlaygroundTestCase( + ['dev-util/cmake'], + circular_dependency_solutions = {}, + success = False, + ), + ) + + playground = ResolverPlayground(ebuilds=ebuilds) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.cleanup() + + def testVirtualCmakeBootstrapUseConditional(self): + + ebuilds = { + 'dev-libs/jsoncpp-1.9.2': { + 'EAPI': '7', + 'IUSE': '+bootstrap', + 'BDEPEND': 'bootstrap? ( dev-util/cmake-bootstrap ) !bootstrap? ( dev-util/cmake )' + }, + 'dev-util/cmake-bootstrap-3.16.2': { + 'EAPI': '7', + }, + 'dev-util/cmake-3.16.2': { + 'EAPI': '7', + 'BDEPEND': '>=dev-libs/jsoncpp-0.6.0_rc2:0=', + }, + } + + test_cases = ( + # Solve bug 703440 with a dependency conditional on the bootstrap USE flag. + ResolverPlaygroundTestCase( + ['dev-util/cmake'], + mergelist = ['dev-util/cmake-bootstrap-3.16.2', 'dev-libs/jsoncpp-1.9.2', 'dev-util/cmake-3.16.2'], + success = True, + ), + ) + + playground = ResolverPlayground(ebuilds=ebuilds) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.cleanup() + class CircularChoicesTestCase(TestCase): def testDirectCircularDependency(self):
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: fa7b6ea6ecdc135a01a65e249276e6d75b92791e Author: Zac Medico gentoo org> AuthorDate: Thu Dec 5 07:11:47 2019 + Commit: Zac Medico gentoo org> CommitDate: Fri Dec 6 04:03:28 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa7b6ea6 _queue_disjunctive_deps: group disjunctions (bug 701996) When disjunctive dependencies are queued, group together disjunctions from the same dependency string so that any overlap between them will trigger expansion to DNF. Bug: https://bugs.gentoo.org/701996 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py| 8 +++-- .../resolver/test_virtual_minimize_children.py | 39 ++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index f80b077bc..78226a3ea 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -3850,10 +3850,11 @@ class depgraph(object): Yields non-disjunctive deps. Raises InvalidDependString when necessary. """ + disjunctions = [] for x in dep_struct: if isinstance(x, list): if x and x[0] == "||": - self._queue_disjunction(pkg, dep_root, dep_priority, [x]) + disjunctions.append(x) else: for y in self._queue_disjunctive_deps( pkg, dep_root, dep_priority, x): @@ -3863,10 +3864,13 @@ class depgraph(object): # or whatever other metadata gets implemented for this # purpose. if x.cp.startswith('virtual/'): - self._queue_disjunction(pkg, dep_root, dep_priority, [x]) + disjunctions.append(x) else: yield x + if disjunctions: + self._queue_disjunction(pkg, dep_root, dep_priority, disjunctions) + def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct): self._dynamic_config._dep_disjunctive_stack.append( (pkg, dep_root, dep_priority, dep_struct)) diff --git a/lib/portage/tests/resolver/test_virtual_minimize_children.py b/lib/portage/tests/resolver/test_virtual_minimize_children.py index b566cb592..720fbe57b 100644 --- a/lib/portage/tests/resolver/test_virtual_minimize_children.py +++ b/lib/portage/tests/resolver/test_virtual_minimize_children.py @@ -285,3 +285,42 @@ class VirtualMinimizeChildrenTestCase(TestCase): finally: playground.debug = False playground.cleanup() + + + def testVirtualWine(self): + ebuilds = { + 'virtual/wine-0-r6': { + 'RDEPEND': '|| ( app-emulation/wine-staging app-emulation/wine-any ) ' + '|| ( app-emulation/wine-vanilla app-emulation/wine-staging app-emulation/wine-any )' + }, + 'app-emulation/wine-staging-4': {}, + 'app-emulation/wine-any-4': {}, + 'app-emulation/wine-vanilla-4': {}, + } + + test_cases = ( + # Test bug 701996, where separate disjunctions where not + # converted to DNF, causing both wine-vanilla and + # wine-staging to be pulled in. + ResolverPlaygroundTestCase( + [ + 'virtual/wine', + ], + success=True, + mergelist=( + 'app-emulation/wine-staging-4', + 'virtual/wine-0-r6', + ), + ), + ) + + playground = ResolverPlayground(debug=False, ebuilds=ebuilds) + + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, + test_case.fail_msg) + finally: + playground.debug = False + playground.cleanup()
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
commit: 1b3131db0e22085dba7d0fb9fc6e5ec70c8c577d Author: Zac Medico gentoo org> AuthorDate: Tue Nov 26 18:05:47 2019 + Commit: Zac Medico gentoo org> CommitDate: Tue Nov 26 20:34:53 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1b3131db emerge --buildpkgonly: respect buildtime hard blockers Bug: https://bugs.gentoo.org/689226 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py| 24 ++--- lib/portage/tests/resolver/test_blocker.py | 87 +- 2 files changed, 102 insertions(+), 9 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 68b5bdb2e..1127a6234 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -2791,7 +2791,6 @@ class depgraph(object): def _add_dep(self, dep, allow_unsatisfied=False): debug = "--debug" in self._frozen_config.myopts - buildpkgonly = "--buildpkgonly" in self._frozen_config.myopts nodeps = "--nodeps" in self._frozen_config.myopts if dep.blocker: @@ -2799,8 +2798,7 @@ class depgraph(object): # blocker validation is only able to account for one package per slot. is_slot_conflict_parent = any(dep.parent in conflict.pkgs[1:] for conflict in \ self._dynamic_config._package_tracker.slot_conflicts()) - if not buildpkgonly and \ - not nodeps and \ + if not nodeps and \ not dep.collapsed_priority.ignored and \ not dep.collapsed_priority.optional and \ not is_slot_conflict_parent: @@ -6805,8 +6803,7 @@ class depgraph(object): for depclean and prune removal operations) @type required_sets: dict """ - if "--buildpkgonly" in self._frozen_config.myopts or \ - "recurse" not in self._dynamic_config.myparams: + if "recurse" not in self._dynamic_config.myparams: return 1 complete_if_new_use = self._dynamic_config.myparams.get( @@ -7061,8 +7058,7 @@ class depgraph(object): # has been called before it, by checking that it is not None. self._dynamic_config._blocked_pkgs = digraph() - if "--buildpkgonly" in self._frozen_config.myopts or \ - "--nodeps" in self._frozen_config.myopts: + if "--nodeps" in self._frozen_config.myopts: return True if True: @@ -7338,6 +7334,10 @@ class depgraph(object): # so apparently this one is unresolvable. unresolved_blocks = True + if "--buildpkgonly" in self._frozen_config.myopts and not ( + blocker.priority.buildtime and blocker.atom.blocker.overlap.forbid): + depends_on_order.clear() + # Make sure we don't unmerge any package that have been pulled # into the graph. if not unresolved_blocks and depends_on_order: @@ -8292,9 +8292,17 @@ class depgraph(object): retlist.extend(unsolvable_blockers) retlist = tuple(retlist) + buildtime_blockers = [] + if unsolvable_blockers and "--buildpkgonly" in self._frozen_config.myopts: + for blocker in unsolvable_blockers: + if blocker.priority.buildtime and blocker.atom.blocker.overlap.forbid: + buildtime_blockers.append(blocker) + if unsolvable_blockers and \ + not buildtime_blockers and \ not self._accept_blocker_conflicts(): - self._dynamic_config._unsatisfied_blockers_for_display = unsolvable_blockers + self._dynamic_config._unsatisfied_blockers_for_display = (tuple(buildtime_blockers) + if buildtime_blockers else unsolvable_blockers) self._dynamic_config._serialized_tasks_cache = retlist self._dynamic_config._scheduler_graph = scheduler_graph # Blockers don't trigger the _skip_restart flag, since diff --git a/lib/portage/tests/resolver/test_blocker.py b/lib/portage/tests/resolver/test_blocker.py index 94a88b8b4..6534f99e6 100644 --- a/lib/portage/tests/resolver/test_blocker.py +++ b/lib/portage/tests/resolver/test_blocker.py @@ -1,4 +1,4 @@ -# Copyright 2014 Gentoo Foundation +# Copyright 2014-2019 Gentoo Authors # Distributed under the
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, bin/
commit: a49a7a29189e6a29da47bc9059739d54d72e2aca Author: Zac Medico gentoo org> AuthorDate: Sun Nov 17 20:11:24 2019 + Commit: Zac Medico gentoo org> CommitDate: Sun Nov 17 20:15:31 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a49a7a29 helper-functions.sh: __multijob_init: handle errors Also add mkfifo to ResolverPlayground essential_binaries, since it's required by __multijob_init. Signed-off-by: Zac Medico gentoo.org> bin/helper-functions.sh | 7 --- bin/isolated-functions.sh| 5 +++-- lib/portage/tests/resolver/ResolverPlayground.py | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh index 2d359762a..f76703f0c 100644 --- a/bin/helper-functions.sh +++ b/bin/helper-functions.sh @@ -19,15 +19,16 @@ __multijob_init() { # read and write to not block ourselve, but use it for reading only. # The second fd really is opened for write only, as Cygwin supports # just one single read fd per FIFO. #583962 - local pipe=$(mktemp -t multijob.XX) + local pipe + pipe=$(mktemp -t multijob.XX) || die rm -f "${pipe}" - mkfifo -m 600 "${pipe}" + mkfifo -m 600 "${pipe}" || die __redirect_alloc_fd mj_read_fd "${pipe}" __redirect_alloc_fd mj_write_fd "${pipe}" '>' rm -f "${pipe}" # See how many children we can fork based on the user's settings. - mj_max_jobs=$(___makeopts_jobs "$@") + mj_max_jobs=$(___makeopts_jobs "$@") || die mj_num_jobs=0 } diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 893c02f9b..e8d41fd64 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -453,8 +453,9 @@ fi ___makeopts_jobs() { # Copied from eutils.eclass:makeopts_jobs() - local jobs=$(echo " ${MAKEOPTS} " | \ - sed -r -n 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p') + local jobs + jobs=$(echo " ${MAKEOPTS} " | \ + sed -r -n 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p') || die echo ${jobs:-1} } diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 3d48c244f..cc3056ab4 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -99,6 +99,7 @@ class ResolverPlayground(object): "install", "ln", "mkdir", + "mkfifo", "mktemp", "mv", "readlink",
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: c5f9cbdc45be302a04bda52612d12a891667103c Author: Zac Medico gentoo org> AuthorDate: Sat Nov 16 09:53:05 2019 + Commit: Zac Medico gentoo org> CommitDate: Sat Nov 16 09:53:56 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c5f9cbdc ResolverPlayground: create installed ebuild + environment.bz2 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/ResolverPlayground.py | 12 1 file changed, 12 insertions(+) diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 22d54e251..3d48c244f 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -1,6 +1,7 @@ # Copyright 2010-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +import bz2 from itertools import permutations import fnmatch import sys @@ -332,6 +333,17 @@ class ResolverPlayground(object): with open(os.path.join(vdb_pkg_dir, k), "w") as f: f.write("%s\n" % v) + ebuild_path = os.path.join(vdb_pkg_dir, a.cpv.split("/")[1] + ".ebuild") + with open(ebuild_path, "w") as f: + f.write('EAPI="%s"\n' % metadata.pop('EAPI', '0')) + for k, v in metadata.items(): + f.write('%s="%s"\n' % (k, v)) + + env_path = os.path.join(vdb_pkg_dir, 'environment.bz2') + with bz2.BZ2File(env_path, mode='w') as f: + with open(ebuild_path, 'rb') as inputfile: + f.write(inputfile.read()) + def _create_profile(self, ebuilds, installed, profile, repo_configs, user_config, sets): user_config_dir = os.path.join(self.eroot, USER_CONFIG_PATH)
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 72c3a6d7179d9b18b8681a958a86af95889e6d88 Author: Zac Medico gentoo org> AuthorDate: Mon Oct 21 08:20:45 2019 + Commit: Zac Medico gentoo org> CommitDate: Mon Oct 21 08:23:27 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=72c3a6d7 SlotOperatorRuntimePkgMaskTestCase: increase --backtrack to 14 Hopefully this solves an occasional travis-ci test failure, since the increase to 13 in c510f715b748 did not solve it. Curiously, both observed failures were with python3.5. See: https://travis-ci.org/gentoo/portage/jobs/600277643 See: https://travis-ci.org/gentoo/portage/jobs/585109030 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py b/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py index 4a028def3..affe33f89 100644 --- a/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py +++ b/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py @@ -110,7 +110,7 @@ class SlotOperatorRuntimePkgMaskTestCase(TestCase): ResolverPlaygroundTestCase( ["=app-misc/meta-pkg-2"], options = { - "--backtrack": 13, + "--backtrack": 14, }, success = True, ambiguous_merge_order = True,
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: bfc7b14852da5a2c6274e2116b81e9f2abfcb962 Author: Zac Medico gentoo org> AuthorDate: Fri Oct 11 03:57:10 2019 + Commit: Zac Medico gentoo org> CommitDate: Fri Oct 11 04:00:17 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=bfc7b148 tests/resolver: specify --autounmask when appropriate Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_autounmask.py | 4 +++- lib/portage/tests/resolver/test_keywords.py | 15 ++- .../tests/resolver/test_slot_operator_autounmask.py | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/portage/tests/resolver/test_autounmask.py b/lib/portage/tests/resolver/test_autounmask.py index 809d42104..64718dbf9 100644 --- a/lib/portage/tests/resolver/test_autounmask.py +++ b/lib/portage/tests/resolver/test_autounmask.py @@ -1,4 +1,4 @@ -# Copyright 2010-2018 Gentoo Foundation +# Copyright 2010-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -579,12 +579,14 @@ class AutounmaskTestCase(TestCase): ResolverPlaygroundTestCase( ["dev-libs/B"], success=False, + options={"--autounmask": True}, mergelist=["dev-libs/A-2", "dev-libs/B-1"], needed_p_mask_changes=set(["dev-libs/A-2"])), ResolverPlaygroundTestCase( ["dev-libs/C"], success=False, + options={"--autounmask": True}, mergelist=["dev-libs/A-", "dev-libs/C-1"], unstable_keywords=set(["dev-libs/A-"]), needed_p_mask_changes=set(["dev-libs/A-"])), diff --git a/lib/portage/tests/resolver/test_keywords.py b/lib/portage/tests/resolver/test_keywords.py index d59ea5881..7989bbac5 100644 --- a/lib/portage/tests/resolver/test_keywords.py +++ b/lib/portage/tests/resolver/test_keywords.py @@ -1,4 +1,4 @@ -# Copyright 2011 Gentoo Foundation +# Copyright 2011-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -37,6 +37,7 @@ class KeywordsTestCase(TestCase): ResolverPlaygroundTestCase( ['app-misc/B'], success = False, + options={'--autounmask': True}, unstable_keywords = ('app-misc/B-1',), mergelist = ['app-misc/B-1']), @@ -48,24 +49,28 @@ class KeywordsTestCase(TestCase): ResolverPlaygroundTestCase( ['app-misc/D'], success = False, + options={'--autounmask': True}, unstable_keywords = ('app-misc/D-1',), mergelist = ['app-misc/D-1']), ResolverPlaygroundTestCase( ['app-misc/E'], success = False, + options={'--autounmask': True}, unstable_keywords = ('app-misc/E-1',), mergelist = ['app-misc/E-1']), ResolverPlaygroundTestCase( ['app-misc/F'], success = False, + options={'--autounmask': True}, unstable_keywords = ('app-misc/F-1',), mergelist = ['app-misc/F-1']), ResolverPlaygroundTestCase( ['app-misc/G'], success = False, + options={'--autounmask': True}, unstable_keywords = ('app-misc/G-1',), mergelist = ['app-misc/G-1']), ) @@ -109,6 +114,7 @@ class KeywordsTestCase(TestCase): ResolverPlaygroundTestCase( ['app-misc/B'], success = False, + options={'--autounmask': True}, unstable_keywords = ('app-misc/B-1',), mergelist = ['app-misc/B-1']), @@ -120,6 +126,7 @@ class KeywordsTestCase(TestCase): ResolverPlaygroundTestCase( ['app-misc/D'], success = False, + options={'--autounmask': True}, unstable_keywords =
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: c510f715b748a604c47fb78ed4796bf0391bcfdd Author: Zac Medico gentoo org> AuthorDate: Sun Sep 15 03:34:07 2019 + Commit: Zac Medico gentoo org> CommitDate: Sun Sep 15 03:35:48 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c510f715 SlotOperatorRuntimePkgMaskTestCase: increase --backtrack to 13 Hopefully this solves an occasional travis-ci test failure like this: AssertionError: False != True : atoms: (=app-misc/meta-pkg-2), key: slot_collision_solutions, expected: None, got: [] atoms: (=app-misc/meta-pkg-2), key: success, expected: True, got: False See: https://travis-ci.org/gentoo/portage/jobs/585109030 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py b/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py index f8b53e2b5..4a028def3 100644 --- a/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py +++ b/lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py @@ -1,4 +1,4 @@ -# Copyright 2017 Gentoo Foundation +# Copyright 2017-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -110,7 +110,7 @@ class SlotOperatorRuntimePkgMaskTestCase(TestCase): ResolverPlaygroundTestCase( ["=app-misc/meta-pkg-2"], options = { - "--backtrack": 12, + "--backtrack": 13, }, success = True, ambiguous_merge_order = True,
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 524aa791f28ffcc1df921d8a8a9c111b7e359099 Author: Zac Medico gentoo org> AuthorDate: Thu Sep 12 19:40:44 2019 + Commit: Zac Medico gentoo org> CommitDate: Thu Sep 12 19:42:37 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=524aa791 VirtualCircularChoicesTestCase: remove todo flag (bug 384107) This test passes since the fix for bug 639346 in commit 09185309aad49b83f29ef94b11318998e520e138. Bug: https://bugs.gentoo.org/384107 Bug: https://bugs.gentoo.org/639346 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_circular_choices.py | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/portage/tests/resolver/test_circular_choices.py b/lib/portage/tests/resolver/test_circular_choices.py index 33b730627..418173689 100644 --- a/lib/portage/tests/resolver/test_circular_choices.py +++ b/lib/portage/tests/resolver/test_circular_choices.py @@ -1,4 +1,4 @@ -# Copyright 2011 Gentoo Foundation +# Copyright 2011-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -34,9 +34,6 @@ class CircularChoicesTestCase(TestCase): class VirtualCircularChoicesTestCase(TestCase): def testDirectVirtualCircularDependency(self): - # Bug #384107 - self.todo = True - ebuilds = { "dev-java/icedtea-6.1.10.3": { "SLOT" : "6", "DEPEND": "virtual/jdk" }, "dev-java/icedtea6-bin-1.10.3": {},
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 54cab2dea3c55cbcd3a9bc2831c0ad25b12f12fa Author: Zac Medico gentoo org> AuthorDate: Thu Sep 12 18:59:09 2019 + Commit: Zac Medico gentoo org> CommitDate: Thu Sep 12 19:03:04 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=54cab2de SlotConflictMaskUpdateTestCase: remove todo flag (bug 693242) This test passes since the fix premature backtracking termination in commit bb0bb4104b0d6cab16abce9cd6e1683c0b6d5c8d. Bug: https://bugs.gentoo.org/693242 Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/test_slot_conflict_mask_update.py | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/portage/tests/resolver/test_slot_conflict_mask_update.py b/lib/portage/tests/resolver/test_slot_conflict_mask_update.py index a90eeac29..37e969828 100644 --- a/lib/portage/tests/resolver/test_slot_conflict_mask_update.py +++ b/lib/portage/tests/resolver/test_slot_conflict_mask_update.py @@ -1,4 +1,4 @@ -# Copyright 2013 Gentoo Foundation +# Copyright 2013-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -13,9 +13,6 @@ class SlotConflictMaskUpdateTestCase(TestCase): in first. This is not always a good idea. Mask the highest version instead. """ - - self.todo = True - ebuilds = { "dev-libs/A-1": { "DEPEND": "=dev-libs/C-1 dev-libs/B" }, "dev-libs/B-1": { "DEPEND": "=dev-libs/C-1" },
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: e0c2af5078fc481c21dc4f4abfa0d61d6ed48e84 Author: Zac Medico gentoo org> AuthorDate: Sun Jan 20 19:22:04 2019 + Commit: Zac Medico gentoo org> CommitDate: Sun Jan 20 19:24:31 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e0c2af50 ResolverPlayground: add chgrp to essential_binaries Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/ResolverPlayground.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 0d6340dc0..fc754fb42 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -86,6 +86,7 @@ class ResolverPlayground(object): "basename", "bzip2", "cat", + "chgrp", "chmod", "chown", "cp",
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, bin/
commit: 8463281f6a6daec64a976693447c240f0d669f08 Author: Zac Medico gentoo org> AuthorDate: Sun Jan 13 23:11:40 2019 + Commit: Zac Medico gentoo org> CommitDate: Sun Jan 13 23:17:32 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8463281f misc-functions.sh: restore canonicalize func (bug 675284) The canonicalize function is required by install-qa-check.d/05prefix. Fixes: aa0a94198794 ("ecompress: Replace with implementation from portage[mgorny]") Bug: https://bugs.gentoo.org/670484 Signed-off-by: Zac Medico gentoo.org> bin/misc-functions.sh| 34 lib/portage/tests/resolver/ResolverPlayground.py | 1 + 2 files changed, 35 insertions(+) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 5de26b44d..4f8a4112d 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -43,6 +43,40 @@ install_symlink_html_docs() { fi } +# replacement for "readlink -f" or "realpath" +READLINK_F_WORKS="" +canonicalize() { + if [[ -z ${READLINK_F_WORKS} ]] ; then + if [[ $(readlink -f -- /../ 2>/dev/null) == "/" ]] ; then + READLINK_F_WORKS=true + else + READLINK_F_WORKS=false + fi + fi + if ${READLINK_F_WORKS} ; then + readlink -f -- "$@" + return + fi + + local f=$1 b n=10 wd=$(pwd) + while (( n-- > 0 )); do + while [[ ${f: -1} = / && ${#f} -gt 1 ]]; do + f=${f%/} + done + b=${f##*/} + cd "${f%"${b}"}" 2>/dev/null || break + if [[ ! -L ${b} ]]; then + f=$(pwd -P) + echo "${f%/}/${b}" + cd "${wd}" + return 0 + fi + f=$(readlink "${b}") + done + cd "${wd}" + return 1 +} + install_qa_check() { local d f i qa_var x paths qa_checks=() checks_run=() if ! ___eapi_has_prefix_variables; then diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 626a1f064..0d6340dc0 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -99,6 +99,7 @@ class ResolverPlayground(object): "mkdir", "mktemp", "mv", + "readlink", "rm", "sed", "sort",
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 17cb113abf2b155b7b1f2955f7eed54f335badb0 Author: Zac Medico gentoo org> AuthorDate: Sun Dec 30 00:21:17 2018 + Commit: Zac Medico gentoo org> CommitDate: Sun Dec 30 00:59:46 2018 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=17cb113a ResolverPlayground: exclude internal wrappers from essential_binaries PATH Ensure that essential_binaries symlinks do not refer to internal wrapper scripts, in order to avoid infinite recursion. Use the same ebuild-helpers pattern as the portageq wrapper script since daeb75b345c4433218ab9e7a5319e8914092f048. Fixes: 1b5edbb5ec70 ("_doebuild_path: do not use host PATH by default and prepend EPREFIX PATH") Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/resolver/ResolverPlayground.py | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 3997ad26e..626a1f064 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -108,8 +108,21 @@ class ResolverPlayground(object): "uniq", "xargs", ) - for x in essential_binaries: - os.symlink(find_binary(x), os.path.join(eubin, x)) + # Exclude internal wrappers from PATH lookup. + orig_path = os.environ['PATH'] + included_paths = [] + for path in orig_path.split(':'): + if path and not fnmatch.fnmatch(path, '*/portage/*/ebuild-helpers*'): + included_paths.append(path) + try: + os.environ['PATH'] = ':'.join(included_paths) + for x in essential_binaries: + path = find_binary(x) + if path is None: + raise portage.exception.CommandNotFound(x) + os.symlink(path, os.path.join(eubin, x)) + finally: + os.environ['PATH'] = orig_path else: self.eprefix = normalize_path(eprefix)