Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13930 - main/trunk/pym/portage/dbapi
Date: Thu, 06 Aug 2009 08:25:26
Message-Id: E1MYyHs-0003zm-9y@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-08-06 08:25:23 +0000 (Thu, 06 Aug 2009)
3 New Revision: 13930
4
5 Modified:
6 main/trunk/pym/portage/dbapi/vartree.py
7 Log:
8 Convert paths to unicode when working with CONTENTS.
9
10
11 Modified: main/trunk/pym/portage/dbapi/vartree.py
12 ===================================================================
13 --- main/trunk/pym/portage/dbapi/vartree.py 2009-08-06 07:00:36 UTC (rev 13929)
14 +++ main/trunk/pym/portage/dbapi/vartree.py 2009-08-06 08:25:23 UTC (rev 13930)
15 @@ -1353,11 +1353,16 @@
16 if not hasattr(pkg, "getcontents"):
17 pkg = self._dblink(pkg)
18 root = self.root
19 + if not isinstance(root, unicode):
20 + root = unicode(root, encoding='utf_8', errors='replace')
21 root_len = len(root) - 1
22 new_contents = pkg.getcontents().copy()
23 removed = 0
24
25 for filename in paths:
26 + if not isinstance(filename, unicode):
27 + filename = unicode(filename,
28 + encoding='utf_8', errors='replace')
29 filename = normalize_path(filename)
30 if relative_paths:
31 relative_filename = filename
32 @@ -2530,6 +2535,14 @@
33 if the file is not owned by this package.
34 """
35
36 + if not isinstance(filename, unicode):
37 + filename = unicode(filename,
38 + encoding='utf_8', errors='replace')
39 +
40 + if not isinstance(destroot, unicode):
41 + destroot = unicode(destroot,
42 + encoding='utf_8', errors='replace')
43 +
44 destfile = normalize_path(
45 os.path.join(destroot, filename.lstrip(os.path.sep)))
46
47 @@ -2712,6 +2725,8 @@
48 new_contents = self.getcontents().copy()
49 old_contents = self._installed_instance.getcontents()
50 for f in sorted(preserve_paths):
51 + if not isinstance(f, unicode):
52 + f = unicode(f, encoding='utf_8', errors='replace')
53 f_abs = os.path.join(root, f.lstrip(os.sep))
54 contents_entry = old_contents.get(f_abs)
55 if contents_entry is None:
56 @@ -3734,6 +3749,9 @@
57 mydest = join(destroot, offset, x)
58 # myrealdest is mydest without the $ROOT prefix (makes a difference if ROOT!="/")
59 myrealdest = join(sep, offset, x)
60 + if not isinstance(myrealdest, unicode):
61 + myrealdest = unicode(myrealdest,
62 + encoding='utf_8', errors='replace')
63 # stat file once, test using S_* macros many times (faster that way)
64 mystat = os.lstat(mysrc)
65 mymode = mystat[stat.ST_MODE]