shiftpath should be ok now

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1367 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
(no author)
2008-03-03 08:43:49 +00:00
parent 160635e11e
commit 3c4c3c28e5
+9 -6
View File
@@ -1670,26 +1670,29 @@ def quickpkg(pkgdata, dirpath, edb = True, portdbPath = None, fake = False, comp
for path in contents:
# convert back to filesystem str
encoded_path = path
path = shiftpath+path
path = path.encode('raw_unicode_escape')
try:
exist = os.lstat(shiftpath+path)
exist = os.lstat(path)
except OSError, e:
continue # skip file
arcname = path[1:] # remove trailing /
arcname = path[len(shiftpath):] # remove shiftpath
if arcname.startswith("/"):
arcname = arcname[1:] # remove trailing /
ftype = pkgdata['content'][encoded_path]
if str(ftype) == '0': ftype = 'dir' # force match below, '0' means databases without ftype
if 'dir' == ftype and \
not stat.S_ISDIR(exist.st_mode) and \
os.path.isdir(shiftpath+path): # workaround for directory symlink issues
path = os.path.realpath(shiftpath+path)
os.path.isdir(path): # workaround for directory symlink issues
path = os.path.realpath(path)
tarinfo = tar.gettarinfo(shiftpath+path, arcname)
tarinfo = tar.gettarinfo(path, arcname)
tarinfo.uname = id_strings.setdefault(tarinfo.uid, str(tarinfo.uid))
tarinfo.gname = id_strings.setdefault(tarinfo.gid, str(tarinfo.gid))
if stat.S_ISREG(exist.st_mode):
tarinfo.type = tarfile.REGTYPE
f = open(shiftpath+path)
f = open(path)
try:
tar.addfile(tarinfo, f)
finally: