[OE-core] [PATCH 1/1] buildhistory.bbclass: Add license declaration to packages and recipes

Andreas Oberritter obi at opendreambox.org
Wed Mar 1 12:44:45 UTC 2017


Hello Hugo,

On Tue, 28 Feb 2017 09:51:00 +0000
<Hugo.Jacob at bmw.de> wrote:

> Having the license declaration in the buildhistory is useful to track
> licenses changes, licenses going to a given image and etc. This change
> adds the license declaration for recipes and packages to its
> buildhistory data.
> 
> Upstream-status: Submitted

patches for metadata shouldn't contain Upstream-status tags.

> 
> Signed-off-by: Hugo Jacob <Hugo.Jacob at bmw.de>
> ---
>  meta/classes/buildhistory.bbclass | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> index 3a5bc2c3e3..f6525dfd72 100644
> --- a/meta/classes/buildhistory.bbclass
> +++ b/meta/classes/buildhistory.bbclass
> @@ -83,6 +83,7 @@ python buildhistory_emit_pkghistory() {
>              self.pe = "0"
>              self.pv = "0"
>              self.pr = "r0"
> +            self.license = ""
>              self.depends = ""
>              self.packages = ""
>              self.srcrev = ""
> @@ -94,6 +95,7 @@ python buildhistory_emit_pkghistory() {
>              self.pe = "0"
>              self.pv = "0"
>              self.pr = "r0"
> +            self.license = ""
>              # pkg/pkge/pkgv/pkgr should be empty because we want to be able to default them
>              self.pkg = ""
>              self.pkge = ""
> @@ -186,6 +188,7 @@ python buildhistory_emit_pkghistory() {
>      pe = d.getVar('PE', True) or "0"
>      pv = d.getVar('PV', True)
>      pr = d.getVar('PR', True)
> +    license = d.getVar('LICENSE', True)
> 
>      pkgdata_dir = d.getVar('PKGDATA_DIR', True)
>      packages = ""
> @@ -223,6 +226,7 @@ python buildhistory_emit_pkghistory() {
>      rcpinfo.pe = pe
>      rcpinfo.pv = pv
>      rcpinfo.pr = pr
> +    rcpinfo.license = license
>      rcpinfo.depends = sortlist(oe.utils.squashspaces(d.getVar('DEPENDS', True) or ""))
>      rcpinfo.packages = packages
>      write_recipehistory(rcpinfo, d)
> @@ -241,6 +245,7 @@ python buildhistory_emit_pkghistory() {
>          pkge = pkgdata.get('PKGE', '0')
>          pkgv = pkgdata['PKGV']
>          pkgr = pkgdata['PKGR']
> +        pkg_license = d.getVar('LICENSE_%s' % (pkg,), True) or license

Please use 'LICENSE_%s' % pkg.

Regards,
Andreas

>          #
>          # Find out what the last version was
>          # Make sure the version did not decrease
> @@ -261,6 +266,7 @@ python buildhistory_emit_pkghistory() {
>          pkginfo.pv = pkgdata['PV']
>          pkginfo.pr = pkgdata['PR']
>          pkginfo.pkg = pkgdata['PKG']
> +        pkginfo.license = pkg_license
>          pkginfo.pkge = pkge
>          pkginfo.pkgv = pkgv
>          pkginfo.pkgr = pkgr
> @@ -301,6 +307,7 @@ def write_recipehistory(rcpinfo, d):
>              f.write(u"PE = %s\n" %  rcpinfo.pe)
>          f.write(u"PV = %s\n" %  rcpinfo.pv)
>          f.write(u"PR = %s\n" %  rcpinfo.pr)
> +        f.write(u"LICENSE = %s\n" %  rcpinfo.license)
>          f.write(u"DEPENDS = %s\n" %  rcpinfo.depends)
>          f.write(u"PACKAGES = %s\n" %  rcpinfo.packages)
> 
> @@ -320,6 +327,7 @@ def write_pkghistory(pkginfo, d):
>              f.write(u"PE = %s\n" %  pkginfo.pe)
>          f.write(u"PV = %s\n" %  pkginfo.pv)
>          f.write(u"PR = %s\n" %  pkginfo.pr)
> +        f.write(u"LICENSE = %s\n" %  pkginfo.license)
> 
>          if pkginfo.pkg != pkginfo.name:
>              f.write(u"PKG = %s\n" % pkginfo.pkg)
> --
> 2.11.0




More information about the Openembedded-core mailing list