Skip to contentSkip to conversation

buildhistory.bbclass: Add license declaration to packages and recipes

PATCH In review [email protected] 2 participants 2 messages Mar 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 buildhistory.bbclass: Add license declaration to packages and recipes

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.

---
 meta/classes/buildhistory.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)
meta/classes/buildhistory.bbclass +8 -0
index 3a5bc2c3e3..f6525dfd72 100644
@@ -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
         #
         # 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

#1 lore raw
Quoted 3 lines · On 1 March 2017 at 13:21, <[email protected]> wrote:
     pr = d.getVar('PR', True)

+ license = d.getVar('LICENSE', True)

Can you rebase this to master please? We dropped the use of True/False in general some time ago and this patch doesn't apply cleanly anymore.

Ross