diff options
-rw-r--r-- | meta/classes/sstate.bbclass | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index aeb7466d35e..7f99cd3b0dd 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass @@ -583,32 +583,27 @@ python sstate_hardcode_path () { def sstate_package(ss, d): import oe.path - def make_relative_symlink(path, outputpath, d): - # Replace out absolute TMPDIR paths in symlinks with relative ones + def make_relative_symlink(path, workdir, d): + # Replace absolute sysroot paths in symlinks with relative ones if not os.path.islink(path): return link = os.readlink(path) if not os.path.isabs(link): return - if not link.startswith(tmpdir): + if not link.startswith(workdir): return - #base = os.path.relpath(link, os.path.dirname(path)) + directory = os.path.dirname(path.rpartition(workdir)[2]) + base_link = link.rpartition(workdir)[2] + rel_path = os.path.relpath(base_link,directory) - depth = outputpath.rpartition(tmpdir)[2].count('/') - base = link.partition(tmpdir)[2].strip() - while depth > 1: - base = "/.." + base - depth -= 1 - base = "." + base - - bb.debug(2, "Replacing absolute path %s with relative path %s for %s" % (link, base, outputpath)) + bb.debug(2, "Replacing absolute path %s with relative path %s for %s" % (link, rel_path, path)) os.remove(path) - os.symlink(base, path) + os.symlink(rel_path, path) - tmpdir = d.getVar('TMPDIR') + workdir = d.getVar('WORKDIR') - sstatebuild = d.expand("${WORKDIR}/sstate-build-%s/" % ss['task']) + sstatebuild = workdir + "/sstate-build-" +ss['task'] + "/" sstatepkg = d.getVar('SSTATE_PKG') + '_'+ ss['task'] + ".tgz" bb.utils.remove(sstatebuild, recurse=True) bb.utils.mkdirhier(sstatebuild) @@ -620,18 +615,12 @@ def sstate_package(ss, d): continue srcbase = state[0].rstrip("/").rsplit('/', 1)[0] for walkroot, dirs, files in os.walk(state[1]): - for file in files: + for file in files + dirs: srcpath = os.path.join(walkroot, file) - dstpath = srcpath.replace(state[1], state[2]) - make_relative_symlink(srcpath, dstpath, d) - for dir in dirs: - srcpath = os.path.join(walkroot, dir) - dstpath = srcpath.replace(state[1], state[2]) - make_relative_symlink(srcpath, dstpath, d) + make_relative_symlink(srcpath, workdir, d) bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0])) os.rename(state[1], sstatebuild + state[0]) - workdir = d.getVar('WORKDIR') for plain in ss['plaindirs']: pdir = plain.replace(workdir, sstatebuild) bb.utils.mkdirhier(plain) |