Bug 6765

Summary: COPY_LIC_MANIFEST and COPY_LIC_DIRS doesn't take INCOMPATIBLE_LICENSE into account
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Jonathan Liu <net147>
Component: deploymentAssignee: Aníbal Limón <anibal.limon>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: bluelightning, kergoth, sgw
Version: 1.6   
Target Milestone: 1.9 M1   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
Added support for handle OR's and INCOMPATIBLE_LICENSE
none
License Manifest Python
none
License Manifest Shell
none
License Manifest Diff
none
Local Conf
none
License Manifest Test Results none

Description Jonathan Liu 2014-09-26 02:15:10 UTC
The license directory and license.manifest does not exclude licenses matching those specified INCOMPATIBLE_LICENSE.
Comment 1 Paul Eggleton 2014-10-02 14:36:43 UTC
Jonathan, can you explain what you're looking for here, and perhaps give an example of where the current code is behaving incorrectly? I'm cautious about the idea of filtering out any licenses at this point in case incompatibly-licensed packages somehow haven't already been filtered out at an earlier stage.
Comment 2 Jonathan Liu 2014-10-02 14:45:25 UTC
The qt4 recipe for example has LICENSE set to "LGPLv2.1 | GPLv3". Now, if you don't want any GPLv3 licensing you add GPLv3 to INCOMPATIBLE_LICENSE. The license directory and license manifest should only include the LGPLv2.1 license for this recipe to indicate that you have selected the LGPLv2.1 license instead.

A recipe may also have different groups of licenses separated by | operators so it should probably filter out the groups of licenses that INCOMPATIBLE_LICENSE would match.
Comment 3 Paul Eggleton 2014-10-02 14:55:58 UTC
OK, so the filtering would need to be done in such a way that it understood the expression. Coincidentally Chris Larson brought up this situation on IRC just yesterday (adding him to CC).
Comment 4 Aníbal Limón 2014-10-02 15:07:49 UTC
Jonathan,

For example in the qt4 recipe that have LICENSE set to "LGPLv2.1 | GPLv3" if you don't have INCOMPATIBLE_LICENSE set what is expected? 

license.manifest with LICENSE set LGPLv2.1 | GPLv3 and copy the two licenses?
Comment 5 Jonathan Liu 2014-10-02 15:15:34 UTC
Yes.
Comment 6 Aníbal Limón 2014-10-02 20:07:49 UTC
Jhonatan,

I'm reviewing the oe.license module it have a function named flattened_licenses that is used in early recipe parsing phase.

Eval's OR's with your own choose function but for example if you have LICENSE set (GPLv2 | GPLv3 | MPL)  & LGPLv2.1 and INCOMPATIBLE_LICENSE set to GPLv3 the result is the next GPLv2 & LGPLv2.1.

That's is the expected behaviour?
Comment 7 Christopher Larson 2014-10-02 20:15:29 UTC
https://gist.github.com/kergoth/1590028 isn't directly related, but it's a mechanism to let a distro specify their preferences for which licenses they prefer when there are alternatives. The intent was to take it and use it for incompatible license handling, packaging, manifest, etc.
Comment 8 Aníbal Limón 2014-10-02 21:16:29 UTC
Created attachment 2160 [details]
Added support for handle OR's and
 INCOMPATIBLE_LICENSE
Comment 9 Aníbal Limón 2014-10-02 21:24:35 UTC
I re-implemented license_create_manifest from shell to python in order to use oe.license module.

This implementation didn't take into account LICENSE_PRIORITY only INCOMPATIBLE_LICENSE.

One issue that i found is if you have different licenses grouped by OR only one of them is applied, for example (GPLv2 | GPLv3 | MPL) this result into GPLv2, regardless of the INCOMPATIBLE_LICENSE, that's ok?

I think we can use the Christopher code for handle priorities but this is another feature.

Comments?
Comment 10 Aníbal Limón 2014-10-02 21:29:43 UTC
Created attachment 2161 [details]
License Manifest Python
Comment 11 Christopher Larson 2014-10-02 21:29:56 UTC
Agreed, it was more an example. It is a bit of a concern that only one of the 3 alternates is selected, mainly because lacking the priority mechanism, its arbitrary and undefined which of the other two alternates is selected.
Comment 12 Aníbal Limón 2014-10-02 21:32:02 UTC
Created attachment 2162 [details]
License Manifest Shell
Comment 13 Aníbal Limón 2014-10-02 21:32:32 UTC
Created attachment 2163 [details]
License Manifest Diff
Comment 14 Aníbal Limón 2014-10-02 21:33:30 UTC
Created attachment 2164 [details]
Local Conf
Comment 15 Aníbal Limón 2014-10-02 21:39:46 UTC
Christopher,

Sure for now the first LICENSE have major weight if not is in INCOMPATIBLE_LICENSE.
Comment 16 Aníbal Limón 2015-03-14 18:46:06 UTC
Created attachment 2443 [details]
License Manifest Test Results
Comment 17 Aníbal Limón 2015-05-05 16:14:58 UTC
Rebase needed.