capycli 2.0.0.dev8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. capycli-2.0.0.dev8/License.md +27 -0
  2. capycli-2.0.0.dev8/PKG-INFO +268 -0
  3. capycli-2.0.0.dev8/Readme.md +228 -0
  4. capycli-2.0.0.dev8/capycli/__init__.py +214 -0
  5. capycli-2.0.0.dev8/capycli/__main__.py +13 -0
  6. capycli-2.0.0.dev8/capycli/bom/__init__.py +10 -0
  7. capycli-2.0.0.dev8/capycli/bom/bom_convert.py +163 -0
  8. capycli-2.0.0.dev8/capycli/bom/check_bom.py +187 -0
  9. capycli-2.0.0.dev8/capycli/bom/check_bom_item_status.py +197 -0
  10. capycli-2.0.0.dev8/capycli/bom/check_granularity.py +244 -0
  11. capycli-2.0.0.dev8/capycli/bom/create_components.py +644 -0
  12. capycli-2.0.0.dev8/capycli/bom/csv.py +69 -0
  13. capycli-2.0.0.dev8/capycli/bom/diff_bom.py +279 -0
  14. capycli-2.0.0.dev8/capycli/bom/download_sources.py +227 -0
  15. capycli-2.0.0.dev8/capycli/bom/filter_bom.py +323 -0
  16. capycli-2.0.0.dev8/capycli/bom/findsources.py +278 -0
  17. capycli-2.0.0.dev8/capycli/bom/handle_bom.py +134 -0
  18. capycli-2.0.0.dev8/capycli/bom/html.py +67 -0
  19. capycli-2.0.0.dev8/capycli/bom/legacy.py +312 -0
  20. capycli-2.0.0.dev8/capycli/bom/legacy_cx.py +151 -0
  21. capycli-2.0.0.dev8/capycli/bom/map_bom.py +1039 -0
  22. capycli-2.0.0.dev8/capycli/bom/merge_bom.py +155 -0
  23. capycli-2.0.0.dev8/capycli/bom/plaintext.py +69 -0
  24. capycli-2.0.0.dev8/capycli/bom/show_bom.py +77 -0
  25. capycli-2.0.0.dev8/capycli/common/__init__.py +9 -0
  26. capycli-2.0.0.dev8/capycli/common/capycli_bom_support.py +629 -0
  27. capycli-2.0.0.dev8/capycli/common/comparable_version.py +161 -0
  28. capycli-2.0.0.dev8/capycli/common/component_cache.py +240 -0
  29. capycli-2.0.0.dev8/capycli/common/dependencies_base.py +48 -0
  30. capycli-2.0.0.dev8/capycli/common/file_support.py +28 -0
  31. capycli-2.0.0.dev8/capycli/common/html_support.py +119 -0
  32. capycli-2.0.0.dev8/capycli/common/json_support.py +36 -0
  33. capycli-2.0.0.dev8/capycli/common/map_result.py +116 -0
  34. capycli-2.0.0.dev8/capycli/common/print.py +55 -0
  35. capycli-2.0.0.dev8/capycli/common/purl_service.py +169 -0
  36. capycli-2.0.0.dev8/capycli/common/purl_store.py +100 -0
  37. capycli-2.0.0.dev8/capycli/common/purl_utils.py +85 -0
  38. capycli-2.0.0.dev8/capycli/common/script_base.py +165 -0
  39. capycli-2.0.0.dev8/capycli/common/script_support.py +78 -0
  40. capycli-2.0.0.dev8/capycli/data/__init__.py +9 -0
  41. capycli-2.0.0.dev8/capycli/data/granularity_list.csv +1338 -0
  42. capycli-2.0.0.dev8/capycli/dependencies/__init__.py +9 -0
  43. capycli-2.0.0.dev8/capycli/dependencies/handle_dependencies.py +70 -0
  44. capycli-2.0.0.dev8/capycli/dependencies/javascript.py +261 -0
  45. capycli-2.0.0.dev8/capycli/dependencies/maven_list.py +333 -0
  46. capycli-2.0.0.dev8/capycli/dependencies/maven_pom.py +150 -0
  47. capycli-2.0.0.dev8/capycli/dependencies/nuget.py +184 -0
  48. capycli-2.0.0.dev8/capycli/dependencies/python.py +345 -0
  49. capycli-2.0.0.dev8/capycli/main/__init__.py +9 -0
  50. capycli-2.0.0.dev8/capycli/main/application.py +165 -0
  51. capycli-2.0.0.dev8/capycli/main/argument_parser.py +101 -0
  52. capycli-2.0.0.dev8/capycli/main/cli.py +28 -0
  53. capycli-2.0.0.dev8/capycli/main/exceptions.py +14 -0
  54. capycli-2.0.0.dev8/capycli/main/options.py +424 -0
  55. capycli-2.0.0.dev8/capycli/main/result_codes.py +41 -0
  56. capycli-2.0.0.dev8/capycli/mapping/handle_mapping.py +46 -0
  57. capycli-2.0.0.dev8/capycli/mapping/mapping_to_html.py +182 -0
  58. capycli-2.0.0.dev8/capycli/mapping/mapping_to_xlsx.py +197 -0
  59. capycli-2.0.0.dev8/capycli/moverview/handle_moverview.py +46 -0
  60. capycli-2.0.0.dev8/capycli/moverview/moverview_to_html.py +122 -0
  61. capycli-2.0.0.dev8/capycli/moverview/moverview_to_xlsx.py +170 -0
  62. capycli-2.0.0.dev8/capycli/project/__init__.py +9 -0
  63. capycli-2.0.0.dev8/capycli/project/check_prerequisites.py +304 -0
  64. capycli-2.0.0.dev8/capycli/project/create_bom.py +190 -0
  65. capycli-2.0.0.dev8/capycli/project/create_project.py +335 -0
  66. capycli-2.0.0.dev8/capycli/project/create_readme.py +546 -0
  67. capycli-2.0.0.dev8/capycli/project/find_project.py +128 -0
  68. capycli-2.0.0.dev8/capycli/project/get_license_info.py +246 -0
  69. capycli-2.0.0.dev8/capycli/project/handle_project.py +118 -0
  70. capycli-2.0.0.dev8/capycli/project/show_ecc.py +200 -0
  71. capycli-2.0.0.dev8/capycli/project/show_licenses.py +211 -0
  72. capycli-2.0.0.dev8/capycli/project/show_project.py +215 -0
  73. capycli-2.0.0.dev8/capycli/project/show_vulnerabilities.py +238 -0
  74. capycli-2.0.0.dev8/pyproject.toml +70 -0
@@ -0,0 +1,27 @@
1
+ <!--
2
+ # SPDX-FileCopyrightText: (c) 2018-2023 Siemens
3
+ # SPDX-License-Identifier: MIT
4
+ -->
5
+
6
+ # MIT License
7
+
8
+ Copyright (c) 2019-2023 Siemens
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
11
+ this software and associated documentation files (the "Software"), to deal in
12
+ the Software without restriction, including without limitation the rights to
13
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
14
+ of the Software, and to permit persons to whom the Software is furnished to do
15
+ so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice (including the next
18
+ paragraph) shall be included in all copies or substantial portions of the
19
+ Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
@@ -0,0 +1,268 @@
1
+ Metadata-Version: 2.1
2
+ Name: capycli
3
+ Version: 2.0.0.dev8
4
+ Summary: CaPyCli - Clearing Automation Python Command Line Interface
5
+ Home-page: https://github.com/sw360/capycli
6
+ License: MIT
7
+ Author: Thomas Graf
8
+ Author-email: thomas.graf@siemens.com
9
+ Requires-Python: >=3.8,<4.0
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Requires-Dist: chardet (>=3.0.4,<4.0.0)
22
+ Requires-Dist: cli-support (>=1.3,<2.0)
23
+ Requires-Dist: colorama (>=0.4.3,<0.5.0)
24
+ Requires-Dist: cyclonedx-bom (>=3.11.0,<4.0.0)
25
+ Requires-Dist: cyclonedx-python-lib (>3.1.1)
26
+ Requires-Dist: dateparser (>=1.1.8,<2.0.0)
27
+ Requires-Dist: openpyxl (>=3.0.3,<4.0.0)
28
+ Requires-Dist: packageurl-python (>0.8,<1.0)
29
+ Requires-Dist: pyjwt (>=1.7.1,<2.0.0)
30
+ Requires-Dist: requests (>=2.22.0,<3.0.0)
31
+ Requires-Dist: requirements-parser (>=0.2.0,<0.3.0)
32
+ Requires-Dist: sw360 (>=1.2.0,<2.0.0)
33
+ Requires-Dist: tomli (>=2.0.1,<3.0.0)
34
+ Requires-Dist: urllib3 (==1.26.15)
35
+ Requires-Dist: wheel (>=0.38.4,<0.39.0)
36
+ Project-URL: Repository, https://github.com/sw360/capycli
37
+ Project-URL: issues, https://github.com/sw360/capycli/issues
38
+ Description-Content-Type: text/markdown
39
+
40
+ <!--
41
+ # SPDX-FileCopyrightText: (c) 2018-2023 Siemens
42
+ # SPDX-License-Identifier: MIT
43
+ -->
44
+
45
+ ![Header_Image](images/Github-social-capycli.png)
46
+
47
+ # CaPyCli - Clearing Automation Python Command Line Tool
48
+
49
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/sw360/capycli/blob/main/License.md)
50
+ [![Python Version](https://img.shields.io/badge/python-3.8%2C3.7%2C3.9%2C3.10-yellow?logo=python)](https://www.python.org/doc/versions/)
51
+ [![Static Checks](https://github.com/sw360/capycli/actions/workflows/static-checks.yml/badge.svg)](https://github.com/sw360/capycli/actions/workflows/static-checks.yml)
52
+ [![Unit Tests](https://github.com/sw360/capycli/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/sw360/capycli/actions/workflows/unit-tests.yml)
53
+ [![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/tngraf/c8f15831ecdcf6e86ab2b69cbb2d4f89/raw/df1a91c074c5ee34dc1f0dcf82bc0e76e39b5b4e/capycli-cobertura-coverage.json&color=green)](https://github.com/sw360/capycli/actions/workflows/unit-tests.yml)
54
+ [![SBOM](https://img.shields.io/badge/SBOM-CycloneDX-brightgreen)](https://github.com/tngraf/Tethys.Dgml/blob/master/SBOM/sbom.cyclonedx.xml)
55
+ [![REUSE status](https://api.reuse.software/badge/git.fsfe.org/reuse/api)](https://api.reuse.software/info/git.fsfe.org/reuse/api)
56
+
57
+ Python 3 scripts to allow clearing automation.
58
+
59
+ ## Basic Syntax
60
+
61
+ ```code
62
+ CaPyCli command [sub-command...] [options]
63
+
64
+ Commands and Sub-Commands
65
+ getdependencies dependency detection specific commands
66
+ Nuget determine dependencies for a .Net/Nuget project
67
+ Python determine dependencies for a Python project
68
+ Javascript determine dependencies for a JavaScript project
69
+ MavenPom determine dependencies for a Java/Maven project using the pom.xml file
70
+ MavenList determine dependencies for a Java/Maven project using a Maven command
71
+
72
+ bom bill of material (SBOM) specific commands
73
+ Show display contents of a SBOM
74
+ Convert convert SBOM formats
75
+ Filter apply filter file to a SBOM
76
+ Check check that all releases in the SBOM exist on target SW360 instance
77
+ CheckItemStatus show additional information about SBOM items on SW360
78
+ Map map a given SBOM to data on SW360
79
+ CreateReleases create new releases for existing components on SW360
80
+ CreateComponents create new components and releases on SW360 (use with care!)
81
+ DownloadSources download source files from the URL specified in the SBOM
82
+ Granularity check a bill of material for potential component granularity issues
83
+ Diff compare two bills of material.
84
+ Merge merge two bills of material.
85
+ Findsources determine the source code for SBOM items.
86
+
87
+ mapping
88
+ ToHtml create a HTML page showing the mapping result
89
+ ToXlsx create an Excel sheet showing the mapping result
90
+
91
+ moverview
92
+ ToHtml create a HTML page showing the mapping result overview
93
+ ToXlsx create an Excel sheet showing the mapping result overview
94
+
95
+ project
96
+ Find find a project by name
97
+ Prerequisites checks whether all prerequisites for a successfull
98
+ software clearing are fulfilled
99
+ Show show project details
100
+ Licenses show licenses of all cleared compponents
101
+ Create create or update a project on SW360
102
+ Update update an exiting project, preserving linked releases
103
+ GetLicenseInfo get license info of all project components
104
+ CreateReadme create a Readme_OSS
105
+ Vulnerabilities show security vulnerabilities of a project
106
+ ECC Show export control status of a project
107
+
108
+ Options:
109
+ command command and subcommand to process
110
+ -h, --help show a help message and exit
111
+ -i INPUTFILE, --inputfile INPUTFILE input file to read from
112
+ -ri RAW_INPUT, --raw-input RAW_INPUT raw data input file to parse repository urls
113
+ -o OUTPUTFILE, --outputfile OUTPUTFILE output file to write to
114
+ -filterfile FILTERFILE filter file to use
115
+ -v VERBOSE be verbose
116
+ -t SW360_TOKEN, --token SW360_TOKEN use this token for access to SW360
117
+ -oa, --oauth2 this is an oauth2 token
118
+ -url SW360_URL use this URL for access to SW360
119
+ --nocache NOCACHE do not use component cache
120
+ -cf CACHEFILE, --cachefile CACHEFILE cache file name to use
121
+ -rc REFRESH_CACHE, --refresh_cache REFRESH_CACHE refresh component cache
122
+ -sc, --similar look for components with similar name
123
+ -ov CREATE_OVERVIEW, --overview CREATE_OVERVIEW create an mapping overview JSON file
124
+ -mr WRITE_MAPRESULT, --mapresult WRITE_MAPRESULT create a JSON file with the mapping details
125
+ -name name of the project
126
+ -version version of the project
127
+ -id ID SW360 id of the project, supersedes name and
128
+ version parameters
129
+ -ncli NCLI, --no-overwrite-cli NCLI do not overwrite existing CLI files
130
+ -nconf NCONF, --no-overwrite-config NCONF do not overwrite an existing configuration file
131
+ -dest DESTINATION, --destination DESTINATION the destination folder
132
+ -source SOURCE source folder or additional source file
133
+ --dbx DBX relaxed handling of debian version numbers
134
+ --download enable automatic download of missing sources
135
+ --search-meta-data SEARCH_META_DATA search for component meta-data
136
+ -old-version OLD_VERSION previous version
137
+ -ex show exit code
138
+ -rr RESULT_REQUIRED there must be a clearing result available
139
+ -xml XML use XML format
140
+ -package-source PACKAGE_SOURCE URL of the package manager to use
141
+ -all show/use all items
142
+ -format FORMAT format to use (text, json, xml)
143
+ -fe FORCE_EXIT, --forceexit FORCE_EXIT force a specific exit code
144
+ -m MODE, --mode MODE specific mode for some commands
145
+ -if INPUTFORMAT Specify input file format
146
+ -of OUTPUTFORMAT Specify output file format
147
+ -X DEBUG Enable debug output
148
+ ```
149
+
150
+ ## Use Cases
151
+
152
+ Over the time we implemented more and more commands with more and more parameters.
153
+ We understand that it is hard for beginners to find the right command for the task
154
+ they want to do. Have a look at our [Use Case Overview](UseCaseOverview.md).
155
+
156
+ ## Software Clearing Approaches
157
+
158
+ From time to time there are questions **why** a command has been implemented in this
159
+ specific way or why a command exists at all. Not all organization have the same
160
+ approach when doing license compliance. Have a look at our
161
+ [Software Clearing Approach Overview](SoftwareClearingApproachOverview.md) to see our
162
+ approaches.
163
+
164
+ ## Note about Python Dependency Detection
165
+
166
+ At the moment there is only support for dependencies defined in a `requirements.txt` file.
167
+ Poetry users can create the `requirements.txt` file via
168
+
169
+ ```sh
170
+ poetry export --format requirements.txt -o requirements.txt --without-hashes
171
+ ```
172
+
173
+ If you are using pipenv, you can create the `requirements.txt` file via
174
+
175
+ ```sh
176
+ pipenv lock -r > requirements.txt
177
+ ```
178
+
179
+ If your dependencies are defined in `setup,py` you may take a look at
180
+ https://dephell.readthedocs.io/cmd-deps-convert.html or
181
+ https://github.com/jazzband/pip-tools#example-usage-for-pip-compile to generate
182
+ a `requirements.txt` file.
183
+
184
+ Probably the best solution is if you enhance CaPyCli to support poetry, pipenv or setup.py
185
+ directly and open a merge request.
186
+
187
+ ## Examples
188
+
189
+ ### Find project by name
190
+
191
+ Command:
192
+
193
+ ```sh
194
+ capycli project find -name "tr-card"
195
+ - or -
196
+ python -m capycli project find -name tr-card
197
+ ```
198
+
199
+ Result
200
+
201
+ ```sh
202
+ CaPyCli - Find a project by name
203
+
204
+ Searching for projects by name
205
+ TR-Card, 1.0 => ID = ff697cd18fe178b26fc601b60e00fcdf
206
+ ```
207
+
208
+ More examples and usage notes can be found in [examples.md](examples.md).
209
+
210
+ ## Prerequisites
211
+
212
+ * Python 3
213
+ * A SW360 read (and write) token, see next section.
214
+
215
+ ## API Access
216
+
217
+ Access to the SW360 REST API requires an access token.
218
+ The token can be requested on SW360/Preferences/REST API Token.
219
+
220
+ The scripts in this repository expect, that a valid token
221
+ is stored in the environment variable ``SW360ProductionToken``.
222
+ Alternatively you can specify a token using the `-t` option.
223
+
224
+ For proper access to an SW360 instance the correct url must be own.
225
+ The SW360 url can be specified on the commandline with the `-url`
226
+ parameter, via the environment variable ``SW360ServerUrl`` or in the
227
+ config file (`.capycli.cfg`).
228
+
229
+ ## SBOM Format
230
+
231
+ The software bill of materials (SBOM) is a crucial information for most operations.
232
+ There is no common description what a bill of materials should contain.
233
+ There are different formats available, for example the SBOM of CyCloneDX,
234
+ nevertheless most tools have their own SBOM format.
235
+ We have decided also to have our own flavor of CycloneDX, see [SBOM](Readme_BOM.md),
236
+ focused on the information we need to handle components, releases and projects
237
+ on SW360. It is a simple JSON format. CaPyCli reads or writes exactly the
238
+ information that is needed.
239
+ Conversion support from or to our SBOM format is available.
240
+ For converting CycloneDX (XML) to JSON or for converting SPDX SBOMs, we like
241
+ to refer you to the oepn source tools from [CycloneDX](https://cyclonedx.org/).
242
+
243
+ ## Mapping a SBOM to SW360
244
+
245
+ SBOM mapping is described in an extra file, see [SBOM Mapping](Readme_Mapping.md).
246
+
247
+ ## Project Management
248
+
249
+ This is a Python project managed using ```Poetry```.
250
+
251
+ ## Installation
252
+
253
+ ### From PyPi
254
+
255
+ * using `pip`:
256
+
257
+ ```shell
258
+ pip install capycli
259
+ ```
260
+
261
+ ## Copyright & License
262
+
263
+ Copyright 2018-2023 Siemens
264
+
265
+ This program and the accompanying materials are made
266
+ available under the terms of the MIT License.
267
+ SPDX-License-Identifier: MIT
268
+
@@ -0,0 +1,228 @@
1
+ <!--
2
+ # SPDX-FileCopyrightText: (c) 2018-2023 Siemens
3
+ # SPDX-License-Identifier: MIT
4
+ -->
5
+
6
+ ![Header_Image](images/Github-social-capycli.png)
7
+
8
+ # CaPyCli - Clearing Automation Python Command Line Tool
9
+
10
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/sw360/capycli/blob/main/License.md)
11
+ [![Python Version](https://img.shields.io/badge/python-3.8%2C3.7%2C3.9%2C3.10-yellow?logo=python)](https://www.python.org/doc/versions/)
12
+ [![Static Checks](https://github.com/sw360/capycli/actions/workflows/static-checks.yml/badge.svg)](https://github.com/sw360/capycli/actions/workflows/static-checks.yml)
13
+ [![Unit Tests](https://github.com/sw360/capycli/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/sw360/capycli/actions/workflows/unit-tests.yml)
14
+ [![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/tngraf/c8f15831ecdcf6e86ab2b69cbb2d4f89/raw/df1a91c074c5ee34dc1f0dcf82bc0e76e39b5b4e/capycli-cobertura-coverage.json&color=green)](https://github.com/sw360/capycli/actions/workflows/unit-tests.yml)
15
+ [![SBOM](https://img.shields.io/badge/SBOM-CycloneDX-brightgreen)](https://github.com/tngraf/Tethys.Dgml/blob/master/SBOM/sbom.cyclonedx.xml)
16
+ [![REUSE status](https://api.reuse.software/badge/git.fsfe.org/reuse/api)](https://api.reuse.software/info/git.fsfe.org/reuse/api)
17
+
18
+ Python 3 scripts to allow clearing automation.
19
+
20
+ ## Basic Syntax
21
+
22
+ ```code
23
+ CaPyCli command [sub-command...] [options]
24
+
25
+ Commands and Sub-Commands
26
+ getdependencies dependency detection specific commands
27
+ Nuget determine dependencies for a .Net/Nuget project
28
+ Python determine dependencies for a Python project
29
+ Javascript determine dependencies for a JavaScript project
30
+ MavenPom determine dependencies for a Java/Maven project using the pom.xml file
31
+ MavenList determine dependencies for a Java/Maven project using a Maven command
32
+
33
+ bom bill of material (SBOM) specific commands
34
+ Show display contents of a SBOM
35
+ Convert convert SBOM formats
36
+ Filter apply filter file to a SBOM
37
+ Check check that all releases in the SBOM exist on target SW360 instance
38
+ CheckItemStatus show additional information about SBOM items on SW360
39
+ Map map a given SBOM to data on SW360
40
+ CreateReleases create new releases for existing components on SW360
41
+ CreateComponents create new components and releases on SW360 (use with care!)
42
+ DownloadSources download source files from the URL specified in the SBOM
43
+ Granularity check a bill of material for potential component granularity issues
44
+ Diff compare two bills of material.
45
+ Merge merge two bills of material.
46
+ Findsources determine the source code for SBOM items.
47
+
48
+ mapping
49
+ ToHtml create a HTML page showing the mapping result
50
+ ToXlsx create an Excel sheet showing the mapping result
51
+
52
+ moverview
53
+ ToHtml create a HTML page showing the mapping result overview
54
+ ToXlsx create an Excel sheet showing the mapping result overview
55
+
56
+ project
57
+ Find find a project by name
58
+ Prerequisites checks whether all prerequisites for a successfull
59
+ software clearing are fulfilled
60
+ Show show project details
61
+ Licenses show licenses of all cleared compponents
62
+ Create create or update a project on SW360
63
+ Update update an exiting project, preserving linked releases
64
+ GetLicenseInfo get license info of all project components
65
+ CreateReadme create a Readme_OSS
66
+ Vulnerabilities show security vulnerabilities of a project
67
+ ECC Show export control status of a project
68
+
69
+ Options:
70
+ command command and subcommand to process
71
+ -h, --help show a help message and exit
72
+ -i INPUTFILE, --inputfile INPUTFILE input file to read from
73
+ -ri RAW_INPUT, --raw-input RAW_INPUT raw data input file to parse repository urls
74
+ -o OUTPUTFILE, --outputfile OUTPUTFILE output file to write to
75
+ -filterfile FILTERFILE filter file to use
76
+ -v VERBOSE be verbose
77
+ -t SW360_TOKEN, --token SW360_TOKEN use this token for access to SW360
78
+ -oa, --oauth2 this is an oauth2 token
79
+ -url SW360_URL use this URL for access to SW360
80
+ --nocache NOCACHE do not use component cache
81
+ -cf CACHEFILE, --cachefile CACHEFILE cache file name to use
82
+ -rc REFRESH_CACHE, --refresh_cache REFRESH_CACHE refresh component cache
83
+ -sc, --similar look for components with similar name
84
+ -ov CREATE_OVERVIEW, --overview CREATE_OVERVIEW create an mapping overview JSON file
85
+ -mr WRITE_MAPRESULT, --mapresult WRITE_MAPRESULT create a JSON file with the mapping details
86
+ -name name of the project
87
+ -version version of the project
88
+ -id ID SW360 id of the project, supersedes name and
89
+ version parameters
90
+ -ncli NCLI, --no-overwrite-cli NCLI do not overwrite existing CLI files
91
+ -nconf NCONF, --no-overwrite-config NCONF do not overwrite an existing configuration file
92
+ -dest DESTINATION, --destination DESTINATION the destination folder
93
+ -source SOURCE source folder or additional source file
94
+ --dbx DBX relaxed handling of debian version numbers
95
+ --download enable automatic download of missing sources
96
+ --search-meta-data SEARCH_META_DATA search for component meta-data
97
+ -old-version OLD_VERSION previous version
98
+ -ex show exit code
99
+ -rr RESULT_REQUIRED there must be a clearing result available
100
+ -xml XML use XML format
101
+ -package-source PACKAGE_SOURCE URL of the package manager to use
102
+ -all show/use all items
103
+ -format FORMAT format to use (text, json, xml)
104
+ -fe FORCE_EXIT, --forceexit FORCE_EXIT force a specific exit code
105
+ -m MODE, --mode MODE specific mode for some commands
106
+ -if INPUTFORMAT Specify input file format
107
+ -of OUTPUTFORMAT Specify output file format
108
+ -X DEBUG Enable debug output
109
+ ```
110
+
111
+ ## Use Cases
112
+
113
+ Over the time we implemented more and more commands with more and more parameters.
114
+ We understand that it is hard for beginners to find the right command for the task
115
+ they want to do. Have a look at our [Use Case Overview](UseCaseOverview.md).
116
+
117
+ ## Software Clearing Approaches
118
+
119
+ From time to time there are questions **why** a command has been implemented in this
120
+ specific way or why a command exists at all. Not all organization have the same
121
+ approach when doing license compliance. Have a look at our
122
+ [Software Clearing Approach Overview](SoftwareClearingApproachOverview.md) to see our
123
+ approaches.
124
+
125
+ ## Note about Python Dependency Detection
126
+
127
+ At the moment there is only support for dependencies defined in a `requirements.txt` file.
128
+ Poetry users can create the `requirements.txt` file via
129
+
130
+ ```sh
131
+ poetry export --format requirements.txt -o requirements.txt --without-hashes
132
+ ```
133
+
134
+ If you are using pipenv, you can create the `requirements.txt` file via
135
+
136
+ ```sh
137
+ pipenv lock -r > requirements.txt
138
+ ```
139
+
140
+ If your dependencies are defined in `setup,py` you may take a look at
141
+ https://dephell.readthedocs.io/cmd-deps-convert.html or
142
+ https://github.com/jazzband/pip-tools#example-usage-for-pip-compile to generate
143
+ a `requirements.txt` file.
144
+
145
+ Probably the best solution is if you enhance CaPyCli to support poetry, pipenv or setup.py
146
+ directly and open a merge request.
147
+
148
+ ## Examples
149
+
150
+ ### Find project by name
151
+
152
+ Command:
153
+
154
+ ```sh
155
+ capycli project find -name "tr-card"
156
+ - or -
157
+ python -m capycli project find -name tr-card
158
+ ```
159
+
160
+ Result
161
+
162
+ ```sh
163
+ CaPyCli - Find a project by name
164
+
165
+ Searching for projects by name
166
+ TR-Card, 1.0 => ID = ff697cd18fe178b26fc601b60e00fcdf
167
+ ```
168
+
169
+ More examples and usage notes can be found in [examples.md](examples.md).
170
+
171
+ ## Prerequisites
172
+
173
+ * Python 3
174
+ * A SW360 read (and write) token, see next section.
175
+
176
+ ## API Access
177
+
178
+ Access to the SW360 REST API requires an access token.
179
+ The token can be requested on SW360/Preferences/REST API Token.
180
+
181
+ The scripts in this repository expect, that a valid token
182
+ is stored in the environment variable ``SW360ProductionToken``.
183
+ Alternatively you can specify a token using the `-t` option.
184
+
185
+ For proper access to an SW360 instance the correct url must be own.
186
+ The SW360 url can be specified on the commandline with the `-url`
187
+ parameter, via the environment variable ``SW360ServerUrl`` or in the
188
+ config file (`.capycli.cfg`).
189
+
190
+ ## SBOM Format
191
+
192
+ The software bill of materials (SBOM) is a crucial information for most operations.
193
+ There is no common description what a bill of materials should contain.
194
+ There are different formats available, for example the SBOM of CyCloneDX,
195
+ nevertheless most tools have their own SBOM format.
196
+ We have decided also to have our own flavor of CycloneDX, see [SBOM](Readme_BOM.md),
197
+ focused on the information we need to handle components, releases and projects
198
+ on SW360. It is a simple JSON format. CaPyCli reads or writes exactly the
199
+ information that is needed.
200
+ Conversion support from or to our SBOM format is available.
201
+ For converting CycloneDX (XML) to JSON or for converting SPDX SBOMs, we like
202
+ to refer you to the oepn source tools from [CycloneDX](https://cyclonedx.org/).
203
+
204
+ ## Mapping a SBOM to SW360
205
+
206
+ SBOM mapping is described in an extra file, see [SBOM Mapping](Readme_Mapping.md).
207
+
208
+ ## Project Management
209
+
210
+ This is a Python project managed using ```Poetry```.
211
+
212
+ ## Installation
213
+
214
+ ### From PyPi
215
+
216
+ * using `pip`:
217
+
218
+ ```shell
219
+ pip install capycli
220
+ ```
221
+
222
+ ## Copyright & License
223
+
224
+ Copyright 2018-2023 Siemens
225
+
226
+ This program and the accompanying materials are made
227
+ available under the terms of the MIT License.
228
+ SPDX-License-Identifier: MIT