diff options
-rw-r--r-- | meta/classes/native.bbclass | 5 | ||||
-rw-r--r-- | meta/classes/staging.bbclass | 42 |
2 files changed, 47 insertions, 0 deletions
diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass index 4d4aaadc022..93aaf2bfb0e 100644 --- a/meta/classes/native.bbclass +++ b/meta/classes/native.bbclass @@ -176,3 +176,8 @@ do_packagedata[stamp-extra-info] = "" do_populate_sysroot[stamp-extra-info] = "" USE_NLS = "no" + +addtask populate_recipe_sysroot after do_prepare_recipe_sysroot +python do_populate_recipe_sysroot() { + staging_populate_own_sysroot_dir(d) +} diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass index b9c84a40576..27ddb03e66e 100644 --- a/meta/classes/staging.bbclass +++ b/meta/classes/staging.bbclass @@ -343,6 +343,48 @@ def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d): for p in postinsts: subprocess.check_output(p, shell=True) + +def staging_populate_own_sysroot_dir(d): + """ + Populate a recipe's sysroot with its own files + During normal operations a recipe's sysroot doesn't contain its own + sysroot contents - just that of its dependencies. This is only really + useful when you want to have a single place to find sysroot files from + a recipe e.g. when you want to call some native utility externally. + """ + import subprocess + import errno + + targetsysroot = d.getVar("RECIPE_SYSROOT") + nativesysroot = d.getVar("RECIPE_SYSROOT_NATIVE") + + fixme = [] + postinsts = [] + stagingdir = d.getVar("STAGING_DIR") + native = bb.data.inherits_class('native', d) + if native: + targetdir = nativesysroot + else: + targetdir = targetsysroot + + bb.utils.mkdirhier(targetdir) + manifest = "%s.populate_sysroot" % d.getVar('SSTATE_MANFILEPREFIX') + with open(manifest, "r") as f: + for l in f: + l = l.strip() + if l.endswith("/"): + staging_copydir(l, targetdir, stagingdir) + continue + try: + staging_copyfile(l, targetdir, fixme, postinsts, stagingdir) + except FileExistsError: + continue + + staging_processfixme(fixme, targetdir, targetsysroot, nativesysroot, d) + for p in postinsts: + subprocess.check_output(p, shell=True) + + # # Manifests here are complicated. The main sysroot area has the unpacked sstate # which us unrelocated and tracked by the main sstate manifests. Each recipe |