]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
targets-list-image: add ad-hoc image created from recipes used on command line jansa/target-image
authorMartin Jansa <Martin.Jansa@gmail.com>
Fri, 1 Feb 2013 17:06:42 +0000 (18:06 +0100)
committerMartin Jansa <Martin.Jansa@gmail.com>
Wed, 2 Apr 2014 17:51:42 +0000 (19:51 +0200)
* creates IMAGE_INSTALL dynamically based on targets used on bitbake command line

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
meta/classes/targets-list-image.bbclass [new file with mode: 0644]
meta/recipes-core/images/targets-list-image.bb [new file with mode: 0644]

diff --git a/meta/classes/targets-list-image.bbclass b/meta/classes/targets-list-image.bbclass
new file mode 100644 (file)
index 0000000..7c05cd3
--- /dev/null
@@ -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 (file)
index 0000000..25fb147
--- /dev/null
@@ -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"
+