summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-24 01:27:20 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-24 01:27:20 +0000
commit798c0ccee6086934d087e60d5ade55f67d2bfc5f (patch)
treea34597054e221b3fb2ae4a5891ea6a220663e8dd
parentBug #282306 - Inside dblink._match_contents(), fall back to utf_8 encoding if (diff)
downloadportage-2.2_rc40.tar.gz
portage-2.2_rc40.tar.bz2
portage-2.2_rc40.zip
Bug #282505 - Fix unicode handling for package moves in binary packages.v2.2_rc40
svn path=/main/trunk/; revision=14134
-rw-r--r--pym/portage/dbapi/bintree.py18
-rw-r--r--pym/portage/update.py12
-rw-r--r--pym/portage/xpak.py11
3 files changed, 33 insertions, 8 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 322487c31..f40583e0b 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -263,13 +263,21 @@ class binarytree(object):
mydata = mytbz2.get_data()
updated_items = update_dbentries([mylist], mydata)
mydata.update(updated_items)
- mydata["PF"] = mynewpkg + "\n"
- mydata["CATEGORY"] = mynewcat+"\n"
+ mydata[_unicode_encode('PF',
+ encoding=_encodings['repo.content'])] = \
+ _unicode_encode(mynewpkg + "\n",
+ encoding=_encodings['repo.content'])
+ mydata[_unicode_encode('CATEGORY',
+ encoding=_encodings['repo.content'])] = \
+ _unicode_encode(mynewcat + "\n",
+ encoding=_encodings['repo.content'])
if mynewpkg != myoldpkg:
- ebuild_data = mydata.get(myoldpkg+".ebuild")
+ ebuild_data = mydata.pop(_unicode_encode(myoldpkg + '.ebuild',
+ encoding=_encodings['repo.content']), None)
if ebuild_data is not None:
- mydata[mynewpkg+".ebuild"] = ebuild_data
- del mydata[myoldpkg+".ebuild"]
+ mydata[_unicode_encode(mynewpkg + '.ebuild',
+ encoding=_encodings['repo.content'])] = ebuild_data
+
mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
self.dbapi.cpv_remove(mycpv)
diff --git a/pym/portage/update.py b/pym/portage/update.py
index ca67370cd..56e6709c0 100644
--- a/pym/portage/update.py
+++ b/pym/portage/update.py
@@ -55,12 +55,18 @@ def update_dbentries(update_iter, mydata):
dict containing only the updated items."""
updated_items = {}
for k, mycontent in mydata.iteritems():
- if k not in ignored_dbentries:
+ k_unicode = _unicode_decode(k,
+ encoding=_encodings['repo.content'], errors='replace')
+ if k_unicode not in ignored_dbentries:
+ mycontent = _unicode_decode(mycontent,
+ encoding=_encodings['repo.content'], errors='replace')
orig_content = mycontent
for update_cmd in update_iter:
mycontent = update_dbentry(update_cmd, mycontent)
if mycontent != orig_content:
- updated_items[k] = mycontent
+ updated_items[k] = _unicode_encode(mycontent,
+ encoding=_encodings['repo.content'],
+ errors='backslashreplace')
return updated_items
def fixdbentries(update_iter, dbdir):
@@ -77,7 +83,7 @@ def fixdbentries(update_iter, dbdir):
updated_items = update_dbentries(update_iter, mydata)
for myfile, mycontent in updated_items.iteritems():
file_path = os.path.join(dbdir, myfile)
- write_atomic(file_path, mycontent)
+ write_atomic(file_path, mycontent, encoding=_encodings['repo.content'])
return len(updated_items) > 0
def grab_updates(updpath, prev_mtimes=None):
diff --git a/pym/portage/xpak.py b/pym/portage/xpak.py
index 5b08c0a3f..15a432f51 100644
--- a/pym/portage/xpak.py
+++ b/pym/portage/xpak.py
@@ -97,6 +97,17 @@ def xpak(rootdir,outfile=None):
def xpak_mem(mydata):
"""Create an xpack segement from a map object."""
+
+ mydata_encoded = {}
+ for k, v in mydata.iteritems():
+ k = _unicode_encode(k,
+ encoding=_encodings['repo.content'], errors='backslashreplace')
+ v = _unicode_encode(v,
+ encoding=_encodings['repo.content'], errors='backslashreplace')
+ mydata_encoded[k] = v
+ mydata = mydata_encoded
+ del mydata_encoded
+
indexglob = _unicode_encode('')
indexpos=0
dataglob = _unicode_encode('')