summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-12-15 17:21:13 -0800
committerZac Medico <zmedico@gentoo.org>2010-12-15 17:21:13 -0800
commitf7cdf7b46f28c09d3da92a45d691a3070b8a3dcc (patch)
tree74d20143166fc9fa7bbedc140eea872d56d09640
parent85f87007e2f031bee90d6130a6cc121a20ff98c0 (diff)
downloadportage-f7cdf7b46f28c09d3da92a45d691a3070b8a3dcc.tar.gz
portage-f7cdf7b46f28c09d3da92a45d691a3070b8a3dcc.tar.bz2
portage-f7cdf7b46f28c09d3da92a45d691a3070b8a3dcc.zip
highlight_violations: handle unversioned atom
A test case is included, which triggers the previously broken case.
-rw-r--r--pym/_emerge/resolver/slot_collision.py20
-rw-r--r--pym/portage/tests/resolver/test_slot_collisions.py12
2 files changed, 24 insertions, 8 deletions
diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py
index ba76ed068..c51b9f734 100644
--- a/pym/_emerge/resolver/slot_collision.py
+++ b/pym/_emerge/resolver/slot_collision.py
@@ -296,20 +296,24 @@ class slot_conflict_handler(object):
atom_str = str(atom)
if version:
op = atom.operator
- ver = cpv_getversion(atom.cpv)
+ ver = None
+ if atom.cp != atom.cpv:
+ ver = cpv_getversion(atom.cpv)
slot = atom.slot
if op == "=*":
op = "="
ver += "*"
- atom_str = atom_str.replace(op, colorize("BAD", op), 1)
-
- start = atom_str.rfind(ver)
- end = start + len(ver)
- atom_str = atom_str[:start] + \
- colorize("BAD", ver) + \
- atom_str[end:]
+ if op is not None:
+ atom_str = atom_str.replace(op, colorize("BAD", op), 1)
+
+ if ver is not None:
+ start = atom_str.rfind(ver)
+ end = start + len(ver)
+ atom_str = atom_str[:start] + \
+ colorize("BAD", ver) + \
+ atom_str[end:]
if slot:
atom_str = atom_str.replace(":" + slot, colorize("BAD", ":" + slot))
diff --git a/pym/portage/tests/resolver/test_slot_collisions.py b/pym/portage/tests/resolver/test_slot_collisions.py
index 7d51f9847..ad1ee65c6 100644
--- a/pym/portage/tests/resolver/test_slot_collisions.py
+++ b/pym/portage/tests/resolver/test_slot_collisions.py
@@ -15,6 +15,8 @@ class SlotCollisionTestCase(TestCase):
"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 },
+ "dev-libs/E-1": { },
+ "dev-libs/E-2": { "IUSE": "foo" },
"app-misc/Z-1": { },
"app-misc/Z-2": { },
@@ -30,6 +32,8 @@ class SlotCollisionTestCase(TestCase):
"app-misc/A-1": { "IUSE": "foo +bar", "REQUIRED_USE": "^^ ( foo bar )", "EAPI": EAPI_4 },
"app-misc/B-1": { "DEPEND": "=app-misc/A-1[foo=]", "IUSE": "foo", "EAPI": 2 },
"app-misc/C-1": { "DEPEND": "=app-misc/A-1[foo]", "EAPI": 2 },
+ "app-misc/E-1": { "RDEPEND": "dev-libs/E[foo?]", "IUSE": "foo", "EAPI": "2" },
+ "app-misc/F-1": { "RDEPEND": "=dev-libs/E-1", "IUSE": "foo", "EAPI": "2" },
}
installed = {
"dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo", "USE": "foo" },
@@ -68,6 +72,14 @@ class SlotCollisionTestCase(TestCase):
slot_collision_solutions = []
),
+ ResolverPlaygroundTestCase(
+ ["=app-misc/E-1", "=app-misc/F-1"],
+ success = False,
+ mergelist = ["dev-libs/E-1", "dev-libs/E-2", "app-misc/E-1", "app-misc/F-1"],
+ ignore_mergelist_order = True,
+ slot_collision_solutions = []
+ ),
+
#Simple cases.
ResolverPlaygroundTestCase(
["sci-libs/L", "sci-libs/M"],