INNER CODE UNIT · Python
pinned_commit
toyota-connected/ivi-homescreen · scripts/gen_sbom.py:69
def pinned_commit(root, path):
"""The commit this repository pins, without needing the submodule checked out."""
line = run(["git", "ls-tree", "HEAD", path], cwd=root)
if not line:
raise SystemExit(f"gen_sbom: {path} is in .gitmodules but not in the tree")
return line.split()[2]
def component(name, version, purl, license_id, url=None):
entry = {
"type": "library",
"name": name,
"version": version,
"purl": purl,
"licenses": [{"license": {"id": license_id}}],
}
if url:
entry["externalReferences"] = [{"type": "vcs", "url": url}]