public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] dep_zapdeps: handle circular deps with --onlydeps
@ 2014-10-27 22:10 Zac Medico
  2014-10-28  8:09 ` Alexander Berntsen
  0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2014-10-27 22:10 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

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
---
 pym/portage/dep/dep_check.py                       |  9 ++--
 .../tests/resolver/test_onlydeps_circular.py       | 49 ++++++++++++++++++++++
 2 files changed, 53 insertions(+), 5 deletions(-)
 create mode 100644 pym/portage/tests/resolver/test_onlydeps_circular.py

diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 4386b5e..5dbe283 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..f7cd0a2
--- /dev/null
+++ b/pym/portage/tests/resolver/test_onlydeps_circular.py
@@ -0,0 +1,49 @@
+# 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()
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] dep_zapdeps: handle circular deps with --onlydeps
  2014-10-27 22:10 [gentoo-portage-dev] [PATCH] dep_zapdeps: handle circular deps with --onlydeps Zac Medico
@ 2014-10-28  8:09 ` Alexander Berntsen
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Berntsen @ 2014-10-28  8:09 UTC (permalink / raw
  To: gentoo-portage-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Great. LGTM.
- -- 
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlRPT0YACgkQRtClrXBQc7V2rAD/ZkzX7/3tCdGQmBqM0pGwfZ0T
/BL/SnbmCGVWPgHW+8oA/1x4EDisLGKjq7Kx7Vh4q1owST8R8xWBYEOO6L8U3IXS
=kJqv
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-28  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-27 22:10 [gentoo-portage-dev] [PATCH] dep_zapdeps: handle circular deps with --onlydeps Zac Medico
2014-10-28  8:09 ` Alexander Berntsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox