All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] licence_image: Add lic-pkgs IMAGE_FEATURE
@ 2021-07-12 15:35 Mike Crowe
  0 siblings, 0 replies; only message in thread
From: Mike Crowe @ 2021-07-12 15:35 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Crowe

Installing license packages is similar to installing -dev or -dbg
packages, so let's invent a "lic-pkgs" IMAGE_FEATURE that does so and
document it in core-image.bbclass.

This image feature only works if LICENSE_CREATE_PACKAGE is set, so
refuse to generate an image if the lic-pkgs feature is enabled without
LICENSE_CREATE_PACKAGE.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
---
 meta/classes/core-image.bbclass    |  2 ++
 meta/classes/license_image.bbclass | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/meta/classes/core-image.bbclass b/meta/classes/core-image.bbclass
index d81f68bd2e..84fd3eeb38 100644
--- a/meta/classes/core-image.bbclass
+++ b/meta/classes/core-image.bbclass
@@ -31,6 +31,8 @@
 #   - post-install-logging
 # - dev-pkgs            - development packages (headers, etc.) for all installed packages in the rootfs
 # - dbg-pkgs            - debug symbol packages for all installed packages in the rootfs
+# - lic-pkgs            - license packages for all installed pacakges in the rootfs, requires
+#                         LICENSE_CREATE_PACKAGE="1" to be set when building packages too
 # - doc-pkgs            - documentation packages for all installed packages in the rootfs
 # - bash-completion-pkgs - bash-completion packages for recipes using bash-completion bbclass
 # - ptest-pkgs          - ptest packages for all ptest-enabled recipes
diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass
index 73cebb4d55..5dbec288a4 100644
--- a/meta/classes/license_image.bbclass
+++ b/meta/classes/license_image.bbclass
@@ -1,5 +1,15 @@
 ROOTFS_LICENSE_DIR = "${IMAGE_ROOTFS}/usr/share/common-licenses"
 
+# This requires LICENSE_CREATE_PACKAGE=1 to work too
+COMPLEMENTARY_GLOB[lic-pkgs] = "*-lic"
+
+python() {
+    if not oe.data.typed_value('LICENSE_CREATE_PACKAGE', d):
+        features = set(oe.data.typed_value('IMAGE_FEATURES', d))
+        if 'lic-pkgs' in features:
+            bb.error("'lic-pkgs' in IMAGE_FEATURES but LICENSE_CREATE_PACKAGE not enabled to generate -lic packages")
+}
+
 python write_package_manifest() {
     # Get list of installed packages
     license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}')
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-12 15:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 15:35 [PATCH] licence_image: Add lic-pkgs IMAGE_FEATURE Mike Crowe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.