From b2c55b7770fcadf6b4a2369f0decbcd2cab36df7 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@cd1c1023-2f26-0410-ae45-c471fc1f0318> Date: Mon, 24 Dec 2007 11:33:46 +0000 Subject: [PATCH] - updated TODO - try to workaround another tarinfo issue git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@935 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- TODO | 1 + libraries/entropyTools.py | 47 +++++++++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index ea97c7bd2..1c9cbf2db 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ TODO list: + - who pulls in libxcb? - /usr/portage/profiles/updates support - deps in profile? - aspell deps & depends? diff --git a/libraries/entropyTools.py b/libraries/entropyTools.py index d89b88fa9..79af00aa6 100644 --- a/libraries/entropyTools.py +++ b/libraries/entropyTools.py @@ -1450,7 +1450,16 @@ def quickpkg(pkgdata, dirpath, edb = True, portdbPath = None, fake = False, comp os.path.isdir(lpath): # workaround for directory symlink issues lpath = os.path.realpath(lpath) - tarinfo = tar.gettarinfo(lpath, str(arcname)) # FIXME: casting to str() cause of python <2.5.1 bug + try: + arcname = str(arcname) + except UnicodeEncodeError: + try: + arcname = arcname.encode("latin1") + except: + print "DEBUG: python cannot encode path: "+unicode(arcname)+" properly to get it working with tarfile module. Please report." + continue + + tarinfo = tar.gettarinfo(lpath, arcname) # FIXME: casting to str() cause of python <2.5.1 bug, if exception raised, I'm gonna try this tarinfo.uname = id_strings.setdefault(tarinfo.uid, str(tarinfo.uid)) tarinfo.gname = id_strings.setdefault(tarinfo.gid, str(tarinfo.gid)) @@ -2091,38 +2100,58 @@ def collectLinkerPaths(): linkerPaths.update(ldpaths) return ldpaths +# this is especially used to try to guess portage bytecoded entries in CONTENTS def string_to_utf8(string): done = False - # try it easy + # simple unicode? + ''' try: - string = string.decode("utf8").encode(sys.getfilesystemencoding()) + newstring = unicode(string) done = True except: pass if done: - return string + return newstring + ''' + + # try utf8 + try: + newstring = string.decode("utf8").encode(sys.getfilesystemencoding()) + done = True + except: + pass + if done: + return newstring + + try: + newstring = string.encode("utf8").decode(sys.getfilesystemencoding()) + done = True + except: + pass + if done: + return newstring # try latin1 + iso-8859-1 try: - string = string.decode("latin1").decode("iso-8859-1").encode(sys.getfilesystemencoding()) + newstring = string.decode("latin1").decode("iso-8859-1").encode(sys.getfilesystemencoding()) done = True except: pass if done: - return string + return newstring # try just latin1 try: - string = string.decode("latin1").encode(sys.getfilesystemencoding()) + newstring = string.decode("latin1").encode(sys.getfilesystemencoding()) done = True except: pass if done: - return string + return newstring # otherwise return None - print "DEBUG: cannot encode into filesystem encoding -> "+str(string) + print "DEBUG: cannot encode into filesystem encoding -> "+unicode(string) return None def listToUtf8(mylist):