Skip to content

Commit

Permalink
Merge pull request strictdoc-project#1586 from strictdoc-project/spdx
Browse files Browse the repository at this point in the history
export/spdx: remove all TBDs for now as creating noise
  • Loading branch information
stanislaw authored Jan 10, 2024
2 parents 1d87663 + b3aec42 commit 481a03c
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions strictdoc/export/spdx/spdx_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def create_document(project_config: ProjectConfig) -> SpdxDocument:
root_element=["DUMMY_ROOT_ELEMENT(what is this for?)"],
creation_info=creation_info,
summary=f"SPDX Document for project {project_config.project_title}",
description="TBD",
comment="TBD",
description=None,
comment=None,
)
return spdx_document

Expand All @@ -108,15 +108,15 @@ def create_package(project_config: ProjectConfig) -> Package:
spdx_id="SPDXRef-PACKAGE",
name="Requirements package",
summary=f"SPDX Package for project {project_config.project_title}",
description="TBD",
comment="TBD",
description=None,
comment=None,
verified_using=[
Hash(
algorithm=HashAlgorithm.SHA256,
hash_value="TBD: What to calculate for a package?",
)
],
homepage="TBD",
homepage=None,
)

@staticmethod
Expand All @@ -125,8 +125,8 @@ def create_document_to_file(document: Document, document_bytes) -> File:
spdx_id=f"SPDXRef-File-{get_spdx_ref(document)}",
name=document.meta.document_filename,
summary=f"SDPX File for document {document.title}",
description=document.title,
comment="TBD",
description=None,
comment=None,
verified_using=[
Hash(
algorithm=HashAlgorithm.SHA256,
Expand All @@ -142,8 +142,8 @@ def convert_file_to_file(file: FileReference, file_bytes) -> File:
spdx_id=f"SPDXRef-File-{get_spdx_ref(file)}",
name=file.get_native_path(),
summary=f"SPDX File for source file {file.get_native_path()}",
description="TBD",
comment="TBD",
description=None,
comment=None,
verified_using=[
Hash(
algorithm=HashAlgorithm.SHA256,
Expand All @@ -163,10 +163,10 @@ def convert_requirement_to_snippet(
return Snippet(
spdx_id=f"SPDXRef-Snippet-{get_spdx_ref(requirement)}",
primary_purpose=SoftwarePurpose.DOCUMENTATION,
name=f"Requirement: {requirement.reserved_title}",
name=f"Requirement '{requirement.reserved_title}'",
summary=f"SPDX Snippet for requirement {requirement.reserved_uid}",
description="TBD",
comment="TBD",
description=None,
comment=None,
verified_using=[
Hash(
algorithm=HashAlgorithm.SHA256,
Expand Down Expand Up @@ -212,14 +212,14 @@ def export_tree(
from_element=spdx_document.spdx_id,
relationship_type=RelationshipType.CONTAINS,
to=[spdx_package.spdx_id],
name="TBD",
name=None,
summary=create_relationship_summary(
spdx_document,
spdx_package,
"CONTAINS",
),
description="TBD",
comment="TBD",
description=None,
comment=None,
)
)

Expand Down Expand Up @@ -259,6 +259,10 @@ def export_tree(
if node.reserved_uid is None:
continue

assert (
node.reserved_title is not None
), "The current implementation only supports requirements with a title."

"""
Create SPDX Snippet from SDoc Requirement.
"""
Expand All @@ -277,14 +281,14 @@ def export_tree(
from_element=spdx_file.spdx_id,
relationship_type=RelationshipType.CONTAINS,
to=[spdx_snippet.spdx_id],
name="TBD",
name=None,
summary=create_relationship_summary(
spdx_file,
spdx_snippet,
"CONTAINS",
),
description="TBD",
comment="TBD",
description=None,
comment=None,
)
)

Expand All @@ -307,14 +311,14 @@ def export_tree(
from_element=spdx_snippet.spdx_id,
relationship_type=RelationshipType.REQUIREMENT_FOR,
to=[spdx_file.spdx_id],
name="TBD",
name=None,
summary=create_relationship_summary(
spdx_snippet,
spdx_file,
"REQUIREMENT_FOR",
),
description="TBD",
comment="TBD",
description=None,
comment=None,
)
)

Expand Down Expand Up @@ -350,14 +354,14 @@ def export_tree(
from_element=requirement_snippet.spdx_id,
relationship_type=RelationshipType.REQUIREMENT_FOR,
to=[parent_requirement_snippet.spdx_id],
name="TBD",
name=None,
summary=create_relationship_summary(
requirement_snippet,
parent_requirement_snippet,
"REQUIREMENT_FOR",
),
description="TBD",
comment="TBD",
description=None,
comment=None,
)
)

Expand Down

0 comments on commit 481a03c

Please sign in to comment.