|
| 1 | +<!-- |
| 2 | +Copyright (c) 2021 LG Electronics |
| 3 | +SPDX-License-Identifier: Apache-2.0 |
| 4 | + --> |
| 5 | +# FOSSLight REUSE |
| 6 | +**FOSSLight REUSE** is a tool that can be used to comply with the copyright/license writing rules in the source code. |
| 7 | +It uses [reuse-tool][ret] to check whether the source code's copyright and license writing rules are complied with. |
| 8 | + |
| 9 | +[ret]: https://github.com/fsfe/reuse-tool |
| 10 | + |
| 11 | +## Functions |
| 12 | +1. `lint` --- Check whether the source code's copyright and license writing rules are complied with. |
| 13 | +2. `report` --- Convert oss-pkg-info.yaml to FOSSLight-Report.xlsx and vice versa. |
| 14 | + - It converts oss-pkg-info.yaml to SRC Sheet of FOSSLight Report or |
| 15 | + - BIN (Android) and BOM Sheet of OSS Report to oss-pkg-info.yaml. |
| 16 | + |
| 17 | +## 🎉 How to install |
| 18 | + |
| 19 | +It can be installed using pip3. |
| 20 | +It is recommended to install it in the [python 3.6 + virtualenv](https://fosslight.org/fosslight-guide-en/scanner/etc/guide_virtualenv.html) environment. |
| 21 | + |
| 22 | +``` |
| 23 | +$ pip3 install fosslight_reuse |
| 24 | +``` |
| 25 | + |
| 26 | +## 🚀 How to run - lint (Check copyright and license writing rules) |
| 27 | +``` |
| 28 | +$ fosslight_reuse lint |
| 29 | +``` |
| 30 | +### Parameters |
| 31 | +| Parameter | Argument | Required | Description | |
| 32 | +| ------------- | ------------- | ------------- |------------- | |
| 33 | +| p | [root_path_to_check] | O | Source path to check. | |
| 34 | +| h | None | X | Print help message. | |
| 35 | +| n | None | X | Add this parameter if you do not want to exclude venv*, node_modules, and .*/ from the analysis.| |
| 36 | +| o | [result_file_name] | X | xml format result file name. (Default: reuse_checker.xml) | |
| 37 | +| f | [file1,file2,...] | X | List of files to check copyright and license. | |
| 38 | + |
| 39 | +### Ex 1. Run with minimal parameters |
| 40 | +``` |
| 41 | +$ fosslight_reuse lint -p [root_path_to_check] |
| 42 | +``` |
| 43 | +### Ex 2. Check for specific files |
| 44 | +Copyright text and License text are printed for /home/test/notice/sample.py, /home/test/src/init.py. |
| 45 | +``` |
| 46 | +$ fosslight_reuse lint -p /home/test/ -f "notice/sample.py,src/init.py" |
| 47 | +``` |
| 48 | +## How it works |
| 49 | +1. Check if it exists in the directory received by parameter -p. |
| 50 | +2. Find a OSS Package Information file. |
| 51 | +3. Run a Reuse lint. |
| 52 | + 3-1. When running on a project basis. (without -f parameter) |
| 53 | + - If there is no ./reuse/dep5 file in the Root Path, it is created. |
| 54 | + - If it already exists, copy it to bk file and append the default config value to the existing dep file. |
| 55 | + - By creating dep5 files, exclude binary or .json, venv */*, node_modules/*,. */* from reuse. |
| 56 | + - Run the reuse lint |
| 57 | + If the OSS Package Information file exists, the list of missing license files is not printed. |
| 58 | + - Rollback dep5-related file creation part. |
| 59 | + |
| 60 | + 3-2. When executing in file unit (with -f option) |
| 61 | + - Print the copyright text and license text extraction by file. |
| 62 | + - However, if the file does not exist or the file is binary or .json, copyright text and license text are not printed. |
| 63 | + |
| 64 | +4. Print the execution result and save it in xml format. |
| 65 | + |
| 66 | +## 📁 Result |
| 67 | +### Ex 1. Analyze the files in path. |
| 68 | +``` |
| 69 | +(venv)$ fosslight_reuse lint -p /home/test/reuse-example -r result.xml |
| 70 | +``` |
| 71 | +``` |
| 72 | +# SUMMARY |
| 73 | +# Open Source Package info: File to which OSS Package information is written. |
| 74 | +# Used licenses: License detected in the path. |
| 75 | +# Files with copyright information: Number of files with copyright / Total number of files. |
| 76 | +# Files with license information: Number of files with license / Total number of files. |
| 77 | + |
| 78 | +* Open Source Package info: /home/test/reuse-example/oss-package.info |
| 79 | +* Used licenses: CC-BY-4.0, CC0-1.0, GPL-3.0-or-later |
| 80 | +* Files with copyright information: 6 / 7 |
| 81 | +* Files with license information: 6 / 7 |
| 82 | +
|
| 83 | +``` |
| 84 | + |
| 85 | +### Ex 2. Analyze specific files. |
| 86 | +The detected License and Copyright information for each file is output. |
| 87 | +``` |
| 88 | +(venv)$ fosslight_reuse lint -p /home/soimkim/test/reuse-example -f "src/load.c,src/dummy.c,src/main.c" |
| 89 | +``` |
| 90 | +``` |
| 91 | +# src/load.c |
| 92 | +* License: |
| 93 | +* Copyright: SPDX-FileCopyrightText: 2019 Jane Doe <[email protected]> |
| 94 | + |
| 95 | +# src/dummy.c |
| 96 | +* License: |
| 97 | +* Copyright: |
| 98 | + |
| 99 | +# src/main.c |
| 100 | +* License: GPL-3.0-or-later |
| 101 | +* Copyright: SPDX-FileCopyrightText: 2019 Jane Doe <[email protected]> |
| 102 | +
|
| 103 | +``` |
| 104 | + |
| 105 | +## 🚀 How to run - report (Convert oss-pkg-info.yaml <-> FOSSLight-Report.xlsx) |
| 106 | +``` |
| 107 | +$ fosslight_reuse report |
| 108 | +``` |
| 109 | +### Parameters |
| 110 | +| Parameter | Argument | Required | Description | |
| 111 | +| ------------- | ------------- | ------------- |------------- | |
| 112 | +| p | [path_to_check] | O | Convert all oss-pkg-info*.yaml or oss-pkg-info*.yml in the path recursively | |
| 113 | +| h | None | X | Print help message. | |
| 114 | +| o | [result_file_name] | X | Output file name | |
| 115 | +| f | [file1,file2,...] | X | 1. Yaml files are converted as OSS Report (separated by, if multiple) <br> ex) -f src/oss-pkg-info.yaml,main/setting.yml 2. OSS Report file to be converted to oss-pkg-info.yaml. | |
| 116 | + |
| 117 | +### Ex 1. Convert oss-pkg-info.yaml file to OSS Report. |
| 118 | +1-1. Convert all oss-pkg-info*.yaml or oss-pkg-info*.yml in the path recursively. |
| 119 | +``` |
| 120 | +$ fosslight_reuse report -p /home/test/source |
| 121 | +``` |
| 122 | + |
| 123 | +1-2. Covert the specific oss-pkg-info.yaml files. |
| 124 | +``` |
| 125 | +$ fosslight_reuse report -f src/oss-pkg-info.yaml,main/setting.yml |
| 126 | +``` |
| 127 | + |
| 128 | +### Ex 2. Convert OSS Report to oss-pkg-info.yaml file. |
| 129 | +``` |
| 130 | +$ fosslight_reuse report -f src/OSS-Report.xlsx |
| 131 | +``` |
| 132 | + |
| 133 | +## 📁 Result |
| 134 | +If an output file name is specified with -o, a result file is created with that name. |
| 135 | +- FOSSLight-Report_[datetime].xlsx : When the oss-pkg-info.yaml file is converted to OSS-Report.xlsx |
| 136 | +- oss-pkg-info_[datetime].yaml : FOSSLight-Report.xlsx is converted to oss-pkg-info.yaml. |
0 commit comments