-
Notifications
You must be signed in to change notification settings - Fork 12
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 examples/fetch.rs to fetch spdx.org/licenses and format it as src/spdx.rs #11
Conversation
examples/fetch.rs
Outdated
|
||
writeln!(stdout, "\ | ||
/* | ||
* whitelist fetched from http://spdx.org/licenses/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment seems stale, since below you are using license-list-data's JSON.
examples/fetch.rs
Outdated
|
||
let mut core = Core::new()?; | ||
|
||
download(&mut core, "https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json", |json| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of floating with master, I think it's better to take a tag argument and use that here. For example:
cargo run --example fetch-license-list-from-spdx v3.0
would pull from https://raw.githubusercontent.com/spdx/license-list-data/v3.0/json/licenses.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Git tag is now supported (sorry for the delay!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor nits, otherwise this looks good to me :).
Cargo.toml
Outdated
authors = ["Without Boats <[email protected]>"] | ||
license = "Apache-2.0 OR MIT" | ||
description = "Validate SPDX 2.0 license expressions." | ||
license = "Apache-2.0/MIT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reverting #16; can you leave the OR
form as it was?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed accordingly
Cargo.toml
Outdated
@@ -1,7 +1,20 @@ | |||
[package] | |||
name = "license-exprs" | |||
version = "1.3.0" | |||
version = "1.4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll want to bump the version before we push a new release (hopefully soon), but I'd rather have version bumps in their own pull requests, not mixed in with logic changes. Can you leave this at 1.3.0 for this PR?
…/spdx.rs Signed-off-by: NODA, Kai <[email protected]>
examples/fetch.rs
Outdated
"-d" => { | ||
debug = true; | ||
}, | ||
s if s.starts_with('v') && s.ends_with(|c: char| c.is_ascii_digit()) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we drop && s.ends_with(|c: char| c.is_ascii_digit())
here? It's breaking cargo build --examples
on my 1.23.0-dev rustc
with:
error: use of unstable library feature 'ascii_ctype' (see issue #39658)
--> examples/fetch.rs:62:64
|
62 | s if s.starts_with('v') && s.ends_with(|c: char| c.is_ascii_digit()) => {
| ^^^^^^^^^^^^^^
|
= help: add #![feature(ascii_ctype)] to the crate attributes to enable
error: aborting due to previous error
error: Could not compile `license-exprs`.
And I think matching on the opening v
is a sufficient indicator of version-ness, even without the trailing-digit check.
Also, there's no need for |
Run cargo run --example fetch-license-list-from-spdx v3.0 > spdx.rs to download from https://github.com/spdx/license-list-data/tree/v3.0/json Signed-off-by: NODA, Kai <[email protected]>
Also improve JSON validation No change to the output file Signed-off-by: NODA, Kai <[email protected]>
@wking You have an interesting project! |
Changes since v1.3.0: * Updated SPDX License List to 3.1 (ehuss#9, ehuss#11, ehuss#17, ehuss#19, ehuss#24) * Updated SPDX License Expression reference from 2.0 to 2.1 (ehuss#8). * Document our license-list version, parens issue, and license (ehuss#16, ehuss#17). * Add Travis CI configuration (ehuss#22). * Add additional test cases (ehuss#25). * .mailmap: Consolidate authors (ehuss#26).
Changes since v1.3.0: * Updated SPDX License List to 3.1 (ehuss#9, ehuss#11, ehuss#17, ehuss#19, ehuss#24). * Updated SPDX License Expression reference from 2.0 to 2.1 (ehuss#8). * Document our license-list version, parens issue, and license (ehuss#16, ehuss#17). * Add Travis CI configuration (ehuss#22). * Add additional test cases (ehuss#25). * .mailmap: Consolidate authors (ehuss#26).
Run
cargo run --example fetch-license-list-from-spdx > spdx.rs
and rename it assrc/spdx.rs
.This tool will make manual processes like #10 unnecessary.
It was written as an "example" as a trick to circumvent Cargo's limitation that dependencies cannot be added to a subset of project outputs (
hyper
etc. were added asdev-dependencies
.)