Repository navigation
Conversation
…dirs sbom.cmake kept its own directory and the python3 it found in ordinary variables, which are scoped to the directory that include()d it. A project that includes the fragment in one subdirectory and calls wolfssl_compliance_tooling_add_sbom() from another failed at configure time with "python3 was not found", and the driver and script paths there were empty as well. The fragment now also records both in global properties, and the helpers fall back to them only when the calling directory has no value of its own. A call from a directory that included a copy, or from one of its children, uses that copy, so a subproject vendoring a different pin no longer redirects the top project's SBOM to its driver. A call from an unrelated sibling uses the copy included last, as the function definition itself does. sbom-with-sde.cmake took the commit time only when SBOM_ROOT was the git toplevel, so a ROOT in a subdirectory of its own repository got gen-sbom's default timestamp instead. It now uses the commit time when SBOM_ROOT holds tracked files (git ls-files --error-unmatch -- .). A release tarball unpacked into an untracked directory of another checkout holds none, so it still does not take the outer commit time. A ROOT holding any file tracked by another repository, such as a committed copy or a wrapper CMakeLists.txt next to an unpacked tarball, takes that repository's commit time. sbom.am used any enclosing git repository; it now applies the same check to srcdir. test_sbom_cmake_install.py covers a call from a sibling directory (configure, sbom and install-sbom), a top project next to a subproject with its own copy, and a tracked subdirectory ROOT.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The scoped fallbacks and tracked-file timestamp checks are consistent with the intended behavior, with regression coverage and no identified blocking issues.
No open issues 🎉
What changed in this PR
This follow-up to #36 makes the CMake SBOM helpers usable across sibling directories while preserving each caller’s local tooling copy. It also aligns timestamp selection between CMake and Automake.
Changes:
- Add global fallbacks for helper paths and Python without overriding directory-local values.
- Use the enclosing repository’s commit time for roots containing tracked files, excluding untracked nested tarballs.
- Add regression tests for sibling-directory calls, vendored-copy isolation, and tracked-subdirectory timestamps.
| File | Description |
|---|---|
| tests/test_sbom_cmake_install.py | Adds directory-scope and timestamp regression tests. |
| share/sbom.am | Requires tracked files before using Git’s commit time. |
| share/build/sbom.cmake | Adds directory-aware fallbacks for generation and installation helpers. |
| share/build/sbom-with-sde.cmake | Extends commit-time selection to tracked subdirectories. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to #36 for the CMake helper's directory scope, plus a refinement of the
SOURCE_DATE_EPOCHlookup.sbom.cmakekept its own directory and the python3 it found in directory-scoped variables. Including it in one subdirectory and callingwolfssl_compliance_tooling_add_sbom()from another failed at configure time with "python3 was not found", with empty driver and script paths behind it. The fragment now also records both in global properties, used only when the calling directory has no value of its own. A call from a directory that included a copy, or from its children, uses that copy, so a subproject vendoring a different pin no longer redirects the top project's SBOM. A call from an unrelated sibling uses the copy included last, as the function definition does.sbom-with-sde.cmakeused the commit time only whenSBOM_ROOTwas the git toplevel, so aROOTbelow its own repo's top got gen-sbom's default timestamp. It now uses the commit time whenSBOM_ROOTholds tracked files (git ls-files --error-unmatch -- .). A tarball unpacked into an untracked directory of another checkout holds none, so it still does not inherit the outer commit time. AROOTholding any file tracked by another repository (a committed copy, or a wrapperCMakeLists.txtnext to an unpacked tarball) takes that repository's commit time.sbom.amused any enclosing repository's commit time; it now applies the same tracked-files check tosrcdir.Tests
test_call_from_a_sibling_directory_builds(configure,sbom,install-sbom),test_call_uses_its_own_directory_copyandtest_tracked_subdirectory_uses_the_commit_timeintest_sbom_cmake_install.py. The first and last fail on master; the middle one guards against a regression a global-only lookup would cause. A superbuild mixing this copy with a pre-fix one also builds for calls from directories that included a copy (checked by hand).