Source for the website providing online SPDX tools
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tools
.gitignore
.travis.yml
CONTRIBUTING.md
LICENSE
NOTICE
README.md
TODO
developer-certificate-of-origin
requirements.txt

README.md

GSoC Logo

spdx-online-tools

Source for the website providing online SPDX tools. The tool provides an easy all-in-one website to upload and parse SPDX documents for validation, comparison and conversion and search SPDX license list. Here you can find more about the working of the tool.

Features

  • Upload and parse SPDX Documents
  • Validate SPDX Documents
  • Compare Multiple SPDX Rdf Files
  • Convert one SPDX format to another
  • Compare License text to the SPDX listed Licenses

Requirements (Linux/Debian/Ubuntu)

Either the Sun/Oracle JDK/JRE Variant or OpenJDK. Python 2.6+.

Debian/Ubuntu users will have to install g++ and python-dev first:

sudo apt-get install g++ python-dev

Requirements (Windows)

Windows users need a Python installation and C++ compiler:

  • Install some version of Python (2.7 or higher), e.g., Anaconda is a good choice for users not yet familiar with the language
  • Install a Windows C++ Compiler

Installation

  1. Clone or download the repository.

  2. Create a new virtual environment for the project. To download virtual environment run pip install virtualenv

    virtualenv venv
    source venv/bin/activate
  3. Install the required python libraries given in the requirements.txt file.

    cd spdx-online-tools
    pip install -r requirements.txt
  4. Run Django migrate.

    python src/manage.py migrate
  5. (Optional) If you want use xml-editor with licenses/exceptions from spdx license list, download the license name database.

    python src/populate.py
  6. Start the application.

    python src/manage.py runserver
  7. Open localhost:8000/ in the browser.

  8. Register and login to use the tools.

How to Run Tests

python src/manage.py test

GitHub Developer Sensitive Data

The settings.py file uses sensitive data to work with the GitHub API. For that reason, sensitive data is not checked into source. Due to that lack of data, the following error could rise when running the app:

from secret import getGithubToken, getGithubKey, getGithubSecret, getSecretKey ImportError: No module named secret

To avoid this error and allow the tool to use the GitHub API, the file src/src/secret.py should be included into the source. The file should contain the following lines:

def getGithubKey():
    return 'GHKEYXXX'

def getGithubSecret():
    return 'GHSECRETXXX'

def getSecretKey():
    return 'DJANGOSECRETXXX'

where:

  • GHKEYXXX is the Client ID for the Github Oauth Apps
  • GHSECRETXXX is the Client ID for the Github Oauth Apps
  • DJANGOSECRETXXX is the Django secret

Note: While setting up the GitHub OAuth App, set the Homepage URL to http://localhost:8000/ and the Authorization callback URL to http://localhost:8000/oauth/complete/github

How to Use API

Here is the exhaustive list of request and response fields of different api tools.

  1. Start the server.

    python manage.py runserver
  2. Send the request to the url with the form input values accordingly. Curl examples are given below.

  3. For validation tool, send the request to /api/validate/.

    curl -X POST -u <admin>:<password> -F "file=@<fileInput>" -H "Accept: application/json" http://localhost:8000/api/validate/ | json_pp
  4. For compare tool, send the request to /api/compare/.

    curl -X POST -u <admin>:<password> -F "file1=@<fileInput1>" -F "file2=<fileInput2>" -F "rfilename=<resultFileName>" -H "Accept: application/json" http://localhost:8000/api/compare/ | json_pp
  5. For convert tool, send the request to /api/convert/.

    curl -X POST -u <admin>:<password> -F "file=@<fileInput>" -F "cfilename=<resultFileNameWithExtension>" -F "from_format=<convertFrom>" -F "to_format=<convertTo>" -H "Accept: application/json" http://localhost:8000/api/convert/ | json_pp
  6. For license check tool, send the request to /api/check_license/.

    curl -X POST -u <admin>:<password> -F "file=@<fileInput>" -H "Accept: application/json" http://localhost:8000/api/check_license/ | json_pp

Dependencies

The project uses spdx java tools for various tools of the website.