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

Add examples/fetch.rs to fetch spdx.org/licenses and format it as src/spdx.rs #11

Merged
merged 3 commits into from
Apr 20, 2018
Merged

Add examples/fetch.rs to fetch spdx.org/licenses and format it as src/spdx.rs #11

merged 3 commits into from
Apr 20, 2018

Conversation

nodakai
Copy link
Contributor

@nodakai nodakai commented Nov 18, 2017

Run cargo run --example fetch-license-list-from-spdx > spdx.rs and rename it as src/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 as dev-dependencies.)


writeln!(stdout, "\
/*
* whitelist fetched from http://spdx.org/licenses/
Copy link
Contributor

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.


let mut core = Core::new()?;

download(&mut core, "https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json", |json| {
Copy link
Contributor

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

Copy link
Contributor Author

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!)

Copy link
Contributor

@wking wking left a 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"
Copy link
Contributor

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?

Copy link
Contributor Author

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"
Copy link
Contributor

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?

"-d" => {
debug = true;
},
s if s.starts_with('v') && s.ends_with(|c: char| c.is_ascii_digit()) => {
Copy link
Contributor

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.

@wking
Copy link
Contributor

wking commented Apr 17, 2018

Also, there's no need for Signed-off-by in the commit messages (e.g. like you currently have in 6f3bd77). I don't think those are meaningful without repo-local documentation for what's being signed (like this or this). I don't have a problem with you keeping them in your commit messages anyway, but don't feel like you need to have them there on my account ;).

nodakai added 2 commits April 19, 2018 10:21
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]>
@nodakai
Copy link
Contributor Author

nodakai commented Apr 20, 2018

@wking You have an interesting project!

@wking wking merged commit 25fc051 into ehuss:master Apr 20, 2018
@nodakai nodakai deleted the fetch-spdx branch May 8, 2018 03:51
wking added a commit to wking/license-exprs that referenced this pull request Jun 18, 2018
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).
@wking wking mentioned this pull request Jun 18, 2018
wking added a commit to wking/license-exprs that referenced this pull request Jun 18, 2018
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).
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.

2 participants