From 773d7352309241e15ef5acadcbe416bdd7d45c18 Mon Sep 17 00:00:00 2001 From: Leonid Borisenko Date: Fri, 16 Nov 2012 18:29:26 +0000 Subject: package_{ipk, deb, rpm}.bbclass: support additional user-defined metadata Additional metadata from user-defined variable is written into control/spec file of binary package. Three variables are searched for adiitional package metadata: * PACKAGE_ADD_METADATA__ * PACKAGE_ADD_METADATA_ * PACKAGE_ADD_METADATA First found variable with defined value wins. is a package name. is a distinct name of specific package type: * IPK for .ipk packages * DEB for .deb packages * RPM for .rpm packages Variable can contain multiple [one-line] metadata fields separated by literal sequence '\n'. Separator can be redefined through variable flag 'separator'. In package control/spec file separator is replaced by newline character. Signed-off-by: Leonid Borisenko Signed-off-by: Martin Jansa Signed-off-by: Saul Wold --- meta/classes/package_deb.bbclass | 5 +++++ meta/classes/package_ipk.bbclass | 5 +++++ meta/classes/package_rpm.bbclass | 7 +++++++ 3 files changed, 17 insertions(+) (limited to 'meta') diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass index 82ff432f71..5d316aa8b2 100644 --- a/meta/classes/package_deb.bbclass +++ b/meta/classes/package_deb.bbclass @@ -318,6 +318,11 @@ python do_package_deb () { raise bb.build.FuncFailed("Missing field for deb generation: %s" % value) # more fields + custom_fields_chunk = get_package_additional_metadata("deb", localdata) + if custom_fields_chunk is not None: + ctrlfile.write(unicode(custom_fields_chunk)) + ctrlfile.write("\n") + mapping_rename_hook(localdata) def debian_cmp_remap(var): diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index e7b275577a..2d8e459b31 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass @@ -331,6 +331,11 @@ python do_package_ipk () { raise bb.build.FuncFailed("Missing field for ipk generation: %s" % value) # more fields + custom_fields_chunk = get_package_additional_metadata("ipk", localdata) + if custom_fields_chunk is not None: + ctrlfile.write(custom_fields_chunk) + ctrlfile.write("\n") + mapping_rename_hook(localdata) def debian_cmp_remap(var): diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index acbb18d686..2d193b7465 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass @@ -737,6 +737,7 @@ python write_specfile () { srcmaintainer = d.getVar('MAINTAINER', True) srchomepage = d.getVar('HOMEPAGE', True) srcdescription = d.getVar('DESCRIPTION', True) or "." + srccustomtagschunk = get_package_additional_metadata("rpm", d) srcdepends = strip_multilib_deps(d.getVar('DEPENDS', True), d) srcrdepends = [] @@ -790,6 +791,7 @@ python write_specfile () { splitlicense = (localdata.getVar('LICENSE', True) or "") splitsection = (localdata.getVar('SECTION', True) or "") splitdescription = (localdata.getVar('DESCRIPTION', True) or ".") + splitcustomtagschunk = get_package_additional_metadata("rpm", localdata) translate_vers('RDEPENDS', localdata) translate_vers('RRECOMMENDS', localdata) @@ -863,6 +865,9 @@ python write_specfile () { spec_preamble_bottom.append('License: %s' % splitlicense) spec_preamble_bottom.append('Group: %s' % splitsection) + if srccustomtagschunk != splitcustomtagschunk: + spec_preamble_bottom.append(splitcustomtagschunk) + # Replaces == Obsoletes && Provides robsoletes = bb.utils.explode_dep_versions2(splitrobsoletes or "") rprovides = bb.utils.explode_dep_versions2(splitrprovides or "") @@ -965,6 +970,8 @@ python write_specfile () { spec_preamble_top.append('Group: %s' % srcsection) spec_preamble_top.append('Packager: %s' % srcmaintainer) spec_preamble_top.append('URL: %s' % srchomepage) + if srccustomtagschunk: + spec_preamble_top.append(srccustomtagschunk) tail_source(d) # Replaces == Obsoletes && Provides -- cgit v1.2.3