From bb112d9e0e0e9fb60cbe713887ab88454d5943fe Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 27 Jun 2012 10:19:36 -0700 Subject: [PATCH] slot_conflict_handler: handle slot_abi We have to distinguish this from the "version" conflict, in order to avoid invalid vercmp calls when there's not version. --- pym/_emerge/resolver/slot_collision.py | 44 +++++++++++++------ .../tests/resolver/test_slot_collisions.py | 12 +++++ 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py index a1c87146c..783a6483d 100644 --- a/pym/_emerge/resolver/slot_collision.py +++ b/pym/_emerge/resolver/slot_collision.py @@ -275,19 +275,29 @@ class slot_conflict_handler(object): if not atom_without_use_set.findAtomForPackage(other_pkg, \ modified_use=_pkg_use_enabled(other_pkg)): - #The version range does not match. - sub_type = None - if atom.operator in (">=", ">"): - sub_type = "ge" - elif atom.operator in ("=", "~"): - sub_type = "eq" - elif atom.operator in ("<=", "<"): - sub_type = "le" - - atoms = collision_reasons.get(("version", sub_type), set()) - atoms.add((ppkg, atom, other_pkg)) - num_all_specific_atoms += 1 - collision_reasons[("version", sub_type)] = atoms + if atom.operator is not None: + # The version range does not match. + sub_type = None + if atom.operator in (">=", ">"): + sub_type = "ge" + elif atom.operator in ("=", "~"): + sub_type = "eq" + elif atom.operator in ("<=", "<"): + sub_type = "le" + + key = ("version", sub_type) + atoms = collision_reasons.get(key, set()) + atoms.add((ppkg, atom, other_pkg)) + num_all_specific_atoms += 1 + collision_reasons[key] = atoms + else: + # The slot_abi does not match. + key = ("sub-slot", atom.slot_abi) + atoms = collision_reasons.get(key, set()) + atoms.add((ppkg, atom, other_pkg)) + num_all_specific_atoms += 1 + collision_reasons[key] = atoms + elif not atom_set.findAtomForPackage(other_pkg, \ modified_use=_pkg_use_enabled(other_pkg)): missing_iuse = other_pkg.iuse.get_missing_iuse( @@ -333,6 +343,9 @@ class slot_conflict_handler(object): else: best_matches[atom.cp] = (ppkg, atom) selected_for_display.update(best_matches.values()) + elif type == "sub-slot": + for ppkg, atom, other_pkg in parents: + selected_for_display.add((ppkg, atom)) elif type == "use": #Prefer atoms with unconditional use deps over, because it's #not possible to change them on the parent, which means there @@ -437,19 +450,22 @@ class slot_conflict_handler(object): # Display the specific atom from SetArg or # Package types. version_violated = False + sub_slot_violated = False use = [] for (type, sub_type), parents in collision_reasons.items(): for x in parents: if parent == x[0] and atom == x[1]: if type == "version": version_violated = True + elif type == "sub-slot": + sub_slot_violated = True elif type == "use": use.append(sub_type) break atom_str = highlight_violations(atom.unevaluated_atom, version_violated, use) - if version_violated: + if version_violated or sub_slot_violated: self.is_a_version_conflict = True msg.append("%s required by %s" % (atom_str, parent)) diff --git a/pym/portage/tests/resolver/test_slot_collisions.py b/pym/portage/tests/resolver/test_slot_collisions.py index 4867cea05..95d68fe04 100644 --- a/pym/portage/tests/resolver/test_slot_collisions.py +++ b/pym/portage/tests/resolver/test_slot_collisions.py @@ -45,6 +45,9 @@ class SlotCollisionTestCase(TestCase): "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" }, + + "dev-lang/perl-5.12": {"SLOT": "0/5.12", "EAPI": "4-slot-abi"}, + "dev-lang/perl-5.16": {"SLOT": "0/5.16", "EAPI": "4-slot-abi"}, } installed = { "dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo", "USE": "foo" }, @@ -104,6 +107,15 @@ class SlotCollisionTestCase(TestCase): slot_collision_solutions = [] ), + # sub-slot + ResolverPlaygroundTestCase( + ["dev-lang/perl:0/5.12", "dev-lang/perl:0/5.16", "=dev-lang/perl-5.12*"], + success = False, + mergelist = ["dev-lang/perl-5.12", "dev-lang/perl-5.16"], + ignore_mergelist_order = True, + slot_collision_solutions = [] + ), + #Simple cases. ResolverPlaygroundTestCase( ["sci-libs/L", "sci-libs/M"], -- 2.26.2