From dde6df65ecbc522dc23cb8d24be3e4dd52657da8 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 13 Jul 2012 16:33:49 -0700 Subject: slotmove: fix handling for EAPI 4-slot-abi This is just a really minimal fix, in order to prevent slotmove from behaving incorrectly with packages that use EAPI 4-slot-abi. Any slotmove commands that try so specify a sub-slot are treated as invalid for now, since that will required additional EAPI conditional logic, as reported in bug #426476. --- pym/portage/dbapi/__init__.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'pym/portage/dbapi') diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index 34b1d4705..ac8d31169 100644 --- a/pym/portage/dbapi/__init__.py +++ b/pym/portage/dbapi/__init__.py @@ -8,7 +8,7 @@ import re import portage portage.proxy.lazyimport.lazyimport(globals(), 'portage.dbapi.dep_expand:dep_expand@_dep_expand', - 'portage.dep:match_from_list,_match_slot', + 'portage.dep:Atom,match_from_list,_match_slot', 'portage.output:colorize', 'portage.util:cmp_sort_key,writemsg', 'portage.versions:catsplit,catpkgsplit,vercmp,_pkg_str', @@ -312,27 +312,39 @@ class dbapi(object): def move_slot_ent(self, mylist, repo_match=None): """This function takes a sequence: Args: - mylist: a sequence of (package, originalslot, newslot) + mylist: a sequence of (atom, originalslot, newslot) repo_match: callable that takes single repo_name argument and returns True if the update should be applied Returns: The number of slotmoves this function did """ - pkg = mylist[1] + atom = mylist[1] origslot = mylist[2] newslot = mylist[3] - origmatches = self.match(pkg) + + try: + atom.with_slot + except AttributeError: + atom = Atom(atom).with_slot(origslot) + else: + atom = atom.with_slot(origslot) + + origmatches = self.match(atom) moves = 0 if not origmatches: return moves for mycpv in origmatches: - slot = self.aux_get(mycpv, ["SLOT"])[0] - if slot != origslot: + try: + mycpv = self._pkg_str(mycpv, atom.repo) + except (KeyError, InvalidData): continue - if repo_match is not None \ - and not repo_match(self.aux_get(mycpv, ['repository'])[0]): + if repo_match is not None and not repo_match(mycpv.repo): continue moves += 1 + if "/" not in newslot and \ + mycpv.slot_abi and \ + mycpv.slot_abi not in (mycpv.slot, newslot): + newslot = "%s/%s" % (newslot, mycpv.slot_abi) mydata = {"SLOT": newslot+"\n"} self.aux_update(mycpv, mydata) return moves -- cgit v1.2.3-1-g7c22