Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13890 - main/trunk/pym/portage/dbapi
Date: Tue, 04 Aug 2009 07:03:00
Message-Id: E1MYE2z-00029u-Mr@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-08-04 07:02:57 +0000 (Tue, 04 Aug 2009)
3 New Revision: 13890
4
5 Modified:
6 main/trunk/pym/portage/dbapi/bintree.py
7 Log:
8 Bug #280259 - Fix binarytree to always open the Packages file as unicode.
9
10
11 Modified: main/trunk/pym/portage/dbapi/bintree.py
12 ===================================================================
13 --- main/trunk/pym/portage/dbapi/bintree.py 2009-08-04 06:45:46 UTC (rev 13889)
14 +++ main/trunk/pym/portage/dbapi/bintree.py 2009-08-04 07:02:57 UTC (rev 13890)
15 @@ -430,18 +430,8 @@
16 dirs.remove("All")
17 dirs.sort()
18 dirs.insert(0, "All")
19 - pkgindex = self._new_pkgindex()
20 + pkgindex = self._load_pkgindex()
21 pf_index = None
22 - try:
23 - f = open(self._pkgindex_file)
24 - except EnvironmentError:
25 - pass
26 - else:
27 - try:
28 - pkgindex.read(f)
29 - finally:
30 - f.close()
31 - del f
32 if not self._pkgindex_version_supported(pkgindex):
33 pkgindex = self._new_pkgindex()
34 header = pkgindex.header
35 @@ -647,7 +637,8 @@
36 urldata[1] + urldata[2], "Packages")
37 pkgindex = self._new_pkgindex()
38 try:
39 - f = open(pkgindex_file)
40 + f = codecs.open(pkgindex_file,
41 + encoding='utf_8', errors='replace')
42 try:
43 pkgindex.read(f)
44 finally:
45 @@ -846,18 +837,8 @@
46 self.getname(cpv).split(os.path.sep)[-2] == "All":
47 self._create_symlink(cpv)
48 created_symlink = True
49 - pkgindex = self._new_pkgindex()
50 - try:
51 - f = codecs.open(self._pkgindex_file,
52 - encoding='utf_8', errors='replace')
53 - except EnvironmentError:
54 - pass
55 - else:
56 - try:
57 - pkgindex.read(f)
58 - finally:
59 - f.close()
60 - del f
61 + pkgindex = self._load_pkgindex()
62 +
63 if not self._pkgindex_version_supported(pkgindex):
64 pkgindex = self._new_pkgindex()
65
66 @@ -1098,7 +1079,8 @@
67 def _load_pkgindex(self):
68 pkgindex = self._new_pkgindex()
69 try:
70 - f = open(self._pkgindex_file)
71 + f = codecs.open(self._pkgindex_file,
72 + encoding='utf8', errors='replace')
73 except EnvironmentError:
74 pass
75 else: