GithubHelp home page GithubHelp logo

ywangwrs / license-report Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wind-river/license-report

0.0 0.0 0.0 11 KB

A script to generate OSS license information for docker images and embed it within the image

License: MIT License

Shell 92.11% Makefile 7.89%

license-report's Introduction

License Report

An open-source compliance tool that generates a summary of OSS license information for packages in a Docker image. The project currently supports Alpine, Debian and Python packages, and their information is retrieved using terminal commands and their respective package managers.

Getting Started

Requirements

generate_report.sh is a shell script, so nothing extra should be needed to execute the file.

However, licensecheck is an optional dependency for sourcing Debian packages:

apt install licensecheck

Refresh the apk package index using "apk update" before generating a report. The following warning will otherwise be raised for each package:

apk WARNING: Ignoring APKINDEX: No such file or directory

Installing

Download the entire project from Github:

git clone https://github.com/WindRiver-OpenSourceLabs/license-report

Download the generate_report.sh script only (Requires curl):

curl --silent --remote-name https://raw.githubusercontent.com/WindRiver-OpenSourceLabs/license-report/master/generate_report.sh

Usage

generate_report.sh usage function:

usage() {
    cat <<EOF
Usage: $0 [-a, --appended <report name>] [-p, --pip <path/to/package/manager>]

  No options selected: An entirely new report will be created.

  -a, --appended <base_report>: Create an appended report consisting only of package entries that did not exist in the base report.

  -p, --pip <path/to/pip>: Use the specified package manager when searching for Python packages.

EOF
    exit 1
}

Output Description

Reports created by generate_report.sh will be printed to the console. This is so the user can control what is done with the output, as demonstrated in Applications.

An entry for a package follows this format:

Package Name: <Name>
Package Type: <Type>
Version: <Version>
Source URL: <URL>
License: <License Codes>

If the version, source url or license code of a package cannot be found, then the field "N/A" will be provided in its place. A package entry is required to have at least one of those fields so that the information it provides will be of value. The binary for Debian package copyrights will be listed if the license code cannot be found using licensecheck.

Sample entry:

Package Name: amd64-microcode
Package Type: Debian
Version: 3.20180524.1~ubuntu0.18.04.2
Source URL: N/A
License: See /usr/share/doc/amd64-microcode/copyright

A report will follow this general format:

----------------------------------------------------------------------------------------


<ORIGINAL/APPENDED> PACKAGES:


----------------------------------------------------------------------------------------

Package Name: <Name>
Package Type: <Type>
Version: <Version>
Source URL: <URL>
License: <License Codes>

----------------------------------------------------------------------------------------

<Other entries...>

As a result, concatenating a base report with an appended report will produce the following:

----------------------------------------------------------------------------------------


ORIGINAL PACKAGES:


----------------------------------------------------------------------------------------

Package Name: <Name>
Package Type: <Type>
Version: <Version>
Source URL: <URL>
License: <License Codes>

----------------------------------------------------------------------------------------

<Other entries...>

----------------------------------------------------------------------------------------


APPENDED PACKAGES:


----------------------------------------------------------------------------------------

Package Name: <Name>
Package Type: <Type>
Version: <Version>
Source URL: <URL>
License: <License Codes>

----------------------------------------------------------------------------------------

<Other entries...>

Applications

Redirecting the output of generate_report.sh to a physical file:

sh generate_report.sh > report # Output would be contained inside "report"

Adding appended information to an existing report:

sh generate_report.sh --appended report >> report

Embedding a report into an image from a Dockerfile:

RUN mkdir /license-report && \
    cd /license-report && \
    curl --silent --remote-name https://raw.githubusercontent.com/WindRiver-OpenSourceLabs/license-report/master/generate_report.sh && \
    sh generate_report.sh > report && \
    rm /license-report/generate_report.sh # Skip if carrying the report through another build stage

Carrying the report from the initial build stage and appending to it:

COPY --from=0 /license-report /license-report

RUN cd /license-report && \
    sh generate_report --appended report >> report

Testing

See here for the tests.sh README.md file.

TODO

  • Generate entries for RPM packages
  • Add an option to produce the report in a machine-readable format

Contributing

Contributions submitted must be signed off under the terms of the Linux Foundation Developer's Certificate of Origin version 1.1. Please refer to: https://developercertificate.org

To submit a patch:

  • Open a Pull Request on the GitHub project
  • Optionally create a GitHub Issue describing the issue addressed by the patch

License

This project is licensed under the MIT License - the full license can be found here.

license-report's People

Contributors

kscherer 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.