summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/sstate.bbclass29
1 files changed, 28 insertions, 1 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index b4873f0f3d..47d05689b6 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -301,18 +301,45 @@ def sstate_hardcode_path(d):
301def sstate_package(ss, d): 301def sstate_package(ss, d):
302 import oe.path 302 import oe.path
303 303
304 def make_relative_symlink(path, outputpath, d):
305 # Replace out absolute TMPDIR paths in symlinks with relative ones
306 if not os.path.islink(path):
307 return
308 link = os.readlink(path)
309 if not os.path.isabs(link):
310 return
311 if not link.startswith(tmpdir):
312 return
313
314 depth = link.rpartition(tmpdir)[2].count('/')
315 base = link.partition(tmpdir)[2].strip()
316 while depth > 1:
317 base = "../" + base
318 depth -= 1
319
320 bb.debug(2, "Replacing absolute path %s with relative path %s" % (link, base))
321 os.remove(path)
322 os.symlink(base, path)
323
324 tmpdir = bb.data.getVar('TMPDIR', d, True)
325
304 sstatebuild = bb.data.expand("${WORKDIR}/sstate-build-%s/" % ss['name'], d) 326 sstatebuild = bb.data.expand("${WORKDIR}/sstate-build-%s/" % ss['name'], d)
305 sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_'+ ss['name'] + ".tgz" 327 sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_'+ ss['name'] + ".tgz"
306 bb.mkdirhier(sstatebuild) 328 bb.mkdirhier(sstatebuild)
307 bb.mkdirhier(os.path.dirname(sstatepkg)) 329 bb.mkdirhier(os.path.dirname(sstatepkg))
308 for state in ss['dirs']: 330 for state in ss['dirs']:
309 srcbase = state[0].rstrip("/").rsplit('/', 1)[0] 331 srcbase = state[0].rstrip("/").rsplit('/', 1)[0]
310 oe.path.copytree(state[1], sstatebuild + state[0])
311 for walkroot, dirs, files in os.walk(state[1]): 332 for walkroot, dirs, files in os.walk(state[1]):
312 for file in files: 333 for file in files:
313 srcpath = os.path.join(walkroot, file) 334 srcpath = os.path.join(walkroot, file)
314 dstpath = srcpath.replace(state[1], sstatebuild + state[0]) 335 dstpath = srcpath.replace(state[1], sstatebuild + state[0])
315 bb.debug(2, "Preparing %s for packaging at %s" % (srcpath, dstpath)) 336 bb.debug(2, "Preparing %s for packaging at %s" % (srcpath, dstpath))
337 make_relative_symlink(srcpath, dstpath, d)
338 for dir in dirs:
339 srcpath = os.path.join(walkroot, dir)
340 dstpath = srcpath.replace(state[1], sstatebuild + state[0])
341 make_relative_symlink(srcpath, dstpath, d)
342 oe.path.copytree(state[1], sstatebuild + state[0])
316 343
317 workdir = bb.data.getVar('WORKDIR', d, True) 344 workdir = bb.data.getVar('WORKDIR', d, True)
318 for plain in ss['plaindirs']: 345 for plain in ss['plaindirs']: