Skip to contentSkip to conversation

buildhistory.bbclass: Add license declaration to packages and recipes

PATCH Superseded [email protected] 2 participants 2 messages Feb 28, 2017 – Mar 1, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

Upstream-status: Submitted

---
 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

Hello Hugo,

Quoted 6 lines · On Tue, 28 Feb 2017 09:51:00 +0000 <[email protected]> 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.

Quoted 43 lines
---
 meta/classes/buildhistory.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)
meta/classes/buildhistory.bbclass +4 -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)

meta/classes/buildhistory.bbclass python buildhistory_emit_pkghistory() { · line 248

Quoted 4 lines
meta/classes/buildhistory.bbclass +1 -0
@@ -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

Quoted 29 lines
meta/classes/buildhistory.bbclass +3 -1
         #
         # 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