Skip to content

Commit 242dc12

Browse files
committed
Add fosslight_oss_pkg
1 parent a0c11c7 commit 242dc12

17 files changed

+738
-139
lines changed

README.md

Lines changed: 9 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -4,106 +4,28 @@ SPDX-License-Identifier: Apache-2.0
44
-->
55
# FOSSLight REUSE
66

7-
**FOSSLight REUSE** uses [reuse-tool][ret] to check whether the source code's copyright and license writing rules are complied with.
7+
**FOSSLight REUSE** is a tool that can be used to comply with the copyright/license writing rules in the source code.
8+
It uses [reuse-tool][ret] to check whether the source code's copyright and license writing rules are complied with.
89

910
[ret]: https://github.com/fsfe/reuse-tool
1011

11-
## 🎉 How to install
1212

13-
It can be installed using pip3.
14-
It is recommended to install it in the [python 3.6 + virtualenv](https://github.com/fosslight/fosslight_source/blob/main/docs/Guide_virtualenv.md) environment.
13+
## 📖 User Guide
14+
Please see the [**User Guide**](https://github.com/fosslight/fosslight_reuse/blob/main/docs/user-guide.md) for more information on how to install and run it.
15+
Here a short summary:
1516

16-
```
17-
$ pip3 install fosslight_reuse
18-
```
17+
- `lint` --- Check whether the source code's copyright and license writing rules are complied with.
1918

20-
## 🚀 How to run
21-
```
22-
$ fosslight_reuse
23-
```
24-
### Parameters
25-
| Parameter | Argument | Required | Description |
26-
| ------------- | ------------- | ------------- |------------- |
27-
| p | [root_path_to_check] | O | Source path to check. |
28-
| h | None | X | Print help message. |
29-
| n | None | X | Add this parameter if you do not want to exclude venv*, node_modules, and .*/ from the analysis.|
30-
| r | [result_file_name] | X | xml format result file name. (Default: reuse_checker.xml) |
31-
| f | [file1,file2,...] | X | List of files to check copyright and license. |
19+
- `report` --- Convert oss-pkg-info.yaml to FOSSLight-Report.xlsx and vice versa.
3220

33-
### Ex 1. Run with minimal parameters
34-
```
35-
$ fosslight_reuse -p [root_path_to_check]
36-
```
37-
### Ex 2. Check for specific files
38-
Copyright text and License text are printed for /home/test/notice/sample.py, /home/test/src/init.py.
39-
```
40-
$ fosslight_reuse -p /home/test/ -f "notice/sample.py,src/init.py"
41-
```
42-
## How it works
43-
1. Check if it exists in the directory received by parameter -p.
44-
2. Find a OSS Package Information file.
45-
3. Run a Reuse lint.
46-
3-1. When running on a project basis. (without -f parameter)
47-
- If there is no ./reuse/dep5 file in the Root Path, it is created.
48-
- If it already exists, copy it to bk file and append the default config value to the existing dep file.
49-
- By creating dep5 files, exclude binary or .json, venv */*, node_modules/*,. */* from reuse.
50-
- Run the reuse lint
51-
If the OSS Package Information file exists, the list of missing license files is not printed.
52-
- Rollback dep5-related file creation part.
53-
54-
3-2. When executing in file unit (with -f option)
55-
- Print the copyright text and license text extraction by file.
56-
- However, if the file does not exist or the file is binary or .json, copyright text and license text are not printed.
57-
58-
4. Print the execution result and save it in xml format.
59-
60-
## 📁 Result
61-
### Ex 1. Analyze the files in path.
62-
```
63-
(venv)$ fosslight_reuse -p /home/test/reuse-example -r result.xml
64-
```
65-
```
66-
# SUMMARY
67-
# Open Source Package info: File to which OSS Package information is written.
68-
# Used licenses: License detected in the path.
69-
# Files with copyright information: Number of files with copyright / Total number of files.
70-
# Files with license information: Number of files with license / Total number of files.
71-
72-
* Open Source Package info: /home/test/reuse-example/oss-package.info
73-
* Used licenses: CC-BY-4.0, CC0-1.0, GPL-3.0-or-later
74-
* Files with copyright information: 6 / 7
75-
* Files with license information: 6 / 7
76-
77-
```
78-
79-
### Ex 2. Analyze specific files.
80-
The detected License and Copyright information for each file is output.
81-
```
82-
(venv)$ fosslight_reuse -p /home/soimkim/test/reuse-example -f "src/load.c,src/dummy.c,src/main.c"
83-
```
84-
```
85-
# src/load.c
86-
* License:
87-
* Copyright: SPDX-FileCopyrightText: 2019 Jane Doe <[email protected]>
88-
89-
# src/dummy.c
90-
* License:
91-
* Copyright:
92-
93-
# src/main.c
94-
* License: GPL-3.0-or-later
95-
* Copyright: SPDX-FileCopyrightText: 2019 Jane Doe <[email protected]>
96-
97-
```
9821

9922
## 👏 How to report issue
10023

10124
Please report any ideas or bugs to improve by creating an issue in [Git Repository][repo]. Then there will be quick bug fixes and upgrades. Ideas to improve are always welcome.
10225

10326
[repo]: https://github.com/fosslight/fosslight_reuse/issues
10427

105-
## 📄 License
106-
Copyright (c) 2020 LG Electronics, Inc.
107-
FOSSLight REUSE is Apache-2.0, as found in the [LICENSE][l] file.
28+
## 📄 License
29+
FOSSLight REUSE is licensed under [Apache-2.0][l].
10830

10931
[l]: https://github.com/fosslight/fosslight_reuse/blob/main/LICENSE

docs/user-guide.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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.

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ binaryornot
22
requests
33
reuse
44
PyYAML
5+
xlrd==1.2.0
6+
XlsxWriter==1.2.9
57
fosslight_util

setup.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,28 @@
1414
if __name__ == "__main__":
1515
setup(
1616
name='fosslight_reuse',
17-
version='1.0.1',
17+
version='2.0.0',
1818
package_dir={"": "src"},
1919
packages=find_packages(where='src'),
20-
description='Wrapper of reuse lint.',
20+
description='FOSSLight Reuse',
2121
long_description=readme,
2222
long_description_content_type='text/markdown',
23-
license='LGE-Proprietary',
24-
author='Soim Kim',
25-
author_email='[email protected]',
26-
url='http://mod.lge.com/code/projects/OSC/repos/fosslight_reuse',
27-
download_url='http://mod.lge.com/code/rest/archive/latest/projects/OSC/repos/fosslight_reuse/archive?format=zip',
28-
classifiers=['Programming Language :: Python :: 3.6',
29-
'License :: OSI Approved :: Closed Sorce Software'],
23+
license='Apache-2.0',
24+
author='LG Electronics',
25+
url='https://github.com/fosslight/fosslight_reuse',
26+
download_url='https://github.com/fosslight/fosslight_reuse',
27+
classifiers=[
28+
"License :: OSI Approved :: Closed Source Software",
29+
"Programming Language :: Python :: 3",
30+
"Programming Language :: Python :: 3.6",
31+
"Programming Language :: Python :: 3.7",
32+
"Programming Language :: Python :: 3.8",
33+
"Programming Language :: Python :: 3.9"],
3034
install_requires=required,
35+
include_package_data=True,
3136
entry_points={
3237
"console_scripts": [
33-
"fosslight_reuse = fosslight_reuse.wrapper_reuse_lint:main"
38+
"fosslight_reuse = fosslight_reuse.cli:main"
3439
]
3540
}
3641
)

src/fosslight_oss_pkg/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)