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

Replace license crate with askalono #149

Merged
merged 4 commits into from
Nov 5, 2019

Conversation

ebroto
Copy link
Contributor

@ebroto ebroto commented Nov 3, 2019

Resolves #147

So askalono seems to use a more complex analysis that relies in a binary cache generated from a json file. For the moment I went for adding the cache directly under resources/. In askalono-cli the json file is checked out as a submodule from this repo and the cache is generated using build.rs.

We could go with a similar approach (maybe using git subtree instead), this way we would get updates of the supported licenses and won't have to update the cache manually. Since the solution is more involved I wanted to ask first what do you think about it.

@o2sh
Copy link
Owner

o2sh commented Nov 3, 2019

Just tested it, works like a charm! 💯

We could go with a similar approach (maybe using git subtree instead), this way we would get updates of the supported licenses and won't have to update the cache manually.

Just to be sure I understood correctly, you mean adding spdx as a subtree to onefetch in order to automatically cash the licenses (generate a license-cache.bin.gz) at compile time via a build.rs?

Sounds great @ebroto !

@ebroto
Copy link
Contributor Author

ebroto commented Nov 3, 2019

Yep, that's it.

Alright, I will work on it soon!

Also, forward store creation errors and use a more functional approach
@o2sh
Copy link
Owner

o2sh commented Nov 3, 2019

Hi @ebroto, don't you think it would be better to use spdx as a git submodule instead, so that we only get references and not a full copy of the repo.

The rest is great!!

@ebroto
Copy link
Contributor Author

ebroto commented Nov 3, 2019

Yes, I was hesitating about the two options and went for the subtree because it's easier to manage, but indeed it seems overkill for our needs 👍

I will try with submodules instead. BTW thanks for the invitation to collaborate!

@ebroto ebroto force-pushed the feature/license-with-askalono branch from 888ef5d to 018c9c2 Compare November 4, 2019 20:02
@o2sh
Copy link
Owner

o2sh commented Nov 5, 2019

This is definitely the most elegant solution, however I don't think the license cache will change that much.

I will create a branch with your PR (to build the a new cache when changes on spdx occur) and use a static cache on master...

@o2sh o2sh merged commit a2f6352 into o2sh:master Nov 5, 2019
@ebroto
Copy link
Contributor Author

ebroto commented Nov 5, 2019

You can also use git clone --recurse-submodules $REPO. But yes, that was the kind of extra management I wanted to avoid initially because the user has to do extra steps. Besides of this, I think it was a good call to choose submodules over subtrees because they seem a better fit. From what I've seen, cargo and travis for example should fetch the submodules without extra configuration.

In any case, we can always go back to the first approach and bundle the cache directly in the repository. The main con for this is that we have to remember to regenerate the cache whenever we update askalono as the caches are incompatible between versions.

So what are others doing? Askalono is currently used by two crates:

  • askalono-cli: the CLI that comes with the library, is using the submodules approach.
  • cargo-deny: they have a pre-generated cache versioned in the repository.

So there is no "better" option here I think. After having tried all the options (xD), I'm thinking that we can simplify and just bundle the cache directly for now and see if it works for us.

What do you think?

@ebroto
Copy link
Contributor Author

ebroto commented Nov 5, 2019

Hey it seems we posted at the same time :) Did not think about the possibility you suggested, works for me!

@o2sh
Copy link
Owner

o2sh commented Nov 5, 2019

Great, thanks again for your PR @ebroto,

If you have any suggestion/idea to improve the project, don't hesitate to keep contributing 🥇

@ebroto ebroto deleted the feature/license-with-askalono branch November 20, 2019 21:33
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.

[License Detection] Switch to askalono
2 participants