Encode/decode names from the xpak index where appropriate.
authorZac Medico <zmedico@gentoo.org>
Mon, 21 Sep 2009 22:02:09 +0000 (22:02 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 21 Sep 2009 22:02:09 +0000 (22:02 -0000)
svn path=/main/trunk/; revision=14367

pym/portage/xpak.py

index 8838891caa089a504ffac8c9373bbf7bf7f6a803..b753f2490c0e54b3951a699f3390d49cfbb80a50 100644 (file)
@@ -209,6 +209,8 @@ def getindex_mem(myindex):
 def searchindex(myindex,myitem):
        """(index,item) -- Finds the offset and length of the file 'item' in the
        datasegment via the index 'index' provided."""
+       myitem = _unicode_encode(myitem,
+               encoding=_encodings['repo.content'], errors='backslashreplace')
        mylen=len(myitem)
        myindexlen=len(myindex)
        startpos=0
@@ -416,6 +418,8 @@ class tbz2(object):
                        datapos=decodeint(self.index[startpos+4+namelen:startpos+8+namelen]);
                        datalen=decodeint(self.index[startpos+8+namelen:startpos+12+namelen]);
                        myname=self.index[startpos+4:startpos+4+namelen]
+                       myname = _unicode_decode(myname,
+                               encoding=_encodings['repo.content'], errors='replace')
                        dirname=os.path.dirname(myname)
                        if dirname:
                                if not os.path.exists(dirname):