GithubHelp home page GithubHelp logo

pombredanne / bd_export_spdx2.2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matthewb66/bd_export_spdx2.2

0.0 0.0 0.0 179 KB

The script is designed to export an SPDX version 2.2 JSON file from a Black Duck project.

License: Apache License 2.0

Python 100.00%

bd_export_spdx2.2's Introduction

Synopsys Black Duck - bd_export_spdx22_json.py

OVERVIEW

This script is provided under an OSS license (specified in the LICENSE file) to allow users to export SPDX version 2.2 in JSON format from Black Duck projects.

It does not represent any extension of licensed functionality of Synopsys software itself and is provided as-is, without warranty or liability.

DESCRIPTION

The script is designed to export SPDX version 2.2 in JSON format from a Black Duck project.

It relies on the Black Duck hub-rest-api-python package to access the Black Duck APIs (see prerequisites below to install and configure this package).

The project name and version need to be specified. If the project name is not matched in the server then the list of projects matching the supplied project string will be displayed (and the script will terminate). If the version name is not matched for the specified project, then the list of all versions will be displayed (and the script will terminate).

The output file in SPDX JSON format can optionally be specified; the project name and version name with .json extension will be used for the default filename if nor specified. If the output file already exists, it will be renamed using a numeric extension (for example .001).

The optional --recursive option will traverse sub-projects to include all leaf components. If not specified, and sub-projects exist in the specified project, then the sub-projects will be skipped.

Other options can be specified to reduce the number of API calls to speed up script execution.

PREREQUISITES

  1. Pip 3 must be installed.

  2. Set the BLACKDUCK_URL and BLACKDUCK_API_TOKEN environment variables to connect to the Black Duck server (alternatively use the --blackduck_url and --blackduck_api_token options)

INSTALLATION

Install the package using the command:

    pip3 install -i https://test.pypi.org/simple/ bd-export-spdx2.2

USAGE

The program can be invoked as follows:

   usage: bd_export_spdx [-h] [-v] [-o OUTPUT] [-r] [--download_loc] [--no_copyrights] [--no_files] [-b] [--blackduck_url BLACKDUCK_URL]
                           [--blackduck_api_token BLACKDUCK_API_TOKEN] [--blackduck_trust_certs]
                           project_name project_version

   "Export SPDX JSON format file for the given project and version"

   positional arguments:
     project_name          Black Duck project name
     project_version       Black Duck version name

   optional arguments:
     -h, --help            show this help message and exit
     -v, --version         Print script version and exit
     -o OUTPUT, --output OUTPUT
                           Output SPDX file name (SPDX JSON format) - default '<proj>-<ver>.json'
     -r, --recursive       Scan sub-projects within projects (default = false)
     --download_loc        Attempt to identify component download link extracted from Openhub (slows down processing - default=false)
     --no_copyrights       Do not export copyright data for components (speeds up processing - default=false)
     --no_files            Do not export file data for components (speeds up processing - default=false)
     -b, --basic           Do not export copyright, download link or package file data (speeds up processing - same as using "--no_copyrights --no_files")
     --blackduck_url BLACKDUCK_URL
                           Black Duck server URL including https://
     --blackduck_api_token BLACKDUCK_API_TOKEN
                           Black Duck API token
     --blackduck_trust_certs
                           Trust Black Duck server certificates if unsigned

If project_name does not match a single project then all matching projects will be listed and the script will terminate.

If version does not match a single project version then all matching versions will be listed and the script will terminate.

The script will use the environment variables BLACKDUCK_URL and BLACKDUCK_API_TOKEN if they are set. Alternatively use the options --blackduck_url and --blackduck_api_token to specify them on the command line.

Use the --blackduck_trust_certs option to trust the SSL certificate on the Black Duck server if unsigned.

The --output out_file or -o out_file option specifies the output file. If this file already exists, the previous version will be renamed with a unique number (e.g. .001). The default file name <project>-<version>.spdx will be used if not specified.

The --recursive or -r option will cause Black Duck sub-projects to be processed, adding the components of sub-projects to the overall SPDX output file. If the processed project version contains sub-projects and this option is not specified, they will be ignored.

The --download_loc option will try to extract component download locations from Openhub.net (PackageDownloadLocation tag), increasing the number of API calls and time to complete the script.

The --no_copyrights option will stop the processing of component copyright text (PackageCopyrightText tag) reducing the number of API calls and time to complete the script.

The --no_files option will stop the processing of component filename (PackageFileName tag) reducing the number of API calls and time to complete the script.

The --basic or -b option will stop the processing of copy, download link or package file (same as using --no_downloads --no_copyrights --no_files options) reducing the number of API calls and time to complete the script.

bd_export_spdx2.2's People

Contributors

matthewb66 avatar

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.