commit: f883c84b36902afb3aecdd05c96ce6e6cd2394a6 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Mon Oct 27 01:39:12 2014 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Tue Oct 28 08:34:33 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f883c84b
dep_zapdeps: handle circular deps with --onlydeps This fixes a case with --onlydeps were dep_zapdeps would pull in an avoidable direct circular dependency on an onlydeps node. The logic changes only apply to --onlydeps, so there's no chance of regressions for cases when --onlydeps is not enabled. X-Gentoo-Bug: 524916 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=524916 Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org> --- pym/portage/dep/dep_check.py | 9 ++-- .../tests/resolver/test_onlydeps_circular.py | 51 ++++++++++++++++++++++ 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py index 4386b5e..9f48713 100644 --- a/pym/portage/dep/dep_check.py +++ b/pym/portage/dep/dep_check.py @@ -429,11 +429,10 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): all_in_graph = False break circular_atom = None - if all_in_graph: - if parent is None or priority is None: - pass - elif priority.buildtime and \ - not (priority.satisfied or priority.optional): + if not (parent is None or priority is None) and \ + (parent.onlydeps or + (all_in_graph and priority.buildtime and + not (priority.satisfied or priority.optional))): # Check if the atom would result in a direct circular # dependency and try to avoid that if it seems likely # to be unresolvable. This is only relevant for diff --git a/pym/portage/tests/resolver/test_onlydeps_circular.py b/pym/portage/tests/resolver/test_onlydeps_circular.py new file mode 100644 index 0000000..ce35cee --- /dev/null +++ b/pym/portage/tests/resolver/test_onlydeps_circular.py @@ -0,0 +1,51 @@ +# Copyright 2014 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 OnlydepsTestCase(TestCase): + + def testOnlydeps(self): + ebuilds = { + "app-misc/A-1": { + "EAPI": "5", + "SLOT": "1", + "DEPEND": "|| ( app-misc/B app-misc/A:1 )" + }, + "app-misc/A-2": { + "EAPI": "5", + "SLOT": "2", + }, + "app-misc/B-0": { + "EAPI": "5", + } + } + + installed = { + "app-misc/A-2": { + "EAPI": "5", + "SLOT": "2", + } + } + + test_cases = ( + # bug 524916 - direct circular dep should not pull + # in an onlydeps node when possible + ResolverPlaygroundTestCase( + ["app-misc/A:1"], + success = True, + options = { "--onlydeps": True }, + mergelist = ["app-misc/B-0"]), + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, 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()
