summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-23 10:02:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-08 09:21:28 +0000
commitb690589385a1373b33ca77a602c25bbb91bdfb19 (patch)
tree03cbaa84b09171a3e7369fd7833ebc0bc30b1aef
parentc0456385ce606ca649922705721534a188dde4e0 (diff)
downloadpoky-b690589385a1373b33ca77a602c25bbb91bdfb19.tar.gz
sstate: Fix the relative symlink replacement code
ant reported on irc that the sstate absolute to relative symlink creation code wasn't working in klibc. He was correct although the level of breakage is rather surprising since it only worked for one level of symlink (usr/include) with everything else being broken. The reason is probably that nothing really uses absolute paths, we use relative paths where at all possible already. Nothing in the target sysroot should use absolute paths for a start. In this regard, the klibc-dev package is broken and needs fixing. It will currently break when building for one machine, then switching to another of the same TUNE_PKGARCH and installing from sstate but that is a separate issue. This patch fixes the symlink creation code by firstly passing in the correct value we need (where the symlink will end up) and seccondly, actually using it. I've also tweaked the debug message to contain appropriate information and got right of the double "//" value the existing code created in favour of the form './..' which looks neater. (From OE-Core rev: 9b05c65450526522d7358d0c0901b594de546748) (From OE-Core rev: 67831122fce62b71263b85592c8d1de4e7deabd2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/sstate.bbclass11
1 files changed, 6 insertions, 5 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 13abf33671..8074a2c255 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -431,13 +431,14 @@ def sstate_package(ss, d):
431 if not link.startswith(tmpdir): 431 if not link.startswith(tmpdir):
432 return 432 return
433 433
434 depth = link.rpartition(tmpdir)[2].count('/') 434 depth = outputpath.rpartition(tmpdir)[2].count('/')
435 base = link.partition(tmpdir)[2].strip() 435 base = link.partition(tmpdir)[2].strip()
436 while depth > 1: 436 while depth > 1:
437 base = "../" + base 437 base = "/.." + base
438 depth -= 1 438 depth -= 1
439 base = "." + base
439 440
440 bb.debug(2, "Replacing absolute path %s with relative path %s" % (link, base)) 441 bb.debug(2, "Replacing absolute path %s with relative path %s for %s" % (link, base, outputpath))
441 os.remove(path) 442 os.remove(path)
442 os.symlink(base, path) 443 os.symlink(base, path)
443 444
@@ -455,11 +456,11 @@ def sstate_package(ss, d):
455 for walkroot, dirs, files in os.walk(state[1]): 456 for walkroot, dirs, files in os.walk(state[1]):
456 for file in files: 457 for file in files:
457 srcpath = os.path.join(walkroot, file) 458 srcpath = os.path.join(walkroot, file)
458 dstpath = srcpath.replace(state[1], sstatebuild + state[0]) 459 dstpath = srcpath.replace(state[1], state[2])
459 make_relative_symlink(srcpath, dstpath, d) 460 make_relative_symlink(srcpath, dstpath, d)
460 for dir in dirs: 461 for dir in dirs:
461 srcpath = os.path.join(walkroot, dir) 462 srcpath = os.path.join(walkroot, dir)
462 dstpath = srcpath.replace(state[1], sstatebuild + state[0]) 463 dstpath = srcpath.replace(state[1], state[2])
463 make_relative_symlink(srcpath, dstpath, d) 464 make_relative_symlink(srcpath, dstpath, d)
464 bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0])) 465 bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0]))
465 oe.path.copyhardlinktree(state[1], sstatebuild + state[0]) 466 oe.path.copyhardlinktree(state[1], sstatebuild + state[0])