Skip to content

Commit 985afd5

Browse files
committed
mk
1 parent f5b4f3f commit 985afd5

File tree

1 file changed

+17
-51
lines changed

1 file changed

+17
-51
lines changed

examples/client/get_project_version_components_by_license.py

Lines changed: 17 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -22,57 +22,23 @@
2222
specific language governing permissions and limitations
2323
under the License.
2424
25-
This script will perform bulk deletion of Project versions based on
26-
the content of an EXCEL file. Each row of a file is expected to contain
27-
a field for Project Name Project Version.
28-
Script will iterate through the rows of a spreadsheet and issue an API
29-
call per row.
30-
If the project version is the last in the project, entire project
31-
will be deleted.
32-
33-
Requirements
34-
35-
- python3 version 3.8 or newer recommended
36-
- the following packages are used by the script and should be installed
37-
prior to use:
38-
argparse
39-
blackduck
40-
csv
41-
logging
42-
re
43-
openpyxl
44-
requests
45-
sys
46-
- Blackduck instance
47-
- API token with sufficient privileges to perform project version phase
48-
change.
49-
50-
Install python packages with the following command:
51-
52-
pip3 install argparse blackduck csv logging re openpyxl requests sys
53-
54-
Using
55-
56-
place the token into a file (token in this example) then execute:
57-
58-
python3 batch_delete_project_version.py -u https://blackduck-host -t token -nv -i excel-file-with-data
59-
60-
Projects and project versions that are listed in the file but are not
61-
present on the blackduck instance will be flagged in the summary.
62-
63-
usage: python3.10 examples/client/batch_delete_project_version.py [-h] -u BASE_URL -t TOKEN_FILE -i INPUT_FILE [-nv] [--dry-run]
64-
65-
options:
66-
-h, --help show this help message and exit
67-
-u BASE_URL, --base-url BASE_URL
68-
Hub server URL e.g. https://your.blackduck.url
69-
-t TOKEN_FILE, --token-file TOKEN_FILE
70-
File containing access token
71-
-i INPUT_FILE, --input-file INPUT_FILE
72-
Project Name
73-
-nv, --no-verify Disable TLS certificate verification
74-
--dry-run Do not delete, dry run
75-
25+
This script will tally up project version components by license used and produce output as following
26+
27+
{'(BSD 2-clause "Simplified" License OR Creative Commons Zero v1.0 Universal OR Public Domain)': [('HdrHistogram',
28+
'2.1.9')],
29+
'(Common Development and Distribution License 1.1 OR Sun GPL With Classpath Exception v2.0)': [('Jersey '
30+
'Apache '
31+
'HTTP '
32+
. . .
33+
'(GNU General Public License v3.0 only OR Common Development and Distribution License 1.0)': [('StAX',
34+
'1.0-2')],
35+
'ANTLR Software Rights Notice': [('antlr', '2.7.7')],
36+
'Apache License 2.0': [('Apache Commons BeanUtils', '1.9.4'),
37+
('Apache Commons Codec', '1.10'),
38+
('Apache Commons Collections', '3.1'),
39+
('Apache Commons Configuration', '1.8'),
40+
('Apache Commons Digester', '3.2'),
41+
. . .
7642
7743
'''
7844

0 commit comments

Comments
 (0)