-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Support repo license #24872
Support repo license #24872
Conversation
The last commit on google/licensecheck is from one Year ago, so it looks like it is not developed anymore. I would suggest using go-enry/go-license-detector. |
They should be compared by more than just that, ideally by feeding them a corpus of oddly licensed repos. One thing i'd be interested in if any of the two can detect |
I wouldn't. License detection should be fully automatic and not overrideable, so that the git repo remains portable and is not tied to gitea-specific license override that can not be migrated.
Some form of cache would be nice to not calculate license every render, but instead only on push to the branch.
Seems nice but I'd say something for later, and only if we can outsource the license metadata. |
Thanks for this PR <3 Could you add at least a nominal test, as while upstream is tested we should ensure that our use of the library is acceptable. I do think the storage of information in the database is a good idea as that's what we do with language stats. As for which library we use, there are pros/cons for both. The google one is used by pkg.go.dev, and for enry we already use their library for language stats. Although I suspect that they both are somewhat close to getting what the actual license issue. so I think unless there is some significant performance impact or one library is wildly inaccurate either is fine. |
I tried the CLI tool of go-license-detector. There are two problems:
|
* giteaofficial/main: Fix javascript error when an anonymous user visiting migration page (go-gitea#32144) Make oauth2 code clear. Move oauth2 provider code to their own packages/files (go-gitea#32148) Support repo license (go-gitea#24872) Fix the logic of finding the latest pull review commit ID (go-gitea#32139) Ensure `GetCSRF` doesn't return an empty token (go-gitea#32130) Bump minio-go to latest version (go-gitea#32156)
Close #278
Close #24076
Solutions:
Test result between google/licensecheck and go-license-detector:
Support repo license #24872 (comment)
Test result between google/licensecheck and google/licenseclassifier:
Support repo license #24872 (comment)
Gitea automatically get latest license data from spdx/license-list-data.
But unfortunately, some license templates have same contents. Duplicate license options with identical contents #20915 click here to see the list
So we will generate a list of these license templates with same contents and create a new file to save the result when using
make generate-license
. (Need to decide the save path)repo_license
Can easily support searching repo by license in the future.
Screen shot
Single License:
Multiple Licenses:
Triggers:
Todo:
Select license in settings if there are several licenses(Not recommended)