-
Notifications
You must be signed in to change notification settings - Fork 314
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
Add functionality to handle license choices #3396
Comments
Just a remark, such a file should be called |
Copied comment from Slack which contains info relevant for this topic: I would separate the discussions about (1) for which scope license choices should be configurable and (2) how it should be implemented. For (1) I believe we need (a) global license choices (e.g. in license-choices.yml), something like "Apache-2.0 OR MIT" always chose "Apache-2.0". The question is, should this also be applied to supexpressions automatically? (b) Per package license choices, because for some packages we might want to make a different choice. This should override global choices. This could be configured in curations.yml. (c) Per project license choices, because two different projects might want to make a different choice for the same library. This should be configurable in ort.yml and override (a) and (b). And maybe in ort.yml we also need to support global and per package choices to support all possible use cases. If we really want to implement all these options depends on how important we think the different use-cases are. (2) The logic that applies the license choice should be implemented in LicenseInfoResolver. The problem here is that the ResolvedLicenseInfo for a package does currently not provide an SPDX expression but simply a list of individual licenses as ResolvedLicense objects. (a) The first step would be to find out if there is a license choice to be able to provide a resolved license expression that uses the correct AND and OR operators in ResolvedLicense. Because if the model does not provide the information if there is a license choice, it does not make sense to implement a way to configure license choices. For this we can check if the declared license contains a license choice, and we could implement support for license choices detected by ScanCode. At least I was told that ScanCode would provide such information in the latest versions, but I have never verified that myself. Otherwise we have to assume that all detected licenses are concatenated by AND. (b) If we have solved (a) the implementation in LicenseInfoResolver should follow the principle to be completely transparent, that means the API must allow to check what the original SPDX expression was, which choices were applied, and what the resulting SPDX expression is. |
@mnonnenmacher It was my understanding that it should be applied to subexpressions automatically. This was also covered in this test: |
ScanCode 3.2.3 result for a file from h2database which is licensed under "matched_rule": {
"identifier": "mpl-2.0_or_epl-1.0_and_proprietary-license_2.RULE",
"license_expression": "(mpl-2.0 OR epl-1.0) AND proprietary-license",
"licenses": [
"mpl-2.0",
"epl-1.0",
"proprietary-license"
],
"is_license_text": false,
"is_license_notice": true,
"is_license_reference": false,
"is_license_tag": false,
"matcher": "3-seq",
"rule_length": 54,
"matched_length": 11,
"match_coverage": 20.37,
"rule_relevance": 100
} Edit: Same result with the already used ScanCode 3.2.1rc2 |
For the already discussed scope: Project specific for a specific package. We have multiple possibilities to design the configuration model for the (1) This design allows the user to set the absolute desired result license. - id: package-id
given: (A OR B) AND C
choice: A AND C (2) This design allows the user to set a choice with an optional sub-expression. The desired result license would be computed. Several choices can be given. - id: `package-id`
given: (A OR B) AND C
apply-choice:
- choice: A
sub-expression?: A OR B (3) This design allows the user to EITHER set the desired result license or to set optional sub-expressions with corresponding choices or both. - id: package-id
given: (A OR B) AND C
choice?: A AND C
sub-expressions?:
- expression: A OR B
choice: A Design (1) would not be possible when applying the license choice without a specific package and would therefore result in a different configuration model. @fviernau, @mnonnenmacher, @sschuberth |
We looked at our use case again. When different (4) The design allows for one package identifier to get several choices that can have sub-expressions. These choices can be applied to declared, detected and concluded, which can have different - id: package-id
choices:
- given: (A OR B) AND C
choice: A
sub-expressions?: A OR B
- given: (A OR B) AND C
choice: A AND C
- given: (D OR F)
choice: D What do you think? |
Apply license choices specified for a package defined in the repository configuration file. The choice reflects in the ResolvedLicense where only the chosen licenses get added to the final list of resolved licenses. The information of the non-chosen license is not lost as it is still present in the `originalLicenseExpressions`. Relates to oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <stephanie.neubauer@bosch.io> Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Apply license choices specified for a package defined in the repository configuration file. The choice reflects in the ResolvedLicense where only the chosen licenses get added to the final list of resolved licenses. The information of the non-chosen license is not lost as it is still present in the `originalLicenseExpressions`. Relates to oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <stephanie.neubauer@bosch.io> Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Apply license choices specified for a package defined in the repository configuration file. The choice reflects in the ResolvedLicense where only the chosen licenses get added to the final list of resolved licenses. The information of the non-chosen license is not lost as it is still present in the `originalLicenseExpressions`. Relates to oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <stephanie.neubauer@bosch.io> Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Apply license choices specified for a package defined in the repository configuration file. The choice reflects in the ResolvedLicense where only the chosen licenses get added to the final list of resolved licenses. The information of the non-chosen license is not lost as it is still present in the `originalLicenseExpressions`. Relates to oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <stephanie.neubauer@bosch.io> Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Apply license choices specified for a package defined in the repository configuration file. The choice reflects in the ResolvedLicense where only the chosen licenses get added to the final list of resolved licenses. The information of the non-chosen license is not lost as it is still present in the `originalLicenseExpressions`. Relates to oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <stephanie.neubauer@bosch.io> Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Opened a PR for the suggestion by @neubs-bsi |
Apply license choices specified for a package defined in the repository configuration file. The choice reflects in the ResolvedLicense where only the chosen licenses get added to the final list of resolved licenses. The information of the non-chosen license is not lost as it is still present in the `originalLicenseExpressions`. Relates to oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <stephanie.neubauer@bosch.io> Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Apply license choices specified for a package defined in the repository configuration file. The choice reflects in the ResolvedLicense where only the chosen licenses get added to the final list of resolved licenses. The information of the non-chosen license is not lost as it is still present in the `originalLicenseExpressions`. Relates to oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <stephanie.neubauer@bosch.io> Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Apply license choices specified for a package defined in the repository configuration file. The choice reflects in the ResolvedLicense where only the chosen licenses get added to the final list of resolved licenses. The information of the non-chosen license is not lost as it is still present in the `originalLicenseExpressions`. Relates to oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <stephanie.neubauer@bosch.io> Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Resolves oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <Stephanie.Neubauer@bosch.io>
Resolves oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <Stephanie.Neubauer@bosch.io>
Resolves oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <Stephanie.Neubauer@bosch.io>
Resolves oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <Stephanie.Neubauer@bosch.io>
Resolves oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <Stephanie.Neubauer@bosch.io>
Resolves oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <Stephanie.Neubauer@bosch.io>
Resolves oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <Stephanie.Neubauer@bosch.io>
Resolves oss-review-toolkit#3396. Signed-off-by: Stephanie Neubauer <Stephanie.Neubauer@bosch.io>
Resolves #3396. Signed-off-by: Stephanie Neubauer <Stephanie.Neubauer@bosch.io>
It should be possible to select a license if a package is dual licensed.
This should be possible to do ORT instance globally (
~/.ort/config/licenseChoices.yml
) and project specific (.ort.yml
).Project specific configurations should override global configrations.
The logic how to select and replace SPDX OR clauses are already defined in these tests:
ort/spdx-utils/src/test/kotlin/SpdxExpressionTest.kt
Lines 288 to 368 in 5b61274
The text was updated successfully, but these errors were encountered: