Skip to content

[FEATURE] SPDX License factory #304

Closed

Activity

  1. added
    enhancement
    on Sep 12, 2022
  2. self-assigned this
    on Sep 12, 2022
  3. jkowalleck commented on Sep 12, 2022

    @jkowalleck
    MemberAuthor

    will prepare a POC for discussion

    this would lead to a v2 implementation in module(file) cyclonedx/factory/license.py
    and a forward-port to v3

  4. Jonas-vdb commented on Sep 12, 2022

    @Jonas-vdb

    Will there be an option to force a specific license model? e.g. Dependency Track does not support expressions yet so even if the string is actually an expression, forcing it to a named license would at least make it visible in Dependency Track (knowing that the matching will not work).

  5. jkowalleck commented on Sep 12, 2022

    @jkowalleck
    MemberAuthor

    good point. the factory should be supporting both

    • string -> Expression|Named|SPDX|None
    • string -> Named|SPDX|None

    the later one is the thing that is required, so that an implementation in the https://github.com/CycloneDX/cyclonedx-python/ should be a one-liner, then.

  6. Jonas-vdb commented on Sep 12, 2022

    @Jonas-vdb

    I'm curious to see how it will determine what the return type should be.

    Examples of licenses which are currently present in the BOM we use:

    • BSD-like: Not an Expression, not a valid SPDX Identifier so it would be Named?
    • MIT: Not an Expression but it is a valid SPDX identifier
    • BSD-2-Clause or Apache-2.0: Expression
  7. jkowalleck commented on Sep 12, 2022

    @jkowalleck
    MemberAuthor

    re: #304 (comment)

    the source of SPDX is different, but the rest is basically correc.
    just see the JS and PHP implementations linked above as a reference point.

    a best-effort detection:

    • if value starts with ( and ends with ) => probably an expression -> return license expression
      • i asked the SPDX people if they had a regex for the expression - even they do not have one, so we need to go with best-effort detection.
    • else if: lower-cased value is a known/supported SPDX license => return license with id
    • else: return license with name

    implementation will be good-enough for now and can be seen as a ground for improvements later.

    see #305

  8. Jonas-vdb commented on Sep 13, 2022

    @Jonas-vdb

    Note: identifying an expression with brackets will not always work.

    Example of license expression without brackets:

    ('License', 'BSD-2-Clause or Apache-2.0')

    image

  9. jkowalleck commented on Sep 13, 2022

    @jkowalleck
    MemberAuthor

    i am providing a best-effort-implementation - as a ground for improvements.
    after i am done with this, you are free to make the SPDX expression detection better.

  10. changed the title [-]license factory[/-] [+][FEATURE] SPDX License factory[/+] on Sep 15, 2022
  11. added a commit that references this issue on Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions