Skip to content

Commit

Permalink
Fix document-level SPDX identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
twaugh committed Aug 21, 2024
1 parent 1ea7577 commit 59c21e6
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-0",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -98,7 +98,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-0",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-image-index"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-1",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -3995,7 +3995,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-1",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-kernel-module-management-operator-container-amd64"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-2",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -3995,7 +3995,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-2",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-kernel-module-management-operator-container-arm64"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-3",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -3995,7 +3995,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-3",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-kernel-module-management-operator-container-ppc64le"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-0",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -144,7 +144,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-0",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-image-index"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-4",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -480,7 +480,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-4",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-ubi9-micro-container-amd64"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-3",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -480,7 +480,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-3",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-ubi9-micro-container-arm64"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-1",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -480,7 +480,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-1",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-ubi9-micro-container-ppc64le"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-2",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -480,7 +480,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-2",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-ubi9-micro-container-s390x"
},
Expand Down
9 changes: 3 additions & 6 deletions sbom/examples/container_image/release/from_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def get_rpms(image_id):
return sorted(response.json()["rpms"], key=lambda rpm: rpm["nvra"])


def create_sbom(doc_id, image_id, root_package, packages, rel_type):
def create_sbom(image_id, root_package, packages, rel_type):
relationships = [
{
"spdxElementId": f"SPDXRef-DOCUMENT-{doc_id}",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": root_package["SPDXID"],
}
Expand All @@ -53,7 +53,7 @@ def create_sbom(doc_id, image_id, root_package, packages, rel_type):
spdx = {
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": f"SPDXRef-DOCUMENT-{doc_id}",
"SPDXID": f"SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand All @@ -77,7 +77,6 @@ def generate_sboms_for_image(image_nvr):

image_index_pkg = None
per_arch_images = []
doc_id_generator = itertools.count(1) # Reserve 0 for the image list SBOM.

for image in get_image_data(image_nvr):
packages = []
Expand Down Expand Up @@ -219,15 +218,13 @@ def generate_sboms_for_image(image_nvr):
packages.append(rpm_pkg)

create_sbom(
doc_id=next(doc_id_generator),
image_id=f"{image_nvr}_" f"{image['architecture']}",
root_package=image_pkg,
packages=packages,
rel_type="CONTAINS",
)

create_sbom(
doc_id=0,
image_id=image_nvr,
root_package=image_index_pkg,
packages=per_arch_images,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-0",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -98,7 +98,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-0",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-image-index"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-1",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -3995,7 +3995,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-1",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-kernel-module-management-operator-container-amd64"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-2",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -3995,7 +3995,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-2",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-kernel-module-management-operator-container-arm64"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-3",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -3995,7 +3995,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-3",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-kernel-module-management-operator-container-ppc64le"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-0",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -144,7 +144,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-0",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-image-index"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-4",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -480,7 +480,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-4",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-ubi9-micro-container-amd64"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-3",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -480,7 +480,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-3",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-ubi9-micro-container-arm64"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-1",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -480,7 +480,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-1",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-ubi9-micro-container-ppc64le"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-2",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down Expand Up @@ -480,7 +480,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-DOCUMENT-2",
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-ubi9-micro-container-s390x"
},
Expand Down
2 changes: 1 addition & 1 deletion sbom/examples/product/rhel-9.2-eus.spdx.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spdxVersion": "SPDX-2.3",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT-4d3d9002-fd75-4329-92f2-4271e186e32c",
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2006-08-14T02:34:56-06:00",
"creators": [
Expand Down

0 comments on commit 59c21e6

Please sign in to comment.