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

Support for repositories that are dual-licensed #117

Open
dims opened this issue Mar 21, 2022 · 6 comments
Open

Support for repositories that are dual-licensed #117

dims opened this issue Mar 21, 2022 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@dims
Copy link

dims commented Mar 21, 2022

When i run go-licenses csv ./... against github.com/kubernetes/kubernetes:

the csv contains:

github.com/heketi/heketi,https://github.com/kubernetes/kubernetes/blob/master/vendor/github.com/heketi/heketi/COPYING-GPLV2,GPL-2.0

because https://github.com/heketi/heketi has multiple licenses (GPL 2.0 and Apache 2). Should the tool print both licenses?

@Bobgy
Copy link
Collaborator

Bobgy commented Apr 8, 2022

It's very complex to programmatically understand the difference between dual-licensed (user can choose a license) vs contains code for both licenses (user must comply with both).

Yes, I think reporting both and show a warning to ask users to check can be a good step forward.

Open for suggestions and contribution.

@agibson-bluecat
Copy link

agibson-bluecat commented May 20, 2022

@Bobgy I think it would be nice to allow manual path overrides by the user in case they have dependencies which use non-standard paths for their license files. This way the behaviour of go-licenses could be predictable (even for repos with dual licenses), and we wouldn't need to wait for go-licenses to add support for every license location that any module uses.

For example, I'm having an issue with the dependency github.com/hashicorp/cronexpr. This repo has dual licenses available at /GPLv3 and /APLv2. go-licenses doesn't recognize any license file in this repo, so it ends up outputting:

github.com/hashicorp/cronexpr,Unknown,Unknown

To make the go-licenses tool's behaviour as predictable as possible, I think something like the following would be a nice feature:

go-licenses csv . --override-license-paths overrides.json

Where the contents of overrides.json is a set of repo -> path kv pairs:

{
    "github.com/hashicorp/cronexpr": "/APLv2",
    ......
}

Another way to support this would be to allow multiple inline --override-path arguments, for example:

go-licenses csv . --override-path 'github.com/hashicorp/cronexpr=/APLv2' --override-path ......

What do you think?

@Bobgy
Copy link
Collaborator

Bobgy commented May 20, 2022

Makes perfect sense to me.

Regarding how to override, ideally we support both an arg as well as a config file.

viper seems to be a go to option to achieve that.

@Bobgy
Copy link
Collaborator

Bobgy commented May 20, 2022

Welcome contributions in this direction!

@Bobgy Bobgy added help wanted Extra attention is needed enhancement New feature or request labels May 20, 2022
@Bobgy
Copy link
Collaborator

Bobgy commented May 20, 2022

JFYI, https://stackoverflow.com/a/58470849 seems to be a code example to achieve that

@Bobgy
Copy link
Collaborator

Bobgy commented May 21, 2022

Also note more complex cases exist:

  • One package has multiple licenses
  • One module has multiple packages with licenses
  • One module has non standard and unrecognizable license, so specifying license path may not be enough

We don't need to solve all of them at once, but for any proposed solution, it's better to quickly think how it may be extended for future requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants