Patchwork [1/2] package.bbclass: add getter of additional metadata

mail settings
Submitter Martin Jansa
Date Jan. 18, 2014, 2:01 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/65171/
State Accepted
Commit 98ea2fc35a3ef609a944929e21e0f9be2889036d
Headers show


Martin Jansa - Jan. 18, 2014, 2:01 p.m.
From: Leonid Borisenko <>

Two variables are searched for value of additional package metadata:


First found variable with defined value wins.

<PKGTYPE> is a parameter of getter and expected to be a distinct name
of specific package type. For example: 'DEB' or 'RPM'.

Variable can contain multiple [one-line] metadata fields, separated by
literal sequence '\n'. Separator can be redefined through variable flag
'separator'. Getter returns found value with separator replaced with
newline character.

As side-effect, searched variables acquired flags 'type' (equals to
'list') and 'separator'.

Signed-off-by: Leonid Borisenko <>
Signed-off-by: Martin Jansa <>
 meta/classes/package.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)


diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 768047c..561800a 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -363,6 +363,17 @@  def get_package_mapping (pkg, basepkg, d):
     return pkg
+def get_package_additional_metadata (pkg_type, d):
+    base_key = "PACKAGE_ADD_METADATA"
+    for key in ("%s_%s" % (base_key, pkg_type.upper()), base_key):
+        if d.getVar(key) is None:
+            continue
+        d.setVarFlag(key, "type", "list")
+        if d.getVarFlag(key, "separator") is None:
+            d.setVarFlag(key, "separator", "\\n")
+        metadata_fields = [field.strip() for field in, d)]
+        return "\n".join(metadata_fields).strip()
 def runtime_mapping_rename (varname, pkg, d):
     #bb.note("%s before: %s" % (varname, d.getVar(varname, True)))