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

Re-add license field to Cargo.toml #75

Closed
sdroege opened this issue Dec 9, 2021 · 10 comments
Closed

Re-add license field to Cargo.toml #75

sdroege opened this issue Dec 9, 2021 · 10 comments

Comments

@sdroege
Copy link

sdroege commented Dec 9, 2021

This was removed in 3a4033e#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542 and causes automated tooling like cargo deny to fail detecting the license.

It should probably be something like (Apache-2.0 OR MIT) AND BSD-3 but I'm not sure the expression syntax allows parenthesis. If it doesn't then we have a problem and you might want to reconsider if dual-licensing warrants the increased license complexity here. Having to worry about 3 different licenses for a single crate is a bit suboptimal, even if MIT and BSD-3 are approximately the same.

@sdroege
Copy link
Author

sdroege commented Dec 9, 2021

cargo deny is accepting the following fwiw:

[[licenses.clarify]]
name = "encoding_rs"
version = "*"
expression = "(Apache-2.0 OR MIT) AND BSD-3-Clause"
license-files = [
    { path = "COPYRIGHT", hash = 0x39f8ad31 }
]

gstreamer-github pushed a commit to sdroege/gst-plugin-rs that referenced this issue Dec 9, 2021
@hsivonen
Copy link
Owner

hsivonen commented Dec 9, 2021

Indeed, the README says that the right SPDX would be (Apache-2.0 OR MIT) AND BSD-3-Clause and a custom license file is used instead of an expression, because crates.io doesn't support parentheses. FWIW, ICU4X also points to a custom file, because its correct SPDX expression would require parentheses.

What does cargo deny use for parsing SPDX? The issue on the dependency used by crates.io is still open.

@sdroege
Copy link
Author

sdroege commented Dec 9, 2021

It depends on https://crates.io/crates/spdx/0.7.0, so I assume it's using that.

@hsivonen
Copy link
Owner

hsivonen commented Dec 9, 2021

I added the cargo deny clarification recipe to the README. Thanks.

@sdroege
Copy link
Author

sdroege commented Dec 9, 2021

I assume if you put the same into Cargo.toml then cargo will just explode at this point because the crate it uses doesn't support such complex expressions?

@hsivonen
Copy link
Owner

hsivonen commented Dec 9, 2021

Right now, I'm in a situation where I can't handle worse fallout from experimenting with a real create in the next few hours, but later I'll try uploading a bogus crate with metadata that goes against the crates.io documentation to see what happens.

@sdroege
Copy link
Author

sdroege commented Dec 9, 2021

Sure, no worries :) That's mostly for my own curiosity at this point.

@adam-azarchs
Copy link

It's a bit verbose but you can achieve the same effect without requiring changes to cargo by specifying the license as Apache-2.0 AND BSD-3-Clause OR MIT AND BSD-3-Clause.

@lsunsi
Copy link

lsunsi commented Mar 28, 2022

@adam-azarchs Despite being verbose, I think having the field set is worth it

@hsivonen
Copy link
Owner

hsivonen commented Apr 5, 2022

crates.io now supports parentheses (thanks to @jqnatividad for the heads-up in #80).

I've now pushed fcf1e10 to git and published on crates.io.

I hope this doesn't break cargo-deny consumers in the short term.

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

No branches or pull requests

4 participants