summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-23 20:01:52 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-23 20:01:52 +0000
commitb14eb2d5bf1104d6eabb97f32adb364809fee324 (patch)
treed6ccac64cd963599e5dd92b2c41263342959bd9b
parent706b85f0ee885804e0fd3ac1224d9bdab8f4bde9 (diff)
downloadportage-b14eb2d5bf1104d6eabb97f32adb364809fee324.tar.gz
portage-b14eb2d5bf1104d6eabb97f32adb364809fee324.tar.bz2
portage-b14eb2d5bf1104d6eabb97f32adb364809fee324.zip
Bug #286118 - Fix dbapi.move_ent() methods so they don't assume Atom instances
can be concatenated with strings (even though they can now, it's not really a good assumption). svn path=/main/trunk/; revision=14396
-rw-r--r--pym/portage/dbapi/bintree.py19
-rw-r--r--pym/portage/dbapi/vartree.py12
2 files changed, 16 insertions, 15 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 76447bf61..e6ea40347 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -2,6 +2,8 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$
+from __future__ import print_function
+
__all__ = ["bindbapi", "binarytree"]
import portage
@@ -238,20 +240,19 @@ class binarytree(object):
for atom in (origcp, newcp):
if not isjustname(atom):
raise InvalidPackageName(str(atom))
- origcat = origcp.split("/")[0]
- mynewcat = newcp.split("/")[0]
+ mynewcat = catsplit(newcp)[0]
origmatches=self.dbapi.cp_list(origcp)
moves = 0
if not origmatches:
return moves
for mycpv in origmatches:
-
- mycpsplit = catpkgsplit(mycpv)
- mynewcpv = newcp + "-" + mycpsplit[2]
- if mycpsplit[3] != "r0":
- mynewcpv += "-" + mycpsplit[3]
- myoldpkg = mycpv.split("/")[1]
- mynewpkg = mynewcpv.split("/")[1]
+ mycpv_cp = portage.cpv_getkey(mycpv)
+ if mycpv_cp != origcp:
+ # Ignore PROVIDE virtual match.
+ continue
+ mynewcpv = mycpv.replace(mycpv_cp, str(newcp), 1)
+ myoldpkg = catsplit(mycpv)[1]
+ mynewpkg = catsplit(mynewcpv)[1]
if (mynewpkg != myoldpkg) and os.path.exists(self.getname(mynewcpv)):
writemsg(_("!!! Cannot update binary: Destination exists.\n"),
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index d2160896e..90d27dee3 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -892,12 +892,12 @@ class vardbapi(dbapi):
if not origmatches:
return moves
for mycpv in origmatches:
- mycpsplit = catpkgsplit(mycpv)
- mynewcpv = newcp + "-" + mycpsplit[2]
- mynewcat = newcp.split("/")[0]
- if mycpsplit[3] != "r0":
- mynewcpv += "-" + mycpsplit[3]
- mycpsplit_new = catpkgsplit(mynewcpv)
+ mycpv_cp = cpv_getkey(mycpv)
+ if mycpv_cp != origcp:
+ # Ignore PROVIDE virtual match.
+ continue
+ mynewcpv = mycpv.replace(mycpv_cp, str(newcp), 1)
+ mynewcat = catsplit(newcp)[0]
origpath = self.getpath(mycpv)
if not os.path.exists(origpath):
continue