From 911aede760138a47b9b2e2b7001b85f386ec990d Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Fri, 1 Feb 2013 18:06:42 +0100 Subject: targets-list-image: add ad-hoc image created from recipes used on command line * creates IMAGE_INSTALL dynamically based on targets used on bitbake command line Signed-off-by: Martin Jansa --- meta/classes/targets-list-image.bbclass | 32 ++++++++++++++++++++++++++ meta/recipes-core/images/targets-list-image.bb | 15 ++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 meta/classes/targets-list-image.bbclass create mode 100644 meta/recipes-core/images/targets-list-image.bb diff --git a/meta/classes/targets-list-image.bbclass b/meta/classes/targets-list-image.bbclass new file mode 100644 index 0000000000..7c05cd3818 --- /dev/null +++ b/meta/classes/targets-list-image.bbclass @@ -0,0 +1,32 @@ +python collect_packages () { + import oe.packagedata + if isinstance(e, bb.event.TargetsListGenerated): + #bb.warn("bb.event.TargetsListGenerated e '%s'" % e._model) + pkgs_to_install = [] + for pn in e._model: + data = oe.packagedata.read_pkgdata(pn, e.data) + excluded = 'EXCLUDE_FROM_WORLD' in data and data['EXCLUDE_FROM_WORLD'] == '1' + excluded_image = 'EXCLUDE_FROM_WORLD_IMAGE' in data and data['EXCLUDE_FROM_WORLD_IMAGE'] == '1' + if excluded or excluded_image: + #bb.warn("Skipping whole '%s' because it's explicitly excluded from world(-image)" % pn) + continue + + if 'PACKAGES' in data: + pkgs = data['PACKAGES'].split() + if 'EXCLUDE_PACKAGES_FROM_WORLD_IMAGE' in data: + excluded_packages = data['EXCLUDE_PACKAGES_FROM_WORLD_IMAGE'].split() + for pkg in pkgs: + if pkg not in excluded_packages: + pkgs_to_install.append(pkg) +# else: +# bb.warn("Skipping '%s' from '%s' because it's explicitly excluded from world-image" % (pkg, pn)) + else: + pkgs_to_install.extend(pkgs) +# else: +# bb.warn("No packages in '%s'" % pn) + + bb.warn("pkgs_to_install after '%s': '%s'" % (pn, pkgs_to_install)) + e.data.setVar("IMAGE_INSTALL_pn-targets-list-image", ' '.join(pkgs_to_install)) +} + +addhandler collect_packages diff --git a/meta/recipes-core/images/targets-list-image.bb b/meta/recipes-core/images/targets-list-image.bb new file mode 100644 index 0000000000..25fb147a91 --- /dev/null +++ b/meta/recipes-core/images/targets-list-image.bb @@ -0,0 +1,15 @@ +# IMAGE_INSTALL is set to union of all PACKAGES +# from all recipes listed on command line which +# are not marked as: +# EXCLUDE_FROM_WORLD or EXCLUDE_FROM_WORLD_IMAGE +# or individual packages listed in +# EXCLUDE_PACKAGES_FROM_WORLD_IMAGE +# You can use this to create "world-image" by: +# bitbake world targets-list-image + +inherit targets-list-image +inherit image + +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + -- cgit 1.2.3-korg