Is ./meta/lib/oeqa/selftest/cases/package.py the right place?
If yes i can work on it. Note that this functionality is not used
anywhere in poky and is not documented at all. It just happened to
exist for a long time and be useful for my case.

On Fri, May 22, 2020 at 5:22 PM Alexander Kanavin
<[email protected]> wrote:
>
> Should there be a test for this functionality? Somewhere in oe-selftest 
> perhaps where various package manager features are tested?
>
> Alex
>
> On Fri, 22 May 2020 at 17:13, Paulo Neve <[email protected]> wrote:
>>
>> Up to now the user defined metadata was set recipe wide,
>> meaning all the packages generated in a recipe where the
>> variable was set would get the same metadata. That is not
>> always ideal and is counter to the per package control that
>> is usually available.
>>
>> Keep support for package agnostic metadata but also add option
>> to add it to a specific option like:
>> PACKAGE_ADD_METADATA_${PN}_IPK = "mymeta: myvalue"
>>
>> Signed-off-by: Paulo Neves <[email protected]>
>> ---
>>  meta/classes/package.bbclass     | 4 ++--
>>  meta/classes/package_deb.bbclass | 2 +-
>>  meta/classes/package_ipk.bbclass | 2 +-
>>  meta/classes/package_rpm.bbclass | 5 +++--
>>  4 files changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
>> index 0b5cf47749..1678e0d794 100644
>> --- a/meta/classes/package.bbclass
>> +++ b/meta/classes/package.bbclass
>> @@ -637,9 +637,9 @@ def get_package_mapping (pkg, basepkg, d, 
>> depversions=None):
>>
>>      return pkg
>>
>> -def get_package_additional_metadata (pkg_type, d):
>> +def get_package_additional_metadata (pkg_type, pkg_name, d):
>>      base_key = "PACKAGE_ADD_METADATA"
>> -    for key in ("%s_%s" % (base_key, pkg_type.upper()), base_key):
>> +    for key in ("%s_%s" % (base_key, pkg_type.upper()), "%s_%s_%s" % 
>> (base_key, pkg_name, pkg_type.upper()), base_key):
>>          if d.getVar(key, False) is None:
>>              continue
>>          d.setVarFlag(key, "type", "list")
>> diff --git a/meta/classes/package_deb.bbclass 
>> b/meta/classes/package_deb.bbclass
>> index 790b26aef2..6ef9c8cb3a 100644
>> --- a/meta/classes/package_deb.bbclass
>> +++ b/meta/classes/package_deb.bbclass
>> @@ -167,7 +167,7 @@ def deb_write_pkg(pkg, d):
>>
>>          # more fields
>>
>> -        custom_fields_chunk = get_package_additional_metadata("deb", 
>> localdata)
>> +        custom_fields_chunk = get_package_additional_metadata("deb", 
>> pkgname, localdata)
>>          if custom_fields_chunk:
>>              ctrlfile.write(custom_fields_chunk)
>>              ctrlfile.write("\n")
>> diff --git a/meta/classes/package_ipk.bbclass 
>> b/meta/classes/package_ipk.bbclass
>> index c008559e4a..f78cec7a70 100644
>> --- a/meta/classes/package_ipk.bbclass
>> +++ b/meta/classes/package_ipk.bbclass
>> @@ -155,7 +155,7 @@ def ipk_write_pkg(pkg, d):
>>              else:
>>                  ctrlfile.write(c % tuple(pullData(fs, localdata)))
>>
>> -        custom_fields_chunk = get_package_additional_metadata("ipk", 
>> localdata)
>> +        custom_fields_chunk = get_package_additional_metadata("ipk", 
>> pkgname, localdata)
>>          if custom_fields_chunk is not None:
>>              ctrlfile.write(custom_fields_chunk)
>>              ctrlfile.write("\n")
>> diff --git a/meta/classes/package_rpm.bbclass 
>> b/meta/classes/package_rpm.bbclass
>> index 9145717f98..ab019192da 100644
>> --- a/meta/classes/package_rpm.bbclass
>> +++ b/meta/classes/package_rpm.bbclass
>> @@ -295,7 +295,6 @@ python write_specfile () {
>>      srcmaintainer  = d.getVar('MAINTAINER')
>>      srchomepage    = d.getVar('HOMEPAGE')
>>      srcdescription = d.getVar('DESCRIPTION') or "."
>> -    srccustomtagschunk = get_package_additional_metadata("rpm", d)
>>
>>      srcdepends     = d.getVar('DEPENDS')
>>      srcrdepends    = []
>> @@ -333,6 +332,8 @@ python write_specfile () {
>>          pkgname = localdata.getVar('PKG_%s' % pkg)
>>          if not pkgname:
>>              pkgname = pkg
>> +
>> +        srccustomtagschunk = get_package_additional_metadata("rpm", 
>> pkgname, d)
>>          localdata.setVar('PKG', pkgname)
>>
>>          localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + 
>> pkg)
>> @@ -351,7 +352,7 @@ python write_specfile () {
>>          splitlicense = (localdata.getVar('LICENSE') or "")
>>          splitsection = (localdata.getVar('SECTION') or "")
>>          splitdescription = (localdata.getVar('DESCRIPTION') or ".")
>> -        splitcustomtagschunk = get_package_additional_metadata("rpm", 
>> localdata)
>> +        splitcustomtagschunk = get_package_additional_metadata("rpm", 
>> pkgname, localdata)
>>
>>          translate_vers('RDEPENDS', localdata)
>>          translate_vers('RRECOMMENDS', localdata)
>> --
>> 2.20.1
>>
>> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#138601): 
https://lists.openembedded.org/g/openembedded-core/message/138601
Mute This Topic: https://lists.openembedded.org/mt/74401146/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to