Skip to content

Commit e5533a9

Browse files
committed
refactor(sbom): drop unreachable git_root fallback
Both live DEP_META entries (libz, liboqs) are pkg-config; the git-describe path was dead.
1 parent 331cd81 commit e5533a9

2 files changed

Lines changed: 11 additions & 32 deletions

File tree

Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@ sbom:
439439
--lib "$$sbom_lib" \
440440
--dep-libz $(ENABLED_LIBZ) \
441441
--dep-liboqs $(ENABLED_LIBOQS) \
442-
--git '$(GIT)' \
443442
--cdx-out $(abs_builddir)/$(SBOM_CDX) \
444443
--spdx-out $(abs_builddir)/$(SBOM_SPDX); \
445444
$(PYSPDXTOOLS) --infile $(abs_builddir)/$(SBOM_SPDX) \

scripts/gen-sbom

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,6 @@ def sha256_file(path):
207207
return h.hexdigest()
208208

209209

210-
GIT_BIN = None
211-
212-
213210
def pkgconfig_version(pkgname):
214211
"""Return version string from pkg-config, or None if unavailable."""
215212
try:
@@ -224,30 +221,18 @@ def pkgconfig_version(pkgname):
224221
return None
225222

226223

227-
def git_describe_version(root, git_bin):
228-
"""Return version from git describe --tags --always, or None."""
229-
if not root or not git_bin:
230-
return None
231-
try:
232-
r = subprocess.run(
233-
[git_bin, '-C', root, 'describe', '--tags', '--always'],
234-
capture_output=True, text=True
235-
)
236-
if r.returncode == 0:
237-
return r.stdout.strip()
238-
except FileNotFoundError:
239-
pass
240-
return None
241-
242-
243224
def dep_version(key):
244-
pkgname = DEP_META[key]['pkgconfig']
245-
if pkgname:
246-
return pkgconfig_version(pkgname)
247-
git_root = DEP_META[key].get('git_root')
248-
if git_root:
249-
return git_describe_version(git_root, GIT_BIN)
250-
return None
225+
"""Resolve the runtime version of a DEP_META entry.
226+
227+
Every live entry exposes a `pkgconfig` package name; if pkg-config
228+
cannot answer (package missing or `.pc` not on PKG_CONFIG_PATH) we
229+
return None and the caller emits NOASSERTION (SPDX) / omits the
230+
version (CycloneDX). A previous source-tree fallback that used
231+
`git describe` against `git_root` was removed once libxmss/liblms
232+
were dropped upstream; if a future PQ dep returns to a source-only
233+
integration, restore the fallback here together with a `git_root`
234+
field on the DEP_META entry."""
235+
return pkgconfig_version(DEP_META[key]['pkgconfig'])
251236

252237

253238
def parse_options_h(path):
@@ -484,17 +469,12 @@ def main():
484469
help='yes if built with --with-liboqs (the package '
485470
'wolfSSL links against; --enable-falcon implies '
486471
'this in any legal configuration)')
487-
parser.add_argument('--git', default='',
488-
help='Path to git binary for version detection')
489472
parser.add_argument('--cdx-out', required=True,
490473
help='Output path for CycloneDX JSON')
491474
parser.add_argument('--spdx-out', required=True,
492475
help='Output path for SPDX JSON')
493476
args = parser.parse_args()
494477

495-
global GIT_BIN
496-
GIT_BIN = args.git or None
497-
498478
enabled_deps = [
499479
key for key, flag in [
500480
('libz', args.dep_libz),

0 commit comments

Comments
 (0)