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

Submitted by Leonid Borisenko on Nov. 16, 2012, 6:29 p.m. | Patch ID: 39181


Message ID 1353090566-16318-2-git-send-email-ive.found@gmail.com
State New
Headers show

Commit Message

Leonid Borisenko Nov. 16, 2012, 6:29 p.m.
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 <ive.found@gmail.com>
 meta/classes/package.bbclass |   11 +++++++++++
 1 file changed, 11 insertions(+)

Patch hide | download patch | download mbox

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 15e505d..6398edf 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -372,6 +372,17 @@  def get_package_mapping (pkg, 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 oe.data.typed_value(key, d)]
+        return "\n".join(metadata_fields).strip()
 def runtime_mapping_rename (varname, d):
     #bb.note("%s before: %s" % (varname, d.getVar(varname, True)))