Skip to content

bd_copyright_processor fork to bring change into main line

License

Notifications You must be signed in to change notification settings

bmos1/bd_copyright_processor

 
 

Repository files navigation

Black Duck Copyright Processor

OVERVIEW

This script is provided under an OSS license (specified in the LICENSE file).

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

DESCRIPTION

This script processes an existing Black Duck project version to extract copyrights, which are filtered to remove duplicates and incorrectly identified copyrights, and export in a text format for use in a notices file.

Installation

Clone the repo from git hub and install the dependencies listed in the requirements file

python3 -m pip install -r requirements.txt

Create a new file called .restconfig.json in the directory where the script is cloned to. Here are templates depending on whether you are using a username password or API token:

{  
 "baseurl": "https://hub-hostname",
 "username": "<username goes here>",
 "password": "<password goes here>",
 "insecure": true,
 "debug": false
 }

Or

{  
 "baseurl": "https://hub-hostname",
 "api_token": "<API token goes here>",
 "insecure": true,
 "debug": false
}

Replace the URL with the url of your BlackDuck instance and add your credentials.

Usage

usage: Generate notice report with filtered copyright information

   generate_notices_report.py 
   [-h] [-d] [-nf] [-nd] [-sr] [-o OUTPUT_TEXT]
   [-oh OUTPUT_HTML]   project_name version

positional arguments:

  • project_name - The name of the project in Blackduck
  • version - The name of the version in Blackduck

optional arguments:

  • -h, --help - show this help message and exit
  • -d, --debug - Enable debug output
  • -nf, --not_filtered - Don't perform any filtering
  • -sr, --show_rejected - Show all lines that were processed for copyright but were ultimately rejected
  • -o <filename>, --output-text <filename> - Output report as text
  • -oh <filename>, --output-html <filename> - Output report as html
  • -l 2 , --max_lines 2, - Maximum processed copyright lines: default 2
  • -c all, --code_languages all - Specify which code fragments should be eliminated: csharp,cpp,java,js,shell,xml,sql

TODO:

  • Move postprocessing steps like copyright match filtering and duplicates elimination to CopyrightProcessor.
  • Read code and license fragments from files which contain regular expressions and string replace patterns.

LIMITATIONS

  • Synchronous download of copyright and license information using hub.execute_get functions with >0.6s/call.

About

bd_copyright_processor fork to bring change into main line

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%