Skip to content

cmake: add install-sbom and uninstall-sbom targets - #36

Merged
Frauschi merged 2 commits into
masterfrom
feat/cmake-install-sbom
Oct 22, 2026
Merged

Frauschi merged 2 commits into
masterfrom
feat/cmake-install-sbom

Conversation

@sameehj

@sameehj sameehj commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • wolfssl_compliance_tooling_add_sbom() creates install-sbom and uninstall-sbom. The install copies the CycloneDX and SPDX files the caller set. DESTDIR is applied when the target runs.
  • The helper uses the renamed script directory. Git supplies a commit time only when the source tree is the repository toplevel.
  • The driver version is --version=<value>, so CMake before 3.24 does not treat it as its own flag. The toplevel check uses get_filename_component(... REALPATH), which CMake 3.16 provides.
  • A second call in the same tree sets INSTALL_TARGET and UNINSTALL_TARGET.
  • DEP_LIBZ and DOCUMENT_NAMESPACE stay in sbom: record a traced library, zlib, and explicit dependency versions #37.

Implements #34.

Test plan

  • python3 tests/test_sbom_cmake_install.py
  • python3 -m unittest tests.test_low_findings
  • After the vendor sync, wolfBoot cmake --build build --target install-sbom installs the config-tag files
  • After the vendor sync, wolfTPM calls wolfssl_compliance_tooling_add_sbom_install(DEPENDS sbom TV ...) and installs the tag-value file

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

CMake optional-argument handling and Autotools namespace quoting break SBOM generation, and the dependency assertion can falsely pass.

3 open findings
What changed in this PR

Adds shared CMake SBOM installation targets, aligning product integrations with the Autotools workflow.

Changes:

  • Adds install/uninstall targets that preserve output filenames and honor runtime DESTDIR.
  • Forwards zlib and document-namespace options and reads SOURCE_DATE_EPOCH at build time.
  • Adds documentation and automated checks.
File Description
tests/​test_sbom_cmake_install.py Adds installation, timestamp, and target checks.
share/​sbom.am Forwards zlib and namespace options.
share/​sbom-driver.py Accepts and forwards new generator options.
share/​README.md Documents CMake installation integration.
share/​build/​uninstall-sbom.cmake Removes installed SBOM files.
share/​build/​sbom.mk Forwards zlib and namespace options.
share/​build/​sbom.cmake Adds installation targets and runtime timestamp wrapper.
share/​build/​sbom-with-sde.cmake Resolves build-time reproducibility timestamps.
share/​build/​sbom-paths.cmake Resolves shared SBOM output paths.
share/​build/​install-sbom.cmake Installs SBOM files with staging support.
README.md Notes the new CMake targets.
.github/​workflows/​selftest.yml Runs the new CMake checks.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread share/build/sbom.cmake Outdated
Comment thread share/sbom.am Outdated
Comment thread tests/test_sbom_cmake_install.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Namespace quoting breaks Autotools overrides, and implicit tag-value discovery can install stale artifacts.

4 open findings

🧠 Review effort: Balanced

Comment thread share/build/sbom-paths.cmake Outdated
@sameehj

sameehj commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@MarkAtwood the four review findings stay fixed, and this branch now includes current master.

  • The five CMake guards compare the quoted expansion, so an omitted keyword stays omitted and an explicit no is still forwarded.
  • --document-namespace is its own quoted argument. It is not stored inside dep_args.
  • The install test reads CMakeFiles/Makefile2 and checks the edge CMakeFiles/install-sbom.dir/all: CMakeFiles/sbom.dir/all.
  • The tag-value path stays empty unless the caller sets TV or TV_OUT. A stale .spdx sibling is not installed.

The CMake function name is wolfssl_compliance_tooling_add_sbom, matching master. tests.test_sbom_cmake_install passes. Please review.

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The install and uninstall scripts look good and the DESTDIR handling matches sbom.am. One blocker: the sbom target no longer runs after the rename merge. Two smaller things below, plus an overlap with #37 that will conflict whichever lands second.

Not blocking:

  • The driver path itself (_WOLFSSL_COMPLIANCE_TOOLING_DRIVER) is a normal variable set at include() time, so a call from a sibling directory gets no driver path. That predates this PR, but it now has three more users. I have a fix ready that moves both into a global property, stacked on this branch.

Comment thread share/build/sbom.cmake Outdated
Comment thread tests/test_sbom_cmake_install.py
Comment thread share/build/sbom-with-sde.cmake Outdated
Comment thread share/build/sbom.cmake Outdated
Comment thread share/build/sbom.cmake
MarkAtwood
MarkAtwood previously approved these changes Oct 20, 2026

@MarkAtwood MarkAtwood left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with two fixes inline, both only bite on cmake 3.16 to 3.23 so ci on 3.24+ can't see them. install and uninstall round trip clean on 3.28, with DESTDIR and with a prefix, uninstall only takes the 3 sbom files. frauschi's points all look addressed to me. a ci leg with pip install cmake==3.16.8 would have caught both. pr body and the first commit still talk about DEP_LIBZ/DOCUMENT_NAMESPACE and wolfglass_*, fix the body and squash on merge. heads up for the wolftpm sync, wolftpm-sbom-stage doesn't pin DESTDIR so DESTDIR=/pkg make install-sbom stages the lib under /pkg//_sbom_staging and generation fails, sbom.am:154 and wolfcert pin it

Comment thread share/build/sbom.cmake
Comment thread share/build/sbom-with-sde.cmake Outdated
Comment thread share/build/sbom.cmake
wolfssl_compliance_tooling_add_sbom() now adds install-sbom and
uninstall-sbom. The install copies the CycloneDX and SPDX files the
caller set, and DESTDIR is applied when the target runs. The script
directory uses the renamed variable. Git supplies a commit time only
when the source tree is the repository toplevel.

CMake before 3.24 treats a separate --version after -P as its own
flag, so the driver version is one argument. The toplevel check uses
get_filename_component, which CMake 3.16 provides. A second call can
name its install targets. The low-findings tests load modules with
exec_module for Python 3.15.
@sameehj
sameehj force-pushed the feat/cmake-install-sbom branch from 296953a to 20bcb13 Compare October 21, 2026 01:48
@sameehj

sameehj commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

The branch is now one commit, 20bcb13. The description uses the renamed helper and leaves DEP_LIBZ and DOCUMENT_NAMESPACE in #37.

The wolfTPM DESTDIR pin stays with the product sync. wolfCert already pins it. sbom.am in this repository is unchanged.

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sameehj Please fix conflicts, otherwise LGTM. This now also contains my #41 Python 3.15 fixes, so I'll close #41.

Keep the install targets and the quoted dependency guards, and take
the zlib, namespace, and user-settings options that landed on master.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sameehj

sameehj commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@Frauschi conflicts with master are resolved in 0eefff7.

  • selftest.yml keeps test_sbom_cmake_install.py and adds test_sbom_autotools.py.
  • sbom.cmake keeps the install targets and the quoted dependency guards. It also takes DEP_LIBZ, DOCUMENT_NAMESPACE, and the user-settings options from master.
  • DEP_LIBZ uses the quoted guard, so an explicit no is still forwarded.

The earlier points stay fixed on this commit: --version=${SB_VERSION}, get_filename_component(... REALPATH), and INSTALL_TARGET.

@Frauschi
Frauschi merged commit 783a4dc into master Oct 22, 2026
3 checks passed
@Frauschi
Frauschi deleted the feat/cmake-install-sbom branch October 22, 2026 10:43
sameehj added a commit that referenced this pull request Oct 22, 2026
SourceFileLoader.load_module is gone in Python 3.15, so the low-findings
self-test exited before it ran. Use exec_module, and pass maxsplit to
re.split by name. This is the same fix that landed with #36.
sameehj added a commit that referenced this pull request Oct 22, 2026
SourceFileLoader.load_module is gone in Python 3.15, so the low-findings
self-test exited before it ran. Use exec_module, and pass maxsplit to
re.split by name. This is the same fix that landed with #36.
sameehj added a commit that referenced this pull request Oct 22, 2026
SourceFileLoader.load_module is gone in Python 3.15, so the low-findings
self-test exited before it ran. Use exec_module, and pass maxsplit to
re.split by name. This is the same fix that landed with #36.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants