diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-03-18 23:04:26 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-03-18 23:23:29 +0000 |
commit | 16e1f1051eeb51e88244e550bfcf14a1a6ce50d1 (patch) | |
tree | ccafdb3868458ff58fbf823033b2068dba0a4f77 /meta/classes/sstate.bbclass | |
parent | d2658c81017e5445e592a7c90222aaf37686486f (diff) | |
download | ast2050-yocto-poky-16e1f1051eeb51e88244e550bfcf14a1a6ce50d1.zip ast2050-yocto-poky-16e1f1051eeb51e88244e550bfcf14a1a6ce50d1.tar.gz |
sstate.bbclass: Turn absolute symbolic links into relative ones for sstate packages
(From OE-Core rev: 655139c2644d085331f4f6814119fbd904ff244b)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r-- | meta/classes/sstate.bbclass | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index b4873f0..47d0568 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass @@ -301,18 +301,45 @@ def sstate_hardcode_path(d): 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 + if not os.path.islink(path): + return + link = os.readlink(path) + if not os.path.isabs(link): + return + if not link.startswith(tmpdir): + return + + depth = link.rpartition(tmpdir)[2].count('/') + base = link.partition(tmpdir)[2].strip() + while depth > 1: + base = "../" + base + depth -= 1 + + bb.debug(2, "Replacing absolute path %s with relative path %s" % (link, base)) + os.remove(path) + os.symlink(base, path) + + tmpdir = bb.data.getVar('TMPDIR', d, True) + sstatebuild = bb.data.expand("${WORKDIR}/sstate-build-%s/" % ss['name'], d) sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_'+ ss['name'] + ".tgz" bb.mkdirhier(sstatebuild) bb.mkdirhier(os.path.dirname(sstatepkg)) for state in ss['dirs']: srcbase = state[0].rstrip("/").rsplit('/', 1)[0] - oe.path.copytree(state[1], sstatebuild + state[0]) for walkroot, dirs, files in os.walk(state[1]): for file in files: srcpath = os.path.join(walkroot, file) dstpath = srcpath.replace(state[1], sstatebuild + state[0]) bb.debug(2, "Preparing %s for packaging at %s" % (srcpath, dstpath)) + make_relative_symlink(srcpath, dstpath, d) + for dir in dirs: + srcpath = os.path.join(walkroot, dir) + dstpath = srcpath.replace(state[1], sstatebuild + state[0]) + make_relative_symlink(srcpath, dstpath, d) + oe.path.copytree(state[1], sstatebuild + state[0]) workdir = bb.data.getVar('WORKDIR', d, True) for plain in ss['plaindirs']: |