Git Product home page Git Product logo

Comments (9)

kemitchell avatar kemitchell commented on May 31, 2024

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.

sschuberth avatar sschuberth commented on May 31, 2024

Actually, it shouldn't be too hard. I've basically done it, though in a local shell script. All you need to do is:

  1. Get the value of licenseId from https://spdx.org/licenses/licenses.json and append it with .txt.
  2. Use that as an index to the file names in https://github.com/spdx/license-list and download the file.
  3. 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.

goneall avatar goneall commented on May 31, 2024

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.

goneall avatar goneall commented on May 31, 2024

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.

kemitchell avatar kemitchell commented on May 31, 2024

I have started doing this for the most common licenses in the JavaScript community:

https://github.com/jslicense/

from spdx-license-list.

sschuberth avatar sschuberth commented on May 31, 2024

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:

  1. Remove the .txt suffix from all license files to make their names exactly match the SPDX ID for trivial lookup.
  2. Move deprecated_* files to a deprecated directory, stripping the prefix from the files along the way.
  3. Move the remaining current license text files to a templates directory.
  4. 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.

goneall avatar goneall commented on May 31, 2024

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.

myndzi avatar myndzi commented on May 31, 2024

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.

sschuberth avatar sschuberth commented on May 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.