Repository navigation
cmake: add install-sbom and uninstall-sbom targets - #36
Conversation
There was a problem hiding this comment.
🟡 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_EPOCHat 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.
|
@MarkAtwood the four review findings stay fixed, and this branch now includes current master.
The CMake function name is |
Frauschi
left a comment
There was a problem hiding this comment.
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 atinclude()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.
MarkAtwood
left a comment
There was a problem hiding this comment.
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
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.
296953a to
20bcb13
Compare
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>
|
@Frauschi conflicts with master are resolved in 0eefff7.
The earlier points stay fixed on this commit: |
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.
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.
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.


Summary
wolfssl_compliance_tooling_add_sbom()createsinstall-sbomanduninstall-sbom. The install copies the CycloneDX and SPDX files the caller set.DESTDIRis applied when the target runs.--version=<value>, so CMake before 3.24 does not treat it as its own flag. The toplevel check usesget_filename_component(... REALPATH), which CMake 3.16 provides.INSTALL_TARGETandUNINSTALL_TARGET.DEP_LIBZandDOCUMENT_NAMESPACEstay in sbom: record a traced library, zlib, and explicit dependency versions #37.Implements #34.
Test plan
python3 tests/test_sbom_cmake_install.pypython3 -m unittest tests.test_low_findingscmake --build build --target install-sbominstalls the config-tag fileswolfssl_compliance_tooling_add_sbom_install(DEPENDS sbom TV ...)and installs the tag-value file