summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-06 08:25:23 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-06 08:25:23 +0000
commit791b1bc23bf51f5706de80d2b4ce2236e0054cf3 (patch)
treea274c486177befbd52a7028c01c62acde8d540c3
parentFix broken os.walk call in _post_src_install_uid_fix(). (diff)
downloadportage-791b1bc23bf51f5706de80d2b4ce2236e0054cf3.tar.gz
portage-791b1bc23bf51f5706de80d2b4ce2236e0054cf3.tar.bz2
portage-791b1bc23bf51f5706de80d2b4ce2236e0054cf3.zip
Convert paths to unicode when working with CONTENTS.
svn path=/main/trunk/; revision=13930
-rw-r--r--pym/portage/dbapi/vartree.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index c6374cdf9..52d48a70f 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1353,11 +1353,16 @@ class vardbapi(dbapi):
if not hasattr(pkg, "getcontents"):
pkg = self._dblink(pkg)
root = self.root
+ if not isinstance(root, unicode):
+ root = unicode(root, encoding='utf_8', errors='replace')
root_len = len(root) - 1
new_contents = pkg.getcontents().copy()
removed = 0
for filename in paths:
+ if not isinstance(filename, unicode):
+ filename = unicode(filename,
+ encoding='utf_8', errors='replace')
filename = normalize_path(filename)
if relative_paths:
relative_filename = filename
@@ -2530,6 +2535,14 @@ class dblink(object):
if the file is not owned by this package.
"""
+ if not isinstance(filename, unicode):
+ filename = unicode(filename,
+ encoding='utf_8', errors='replace')
+
+ if not isinstance(destroot, unicode):
+ destroot = unicode(destroot,
+ encoding='utf_8', errors='replace')
+
destfile = normalize_path(
os.path.join(destroot, filename.lstrip(os.path.sep)))
@@ -2712,6 +2725,8 @@ class dblink(object):
new_contents = self.getcontents().copy()
old_contents = self._installed_instance.getcontents()
for f in sorted(preserve_paths):
+ if not isinstance(f, unicode):
+ f = unicode(f, encoding='utf_8', errors='replace')
f_abs = os.path.join(root, f.lstrip(os.sep))
contents_entry = old_contents.get(f_abs)
if contents_entry is None:
@@ -3734,6 +3749,9 @@ class dblink(object):
mydest = join(destroot, offset, x)
# myrealdest is mydest without the $ROOT prefix (makes a difference if ROOT!="/")
myrealdest = join(sep, offset, x)
+ if not isinstance(myrealdest, unicode):
+ myrealdest = unicode(myrealdest,
+ encoding='utf_8', errors='replace')
# stat file once, test using S_* macros many times (faster that way)
mystat = os.lstat(mysrc)
mymode = mystat[stat.ST_MODE]