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

feat(license): add struct with types for licenses #256

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

DmitriyLewen
Copy link
Collaborator

@DmitriyLewen DmitriyLewen commented Sep 19, 2023

Description

To exclude prefixes for licenses, add a new License structure with types:

  • file
  • Name
  • non-separable

This structure will be needed for subsequent analysis of these licenses (if necessary).

@@ -74,4 +74,6 @@ const (
RefVCS RefType = "vcs"
RefIssueTracker RefType = "issue-tracker"
RefOther RefType = "other"

NonSeparableLicensePrefix = "non-separable: "
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have file:// prefix.

Perhaps we want to create new struct for License field.

just as idea:

type License struct {
	Value string
	Type  licenseType
}

type licenseType string

const (
	fileLicenseType             licenseType = "file" // filename for license file
	textLicenseType             licenseType = "text" // text of license (for split, classifier, etc.)
	nonSeparableTextLicenseType licenseType = "nonSeparable-text" // text of license without possible to split
	formattedLicenseType        licenseType = "formattedLicenses" // formatted licenses (e.g. in SPDX format)
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds reasonable. We can go with that approach.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@knqyf263 I have added licenseType to this PR.
I also updated aquasecurity/trivy#5211 to show the required changes for Trivy.
#5211 requires some refactoring. I will do this if you confirm that we are ready for these changes.

// https://packaging.python.org/en/latest/specifications/core-metadata/#license,
// but it is impossible to define a delimiter to separate them.
// Mark them, so we don't have to separate them later.
license = types.NonSeparableLicensePrefix + l
} else {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about checking license classifiers before license, but in this case we might miss some nuances (like license exclusion).
So I left the old order.

@lior-orca
Copy link

@DmitriyLewen is this going to be picked up again soon? :)
Thanks in advance!

@DmitriyLewen
Copy link
Collaborator Author

Hello @lior-orca
We need to wait for @knqyf263's decision.

@knqyf263 Can you take a look at these changes?

@knqyf263
Copy link
Collaborator

Please give me some more time. I have some prioritized tasks.

@lior-orca
Copy link

@knqyf263 any updated? :)
cc @DmitriyLewen

@lior-orca
Copy link

@DmitriyLewen any updates on this one?

@DmitriyLewen
Copy link
Collaborator Author

Hello @lior-orca
We decided to add a new structure for licenses - #256 (comment).
So I'm working on that now.

@DmitriyLewen DmitriyLewen changed the title fix(python): add non-separable prefix for python packaging feat(license): add struct with types for licenses Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants