Skip to contentSkip to conversation

license.bbclass: do not process LICENSE_pn variables

PATCH Superseded Markus Lehtonen 3 participants 4 messages May 27, 2016 – May 30, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 license.bbclass: do not process LICENSE_pn variables

The loop iterating over LICENSE_pn variables has never worked. In addition, the LICENSE variable is supposed to contain all licenses defined in LICENSE_pn variables. Thus, it is simpler just to use LICENSE as the data we get is essentially the same.

[YOCTO #9499]

---
 meta/classes/license.bbclass | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
meta/classes/license.bbclass +1 -15
index 69335d6..eacf9e8 100644
@@ -376,20 +376,6 @@ def find_license_files(d):
     import shutil
     import oe.license
 
-    pn = d.getVar('PN', True)
-    for package in d.getVar('PACKAGES', True):
-        if d.getVar('LICENSE_' + package, True):
-            license_types = license_types + ' & ' + \
-                            d.getVar('LICENSE_' + package, True)
-
-    #If we get here with no license types, then that means we have a recipe 
-    #level license. If so, we grab only those.
-    try:
-        license_types
-    except NameError:        
-        # All the license types at the recipe level
-        license_types = d.getVar('LICENSE', True)
- 
     # All the license files for the package
     lic_files = d.getVar('LIC_FILES_CHKSUM', True)
     pn = d.getVar('PN', True)
@@ -487,7 +473,7 @@ def find_license_files(d):
 
     v = FindVisitor()
     try:
-        v.visit_string(license_types)
+        v.visit_string(d.getVar('LICENSE', True))
     except oe.license.InvalidLicense as exc:
         bb.fatal('%s: %s' % (d.getVar('PF', True), exc))
     except SyntaxError:
Signature · 1 line
2.6.6
#1 lore raw
Quoted 3 lines · Markus Lehtonen

The loop iterating over LICENSE_pn variables has never worked. In addition, the LICENSE variable is supposed to contain all licenses defined in LICENSE_pn variables.

Is this really true?

I've seen couple examples where LICENSE variable is used as a "default" for most packages, and then only 1 package sets different LICENSE_pn.

Changing the semantics as you said would force people to define LICENSE_pn-dev
LICENSE_pn-staticdev
LICENSE_pn
LICENSE_pn-dbg
to foo when they have just one file in LICENSE_pn-blah
which containd unwanted LICENSE bar

And then overall license will be "foo & bar"

There are real-world examples where there is one GPLv3 shell script we don't even need in LGPLv2 component - for now it was simple to move this script to separate package and set just LICENSE_pn-blah-script

Quoted 52 lines

Thus, it is simpler just to use LICENSE
as the data we get is essentially the same.

[YOCTO #9499]

---
 meta/classes/license.bbclass | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
meta/classes/license.bbclass +1 -15
index 69335d6..eacf9e8 100644
@@ -376,20 +376,6 @@ def find_license_files(d):
     import shutil
     import oe.license
 
-    pn = d.getVar('PN', True)
-    for package in d.getVar('PACKAGES', True):
-        if d.getVar('LICENSE_' + package, True):
-            license_types = license_types + ' & ' + \
-                            d.getVar('LICENSE_' + package, True)
-
-    #If we get here with no license types, then that means we have a recipe 
-    #level license. If so, we grab only those.
-    try:
-        license_types
-    except NameError:        
-        # All the license types at the recipe level
-        license_types = d.getVar('LICENSE', True)
- 
     # All the license files for the package
     lic_files = d.getVar('LIC_FILES_CHKSUM', True)
     pn = d.getVar('PN', True)
@@ -487,7 +473,7 @@ def find_license_files(d):
 
     v = FindVisitor()
     try:
-        v.visit_string(license_types)
+        v.visit_string(d.getVar('LICENSE', True))
     except oe.license.InvalidLicense as exc:
         bb.fatal('%s: %s' % (d.getVar('PF', True), exc))
     except SyntaxError:
Signature · 7 lines
2.6.6

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#2 lore raw

Hi Martin,

Quoted 6 lines · Martin Jansa
Quoted 3 lines · Markus Lehtonen

The loop iterating over LICENSE_pn variables has never worked. In addition, the LICENSE variable is supposed to contain all licenses defined in LICENSE_pn variables.

Is this really true?

That's what I've been told: LICENSE is supposed to contain all licenses and LICENSE_pn can be used to refine on per-package basis. But, that said, I don't know if that has actually been documented anywhere except perhaps in the bitbake manual which states that LICENSE is "The list of source licenses for the recipe".

Quoted 13 lines

I've seen couple examples where LICENSE variable is used as a "default"
for most packages, and then only 1 package sets different LICENSE_pn.

Changing the semantics as you said would force people to define LICENSE_pn-dev
LICENSE_pn-staticdev
LICENSE_pn
LICENSE_pn-dbg
to foo when they have just one file in LICENSE_pn-blah
which containd unwanted LICENSE bar

Quoted 7 lines

And then overall license will be "foo & bar"

There are real-world examples where there is one GPLv3 shell script we
don't even need in LGPLv2 component - for now it was simple to move this
script to separate package and set just LICENSE_pn-blah-script

Do you have any specific examples of packages like this? My current understanding is that they use LICENSE and LICENSE_pn incorrectly, but I might well be wrong. Also, I don't know if all the license checking correctly applies to LICENSE_pn variables. In any case, I see you point, it would be very convenient to have this "default binary license".

Whatever the outcome is, it probably would be good to add a sanity checker for the usage if LICENSE* variables inside a recipe.

Thanks,
Markus

Quoted 55 lines
Quoted 54 lines

Thus, it is simpler just to use LICENSE
as the data we get is essentially the same.

[YOCTO #9499]

---
 meta/classes/license.bbclass | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
meta/classes/license.bbclass +0 -7
index 69335d6..eacf9e8 100644
@@ -376,20 +376,6 @@ def find_license_files(d):
     import shutil
     import oe.license
 
-    pn = d.getVar('PN', True)
-    for package in d.getVar('PACKAGES', True):
-        if d.getVar('LICENSE_' + package, True):
-            license_types = license_types + ' & ' + \
-                            d.getVar('LICENSE_' + package, True)
-
-    #If we get here with no license types, then that means we have

a recipe

meta/classes/license.bbclass +1 -8
-    #level license. If so, we grab only those.
-    try:
-        license_types
-    except NameError:        
-        # All the license types at the recipe level
-        license_types = d.getVar('LICENSE', True)
- 
     # All the license files for the package
     lic_files = d.getVar('LIC_FILES_CHKSUM', True)
     pn = d.getVar('PN', True)
@@ -487,7 +473,7 @@ def find_license_files(d):
 
     v = FindVisitor()
     try:
-        v.visit_string(license_types)
+        v.visit_string(d.getVar('LICENSE', True))
     except oe.license.InvalidLicense as exc:
         bb.fatal('%s: %s' % (d.getVar('PF', True), exc))
     except SyntaxError:
Signature · 7 lines
2.6.6

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
#3 lore raw
Quoted 8 lines · On Mon, 30 May 2016 14:26:30 Markus Lehtonen wrote:

Hi Martin,

Quoted 5 lines · Martin Jansa
Quoted 3 lines · Markus Lehtonen

The loop iterating over LICENSE_pn variables has never worked. In addition, the LICENSE variable is supposed to contain all licenses defined in LICENSE_pn variables.

Quoted 7 lines
Quoted 1 line

Is this really true?

That's what I've been told: LICENSE is supposed to contain all licenses and LICENSE_pn can be used to refine on per-package basis. But, that said, I don't know if that has actually been documented anywhere except perhaps in the bitbake manual which states that LICENSE is "The list of source licenses for the recipe".

AIUI, LICENSE is indeed supposed to contain all of the licenses; LICENSE_<package> then specifies it on a per package basis, but you're not supposed to specify anything in the latter that isn't also specified in the former.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre