Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Leonid Borisenko <ive.found@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 1/2] package.bbclass: add getter of additional metadata
Date: Sun, 13 May 2012 16:28:41 +0300	[thread overview]
Message-ID: <1336915722-8155-2-git-send-email-ive.found@gmail.com> (raw)
In-Reply-To: <1336915722-8155-1-git-send-email-ive.found@gmail.com>

Two variables are searched for value of additional package metadata:

  * PACKAGE_ADD_METADATA_<PKGTYPE>
  * PACKAGE_ADD_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(+)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 99836e9..a40476c 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -326,6 +326,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)))	
 
-- 
1.7.10




  reply	other threads:[~2012-05-13 13:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-13 13:28 [PATCH 0/3] Support additional user-defined package metadata Leonid Borisenko
2012-05-13 13:28 ` Leonid Borisenko [this message]
2012-05-13 13:28 ` [PATCH 2/2] package_{ipk, deb, rpm}.bbclass: support additional user-defined metadata Leonid Borisenko
2012-05-18 18:34 ` [PATCH 0/3] Support additional user-defined package metadata Ive Found
2012-05-28  6:40 ` [PING v2] [PATCH 0/2] " Ive Found
2012-05-28  9:44 ` [PATCH 0/3] " Phil Blundell
2012-05-28 18:46   ` Ive Found
2012-06-06  7:28 ` [PING v3] [PATCH 0/2] " Ive Found
2012-11-03 23:01   ` Sebastian Krzyszkowiak
2012-11-06 23:58     ` Otavio Salvador
2012-11-16 18:29       ` [PATCH v2 0/2] Support additional user-defined metadata Leonid Borisenko
2012-11-16 18:29         ` [PATCH v2 1/2] package.bbclass: add getter of additional metadata Leonid Borisenko
2012-11-16 18:29         ` [PATCH v2 2/2] package_{ipk, deb, rpm}.bbclass: support additional user-defined metadata Leonid Borisenko
2012-12-07 17:28         ` [PING] [PATCH v2] Support " Leonid Borisenko
  -- strict thread matches above, loose matches on Subject: below --
2014-01-18 14:01 [PATCH 0/2] allow to define additional packaging metadata Martin Jansa
2014-01-18 14:01 ` [PATCH 1/2] package.bbclass: add getter of additional metadata Martin Jansa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1336915722-8155-2-git-send-email-ive.found@gmail.com \
    --to=ive.found@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox