mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[3.12] gh-112844: Update CPE references for external dependencies (GH-118521) (#119238)
Co-authored-by: Seth Michael Larson <seth@python.org>
This commit is contained in:
parent
a50f0651ee
commit
386e49259c
1 changed files with 15 additions and 1 deletions
|
@ -305,7 +305,21 @@ def create_externals_sbom() -> None:
|
||||||
|
|
||||||
# Set the versionInfo and downloadLocation fields for all packages.
|
# Set the versionInfo and downloadLocation fields for all packages.
|
||||||
for package in sbom_data["packages"]:
|
for package in sbom_data["packages"]:
|
||||||
package["versionInfo"] = externals_name_to_version[package["name"]]
|
package_version = externals_name_to_version[package["name"]]
|
||||||
|
|
||||||
|
# Update the version information in all the locations.
|
||||||
|
package["versionInfo"] = package_version
|
||||||
|
for external_ref in package["externalRefs"]:
|
||||||
|
if external_ref["referenceType"] != "cpe23Type":
|
||||||
|
continue
|
||||||
|
# Version is the fifth field of a CPE.
|
||||||
|
cpe23ref = external_ref["referenceLocator"]
|
||||||
|
external_ref["referenceLocator"] = re.sub(
|
||||||
|
r"\A(cpe(?::[^:]+){4}):[^:]+:",
|
||||||
|
fr"\1:{package_version}:",
|
||||||
|
cpe23ref
|
||||||
|
)
|
||||||
|
|
||||||
download_location = (
|
download_location = (
|
||||||
f"https://github.com/python/cpython-source-deps/archive/refs/tags/{externals_name_to_git_tag[package['name']]}.tar.gz"
|
f"https://github.com/python/cpython-source-deps/archive/refs/tags/{externals_name_to_git_tag[package['name']]}.tar.gz"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue