aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/relocatable.bbclass
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2010-04-01 11:42:50 +0100
committerJoshua Lock <josh@linux.intel.com>2010-04-01 11:53:29 +0100
commitb43b80c7605ad12bc6e0e4e0b22d2f256f246f22 (patch)
treea678ba4b1e195600a63453813436b2864966d4f1 /meta/classes/relocatable.bbclass
parentcf929499aa503d6b9226f823bc366d24a7b26651 (diff)
downloadopenembedded-core-contrib-b43b80c7605ad12bc6e0e4e0b22d2f256f246f22.tar.gz
relocatable: Handle directories having subdirectories of binaries
Make the processing of directories less naive so that it can handle a directory with children that are directories. We now scan for and process binaries in all directories below the scanned paths rather than only the top-level directory. This patch moves the meat of the post-processing into a separate function which is fed paths, process_dir (). Then when the function finds a subdirectory of the passed path which is itself a directory it recursively calls itself. Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'meta/classes/relocatable.bbclass')
-rw-r--r--meta/classes/relocatable.bbclass39
1 files changed, 24 insertions, 15 deletions
diff --git a/meta/classes/relocatable.bbclass b/meta/classes/relocatable.bbclass
index ca36e5b263..25eb99ecff 100644
--- a/meta/classes/relocatable.bbclass
+++ b/meta/classes/relocatable.bbclass
@@ -3,27 +3,28 @@ SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
CHRPATH_BIN ?= "chrpath"
PREPROCESS_RELOCATE_DIRS ?= ""
-def rpath_replace (path, d):
+def process_dir (directory, d):
import subprocess as sub
cmd = bb.data.expand('${CHRPATH_BIN}', d)
-
- bindirs = bb.data.expand("${bindir} ${sbindir} ${base_sbindir} ${base_bindir} ${libdir} ${base_libdir} ${PREPROCESS_RELOCATE_DIRS}", d).split()
tmpdir = bb.data.getVar('TMPDIR', d)
basedir = bb.data.expand('${base_prefix}', d)
- for d in bindirs:
- dir = path + "/" + d
- bb.debug("Checking %s for binaries to process" % dir)
- if not os.path.exists(dir):
- continue
- for file in os.listdir(dir):
- fpath = dir + "/" + file
- if os.path.islink(fpath):
- fpath = os.readlink(fpath)
- if not os.path.isabs(fpath):
- fpath = os.path.normpath(os.path.join(dir, fpath))
-
+ bb.debug("Checking %s for binaries to process" % directory)
+ if not os.path.exists(directory):
+ return
+
+ dirs = os.listdir(directory)
+ for file in dirs:
+ fpath = directory + "/" + file
+ if os.path.islink(fpath):
+ fpath = os.readlink(fpath)
+ if not os.path.isabs(fpath):
+ fpath = os.path.normpath(os.path.join(directory, fpath))
+
+ if os.path.isdir(fpath):
+ process_dir(fpath, d)
+ else:
#bb.note("Testing %s for relocatability" % fpath)
p = sub.Popen([cmd, '-l', fpath],stdout=sub.PIPE,stderr=sub.PIPE)
err, out = p.communicate()
@@ -65,6 +66,14 @@ def rpath_replace (path, d):
#bb.note("Setting rpath to " + args)
sub.call([cmd, '-r', args, fpath])
+def rpath_replace (path, d):
+ bindirs = bb.data.expand("${bindir} ${sbindir} ${base_sbindir} ${base_bindir} ${libdir} ${base_libdir} ${PREPROCESS_RELOCATE_DIRS}", d).split()
+
+ for bindir in bindirs:
+ bb.note ("Processing directory " + bindir)
+ directory = path + "/" + bindir
+ process_dir (directory, d)
+
python relocatable_binaries_preprocess() {
rpath_replace(bb.data.expand('${SYSROOT_DESTDIR}', d), d)
}