diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-02-22 14:23:26 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-02-22 14:23:26 +0000 |
commit | 7a60d379e88f92ee6725387c11a7e5326d91480f (patch) | |
tree | 264dc9006a6d5e81b10c35d968090620a749df0b /meta | |
parent | df76efbdee7b4e89759ba7da2a6297152cb0b7e0 (diff) | |
download | poky-7a60d379e88f92ee6725387c11a7e5326d91480f.tar.gz |
relocatable.bbclass: Clean up indentation
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/relocatable.bbclass | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/meta/classes/relocatable.bbclass b/meta/classes/relocatable.bbclass index 9237b459ba..64c2d4a62a 100644 --- a/meta/classes/relocatable.bbclass +++ b/meta/classes/relocatable.bbclass | |||
@@ -15,52 +15,55 @@ def rpath_replace (path, d): | |||
15 | for d in bindirs: | 15 | for d in bindirs: |
16 | dir = path + "/" + d | 16 | dir = path + "/" + d |
17 | bb.debug("Checking %s for binaries to process" % dir) | 17 | bb.debug("Checking %s for binaries to process" % dir) |
18 | if os.path.exists(dir): | 18 | if not os.path.exists(dir): |
19 | for file in os.listdir(dir): | 19 | continue |
20 | fpath = dir + "/" + file | 20 | for file in os.listdir(dir): |
21 | if os.path.islink(fpath): | 21 | fpath = dir + "/" + file |
22 | fpath = os.readlink(fpath) | 22 | if os.path.islink(fpath): |
23 | if not os.path.isabs(fpath): | 23 | fpath = os.readlink(fpath) |
24 | fpath = os.path.normpath(os.path.join(dir, fpath)) | 24 | if not os.path.isabs(fpath): |
25 | fpath = os.path.normpath(os.path.join(dir, fpath)) | ||
25 | 26 | ||
26 | #bb.note("Testing %s for relocatability" % fpath) | 27 | #bb.note("Testing %s for relocatability" % fpath) |
27 | p = sub.Popen([cmd, '-l', fpath],stdout=sub.PIPE,stderr=sub.PIPE) | 28 | p = sub.Popen([cmd, '-l', fpath],stdout=sub.PIPE,stderr=sub.PIPE) |
28 | err, out = p.communicate() | 29 | err, out = p.communicate() |
29 | # If returned succesfully, process stderr for results | 30 | # If returned succesfully, process stderr for results |
30 | if p.returncode == 0: | 31 | if p.returncode != 0: |
31 | # Throw away everything other than the rpath list | 32 | continue |
32 | curr_rpath = err.partition("RPATH=")[2] | ||
33 | #bb.note("Current rpath for %s is %s" % (fpath, curr_rpath.strip())) | ||
34 | rpaths = curr_rpath.split(":") | ||
35 | new_rpaths = [] | ||
36 | for rpath in rpaths: | ||
37 | # If rpath is already dynamic continue | ||
38 | if rpath.find("$ORIGIN") != -1: | ||
39 | continue | ||
40 | # If the rpath shares a root with base_prefix determine a new dynamic rpath from the | ||
41 | # base_prefix shared root | ||
42 | if rpath.find(basedir) != -1: | ||
43 | depth = fpath.partition(basedir)[2].count('/') | ||
44 | libpath = rpath.partition(basedir)[2].strip() | ||
45 | # otherwise (i.e. cross packages) determine a shared root based on the TMPDIR | ||
46 | # NOTE: This will not work reliably for cross packages, particularly in the case | ||
47 | # where your TMPDIR is a short path (i.e. /usr/poky) as chrpath cannot insert an | ||
48 | # rpath longer than that which is already set. | ||
49 | else: | ||
50 | depth = fpath.rpartition(tmpdir)[2].count('/') | ||
51 | libpath = rpath.partition(tmpdir)[2].strip() | ||
52 | 33 | ||
53 | base = "$ORIGIN" | 34 | # Throw away everything other than the rpath list |
54 | while depth > 1: | 35 | curr_rpath = err.partition("RPATH=")[2] |
55 | base += "/.." | 36 | #bb.note("Current rpath for %s is %s" % (fpath, curr_rpath.strip())) |
56 | depth-=1 | 37 | rpaths = curr_rpath.split(":") |
57 | new_rpaths.append("%s%s" % (base, libpath)) | 38 | new_rpaths = [] |
39 | for rpath in rpaths: | ||
40 | # If rpath is already dynamic continue | ||
41 | if rpath.find("$ORIGIN") != -1: | ||
42 | continue | ||
43 | # If the rpath shares a root with base_prefix determine a new dynamic rpath from the | ||
44 | # base_prefix shared root | ||
45 | if rpath.find(basedir) != -1: | ||
46 | depth = fpath.partition(basedir)[2].count('/') | ||
47 | libpath = rpath.partition(basedir)[2].strip() | ||
48 | # otherwise (i.e. cross packages) determine a shared root based on the TMPDIR | ||
49 | # NOTE: This will not work reliably for cross packages, particularly in the case | ||
50 | # where your TMPDIR is a short path (i.e. /usr/poky) as chrpath cannot insert an | ||
51 | # rpath longer than that which is already set. | ||
52 | else: | ||
53 | depth = fpath.rpartition(tmpdir)[2].count('/') | ||
54 | libpath = rpath.partition(tmpdir)[2].strip() | ||
58 | 55 | ||
59 | # if we have modified some rpaths call chrpath to update the binary | 56 | base = "$ORIGIN" |
60 | if len(new_rpaths): | 57 | while depth > 1: |
61 | args = ":".join(new_rpaths) | 58 | base += "/.." |
62 | #bb.note("Setting rpath to " + args) | 59 | depth-=1 |
63 | sub.call([cmd, '-r', args, fpath]) | 60 | new_rpaths.append("%s%s" % (base, libpath)) |
61 | |||
62 | # if we have modified some rpaths call chrpath to update the binary | ||
63 | if len(new_rpaths): | ||
64 | args = ":".join(new_rpaths) | ||
65 | #bb.note("Setting rpath to " + args) | ||
66 | sub.call([cmd, '-r', args, fpath]) | ||
64 | 67 | ||
65 | python relocatable_binaries_preprocess() { | 68 | python relocatable_binaries_preprocess() { |
66 | rpath_replace(bb.data.expand('${SYSROOT_DESTDIR}', d), d) | 69 | rpath_replace(bb.data.expand('${SYSROOT_DESTDIR}', d), d) |