Comments (9)
Including license text is harder than it sounds. Certain very common licenses, like MIT and BSD, were written for specific licensors, and now refer to "templates".
See also: https://github.com/spdx/license-list.
// @goneall
from spdx-license-list.
Actually, it shouldn't be too hard. I've basically done it, though in a local shell script. All you need to do is:
- Get the value of
licenseId
from https://spdx.org/licenses/licenses.json and append it with.txt
. - Use that as an index to the file names in https://github.com/spdx/license-list and download the file.
- Replace the templates in the license file with the given original values.
I'm using the following sed
call to fill in the template fields:
sed -r -e "s/<<var;name=[^;]+;original=([^;]*);match=[^>]+>>/\1/g" \
-e "s/<<beginOptional;name=[^>]+>>//g;s/<<endOptional>>//g" $template > $out_dir/$name
Voila, and you have the full license text for a given SPDX license ID.
from spdx-license-list.
Note that there is an active discussion on the template language - you can follow the wiki at http://wiki.spdx.org/view/Legal_Team/Templatizing#Use_and_Feedback_re:_Current_Markup
Nothing will change in the short term, but if some of the proposals go through, it may impact your approach to extracting the license text.
from spdx-license-list.
What if we produced a separate .json file for every license that contained the text (as well as the other tags) on spdx.org/licenses? For example, the apache-2.0.json would contain the same info in json format as the RDFa info in apache-2.0.html. I think this is a relatively straightforward tool enhancement to produce the additional files for the next release of the spdx.org/licenses website.
from spdx-license-list.
I have started doing this for the most common licenses in the JavaScript community:
from spdx-license-list.
In any case, is there a specific reason why https://github.com/spdx/license-list does not also contain the original (non-templated) license texts? I'd like to see some general clean-up to that repo anyway, like:
- Remove the
.txt
suffix from all license files to make their names exactly match the SPDX ID for trivial lookup. - Move
deprecated_*
files to adeprecated
directory, stripping the prefix from the files along the way. - Move the remaining current license text files to a
templates
directory. - Create non-templated license files containing the original text, and put them into a
licenses
directory.
@goneall If you'd be fine with that, I can prepare a PR accordingly.
from spdx-license-list.
Let me ping the spdx-tech and legal teams to see if anyone has any concerns before we make the changes. I don't expect any objections, but I should check before changing the site. I'll give them 1 week to comment then we can proceed. Thanks for offering to do the PR.
On your first question, the license-list that is committed to git-hub is the source we use to generate the artifacts on spdx.org/licenses. Jilayne (who co-leads the legal team) and I agreed on a workflow where we would use the templates as the source we maintain.
It turns out that the tool that generates the HTML (and now JSON) files also generates the text only - we just don't store them in git. They are in a build directory which is ignored in the git commits. We could add them to the git repo, but I personally don't like committing anything generated. We've talked about storing them someplace else, but never really had the time to set up a separate location and process to upload.
from spdx-license-list.
In the specific case of NPM, it is readily possible to commit the source to git and publish the generated content to NPM (while not committing the generated content nor publishing the source). That'd be the way to go for NPM projects, at least; perhaps a similar paradigm would work more generally.
from spdx-license-list.
Currently blocked by them not providing the full license text through their API.
@sindresorhus This is not the case anymore. https://spdx.org/licenses/licenses.json now includes detailsUrl
entries to JSON files that contain the individual license's terms. So I think generate.js can be heavily simplified by downloading licenses.json
and the individual JSON files per license instead of downloading and unpacking the tarball snapshot of the Git repo and parsing the Excel sheet.
from spdx-license-list.
Related Issues (11)
- FYI: SPDX is Working on Structured-Data License Text Forms HOT 3
- Change to CC0 HOT 2
- Thoughts on license-generator (string variable interpolation)? HOT 3
- All instances of `https` are currently output as `http s ` HOT 3
- Update to SPDX version 3.6 2019-07-10 HOT 1
- TypeScript typings HOT 2
- Dynamically generate the JSON files HOT 1
- Clean up junk files
- Problem with APL-1.0 HOT 1
- Generate licenses? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spdx-license-list.