diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-07-13 16:33:49 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-07-13 16:33:49 -0700 |
commit | dde6df65ecbc522dc23cb8d24be3e4dd52657da8 (patch) | |
tree | 9b0ca15a0ed3aa826654a6eb8c090e510c175268 /pym/portage/dbapi/__init__.py | |
parent | 4f1558ec085d4d1716faf8558741aad2e542463f (diff) | |
download | portage-dde6df65ecbc522dc23cb8d24be3e4dd52657da8.tar.gz portage-dde6df65ecbc522dc23cb8d24be3e4dd52657da8.tar.bz2 portage-dde6df65ecbc522dc23cb8d24be3e4dd52657da8.zip |
slotmove: fix handling for EAPI 4-slot-abiv2.2.0_alpha118
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.
Diffstat (limited to 'pym/portage/dbapi/__init__.py')
-rw-r--r-- | pym/portage/dbapi/__init__.py | 28 |
1 files changed, 20 insertions, 8 deletions
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 |