Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report detected license expressions in ScanCode #74

Closed
pombredanne opened this issue Sep 17, 2015 · 6 comments
Closed

Report detected license expressions in ScanCode #74

pombredanne opened this issue Sep 17, 2015 · 6 comments

Comments

@pombredanne
Copy link
Member

Multiple licenses can be and are detected together when appropriate rules exist. However, even though we report these with the same detected start and end line and we know internally that they are detected together and we know if they are license choices or conjunctive licenses, we only report discrete and distinct licenses, and do not provide all these detection details.

We should return all the information that we detect, especially the interesting license choices, possibly as SPDX-style license expressions.

This is especially relevant for multiple choices that exists in Qt and similar (see #73)

@pombredanne
Copy link
Member Author

The reporting as a license expression should be a rather straightforward addition to the license detection, since we have already all the data when we match a license RULE.
The logic will be the following: Once we have matched a text region (start/end lines) to a detection rule:

  • if there is more than one license in the rule, create a license expression:
    • if the rule is a license_choice: yes, create this expression as joining with an OR all the rules licenses
    • else, create this expression as joining with an AND

At a later stage, we can replace the list of licenses in all rules (with a one time migration script) by a plain license expression and then support more complex expressions such as (XXXX with YYY-exception) or ZZZZ

At a high level, the key thing to understand is that we already match to "expression-like" rules
we just do not expose that info in the scan reports.

@pombredanne
Copy link
Member Author

The latest https://github.com/nexB/license-expression/releases/tag/v0.6 now fully supports expressions "with exceptions" and expressions using license names containing "or later". This is now good enough to be used and support the implementation of expression in ScanCode

pombredanne added a commit that referenced this issue Feb 26, 2017
 * this is a pre step towards support of license expressions
   The SPDX texts as published often contain additional notes and 
   other additions that make these unsuitable for use as a reference
   license text. We want to keep only one source of truth for that and 
   have clean texts that can also be readily usable in AttributeCode
   for license attribution generation. 

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue Feb 26, 2017
 * the rationale is that an exception can aplly to many different
   licenses and there is no way to enforce this sanely and consistently.
 * instead and to support fully license expression in #74 exceptions
   will be treated with a flag "is_exception" that tags them as
   exception. This can then be used by the license_expression library
   to enforce the validty of expressions thoughout.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue Feb 26, 2017
 * ensure that yml rule files have a proper name


Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue Feb 26, 2017
 * this is a pre step towards support of license expressions
   The SPDX texts as published often contain additional notes and 
   other additions that make these unsuitable for use as a reference
   license text. We want to keep only one source of truth for that and 
   have clean texts that can also be readily usable in AttributeCode
   for license attribution generation. 

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue Feb 26, 2017
 * the rationale is that an exception can aplly to many different
   licenses and there is no way to enforce this sanely and consistently.
 * instead and to support fully license expression in #74 exceptions
   will be treated with a flag "is_exception" that tags them as
   exception. This can then be used by the license_expression library
   to enforce the validty of expressions thoughout.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue Feb 26, 2017
 * ensure that yml rule files have a proper name


Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@pombredanne
Copy link
Member Author

pombredanne commented Feb 26, 2017

The new approach is this:

  • exception licenses will be flagged with an is_exception boolean tag. Note that there there is no consistent way to tell which license an exception may apply too all the times. It may be more than one possibility or not defined, hence why we only will use a flag.

  • licenses that are for this "or later" versions will be flagged with an is_or_later boolean tag. e.g. mpl-1.1 or gpl-2.0-plus will have this flag.

  • for an is_or_later license, the base_license field will point to the base license for this license. For instance gpl-2.0-plus will have base_license: gpl-2.0. But mpl-1.1 has no base version.

  • licenses that are versioned will have a next_version field that points to the license key of the next version when available. For instance gpl-2.0-plus will have next_version: gpl-3.0-plus and gpl-2.0 will have next_version: gpl-3.0 but gpl-3.0 will not have a next_version because there is no such thing yet. mpl-1.1 will have next_version: mpl-2.0

  • a new standard_notice field will be added to store the standard notice that may exist for some licenses such as Apache or A/L/GPL or MPL licenses and in particular to have the standard "or later" notice for the license keys that are for an "or later license"

  • Support for a preferred license version when there is an "or later" case would be something that would be added to a user config file at a later time with Add File-based user preferences and scan configuration #520

pombredanne added a commit that referenced this issue Feb 27, 2017
 * this is a pre step towards support of license expressions
   The SPDX texts as published often contain additional notes and 
   other additions that make these unsuitable for use as a reference
   license text. We want to keep only one source of truth for that and 
   have clean texts that can also be readily usable in AttributeCode
   for license attribution generation. 

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue Feb 27, 2017
 * the rationale is that an exception can aplly to many different
   licenses and there is no way to enforce this sanely and consistently.
 * instead and to support fully license expression in #74 exceptions
   will be treated with a flag "is_exception" that tags them as
   exception. This can then be used by the license_expression library
   to enforce the validty of expressions thoughout.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue Feb 27, 2017
 * ensure that yml rule files have a proper name


Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 2, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 2, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 2, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 2, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 2, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 2, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 2, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 2, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
 * Also allow to regen tests

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
 There was a bug when checking expression containment

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
 * use license_expression instead everywhere
 * streamline tests (remove negative tests that was useless and not
   working)

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 3, 2018
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 4, 2018
 create a proper language-specific record too

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 4, 2018
Add support for license expressions #74

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@pombredanne
Copy link
Member Author

The final implemented approach is this:

  • "exception" licenses are flagged with an is_exception boolean attribute.
  • a new standard_notice field has been added to store the standard notice that may exist for some licenses such as Apache or A/L/GPL or MPL licenses and in particular to have the standard "or later" notice for the license keys that are for an "or later license"

This simple and more than good enough.

Closing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant