Skip to content

Commit

Permalink
Merge pull request #144 from peakschris/purl
Browse files Browse the repository at this point in the history
include purl in sbom tooling
  • Loading branch information
aiuto authored Aug 15, 2024
2 parents 3c94bd2 + 324d87c commit 8d02262
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion rules_gathering/gather_metadata.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ def metadata_info_to_json(metadata_info):
"bazel_package": "{bazel_package}",
"package_name": "{package_name}",
"package_url": "{package_url}",
"package_version": "{package_version}"
"package_version": "{package_version}",
"purl": "{purl}"
}}"""

# Build reverse map of license to user
Expand Down Expand Up @@ -284,6 +285,7 @@ def metadata_info_to_json(metadata_info):
package_name = mi.package_name,
package_url = mi.package_url,
package_version = mi.package_version,
purl = mi.purl,
))
# experimental: Support the ExperimentalMetadataInfo bag of data
# WARNING: Do not depend on this. It will change without notice.
Expand All @@ -295,6 +297,7 @@ def metadata_info_to_json(metadata_info):
package_name = mi.data.get("package_name") or "",
package_url = mi.data.get("package_url") or "",
package_version = mi.data.get("package_version") or "",
purl = mi.data.get("purl") or "",
))

return [main_template.format(
Expand Down
4 changes: 3 additions & 1 deletion tools/sbom.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ def write_packages(self, packages):
if url:
self.out.write(' downloadLocation: %s\n' % url)


purl = p.get('purl')
if purl:
self.out.write(' externalRef: PACKAGE-MANAGER purl %s\n' % purl)

0 comments on commit 8d02262

Please sign in to comment.