Skip to content

Commit 65d1305

Browse files
feat: checksum comparison is optional
1 parent b06495e commit 65d1305

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

sbomdiff/cli.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ def main(argv=None):
109109
"BLAKE2b-512",
110110
"BLAKE3",
111111
],
112-
default="SHA256",
113-
help="specify checksum algorithm to use in comparison (default: SHA256)",
112+
default="",
113+
help="specify checksum algorithm to use in comparison",
114114
)
115115
output_group = parser.add_argument_group("Output")
116116
output_group.add_argument(
@@ -146,7 +146,7 @@ def main(argv=None):
146146
"exclude_license": False,
147147
"debug": False,
148148
"format": "text",
149-
"checksum": "SHA256"
149+
"checksum": ""
150150
}
151151
raw_args = parser.parse_args(argv[1:])
152152
args = {key: value for key, value in vars(raw_args).items() if value}
@@ -249,7 +249,7 @@ def main(argv=None):
249249
package_info["license"] = license_info
250250
license_changes += 1
251251
diff_record = True
252-
if checksums1 is not None and checksums2 is not None:
252+
if args["checksum"] != "" and checksums1 is not None and checksums2 is not None:
253253
# compare checksums
254254
value1 = value2 = None
255255
for checksum in checksums1:
@@ -331,7 +331,8 @@ def main(argv=None):
331331
sbom_out.send_output(f"License changes: {license_changes}")
332332
sbom_out.send_output(f"Removed packages: {removed_packages}")
333333
sbom_out.send_output(f"New packages: {new_packages}")
334-
sbom_out.send_output(f"Checksum changes: {checksum_changes}")
334+
if args["checksum"] != "":
335+
sbom_out.send_output(f"Checksum changes: {checksum_changes}")
335336

336337
if args["format"] != "text":
337338
json_doc = {}
@@ -348,7 +349,8 @@ def main(argv=None):
348349
summary["removed_packages"] = removed_packages
349350
if not args["exclude_license"]:
350351
summary["license_changes"] = license_changes
351-
summary["checksum_changes"] = checksum_changes
352+
if args["checksum"] != "":
353+
summary["checksum_changes"] = checksum_changes
352354
json_doc["summary"] = summary
353355
sbom_out.generate_output(json_doc)
354356

0 commit comments

Comments
 (0)