Bug 300098 - Mk: generate SBOM for all ports
Summary: Mk: generate SBOM for all ports
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Mathieu Arnold
URL: https://ron-dev.freebsd.org/FreeBSD/p...
Keywords:
Depends on:
Blocks:
 
Reported: 2026-10-26 17:34 UTC by Mathieu Arnold
Modified: 2026-11-04 07:18 UTC (History)
3 users (show)

See Also:
antoine: exp-run+


Attachments
sbom-D60441.diff (9.05 KB, patch)
2026-10-26 17:34 UTC, Mathieu Arnold
no flags Details | Diff
sbom-D60441.diff (9.05 KB, patch)
2026-10-31 06:42 UTC, Mathieu Arnold
no flags Details | Diff
sbo (11.47 KB, patch)
2026-11-01 08:04 UTC, Mathieu Arnold
no flags Details | Diff
sbom-D60441.diff v3 (11.47 KB, patch)
2026-11-01 08:05 UTC, Mathieu Arnold
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Arnold freebsd_committer freebsd_triage 2026-10-26 17:34:46 UTC
Created attachment 276507 [details]
sbom-D60441.diff

Please do an exp-run
Comment 1 Benjamin Takacs 2026-10-29 11:09:10 UTC
Wouldn't it make more sense to add that as a feature like debug, debuginfo, pie, testing, … instead of just generating that for all ports?

That would allow users to control it via the standard WITH{,OUT}_<feature> variables.
Comment 2 Antoine Brodin freebsd_committer freebsd_triage 2026-10-29 12:49:43 UTC
(In reply to Benjamin Takacs from comment #1)
This is not a feature, this is a few bytes txt file
Comment 3 Benjamin Takacs 2026-10-29 13:15:58 UTC
(In reply to Antoine Brodin from comment #2)
I don't see how the size matters in how it is integrated into the ports framework. And especially as that patch has DISABLE_SBOM to disable the generation, I think it is better to integrate it as a feature, giving the user the standard WITH{,OUT}_<feature> variables to control it, instead of creating a completely new variable.

Additionally is it fine for there to be no create-sbom target if it is disabled? 875:create-sbom gets added to _STAGE_SEQ unconditionally, but create-sbom only exists conditionally.
Comment 5 Mathieu Arnold freebsd_committer freebsd_triage 2026-10-29 20:10:18 UTC
(In reply to Benjamin Takacs from comment #3)
It's not a feature, features can be enabled/disabled per ports, this only works if all ports use it.
Comment 6 Mathieu Arnold freebsd_committer freebsd_triage 2026-10-29 20:11:43 UTC
(In reply to Antoine Brodin from comment #4)
Thank you, I'll investigate.
Comment 7 Mathieu Arnold freebsd_committer freebsd_triage 2026-10-29 20:15:37 UTC
(In reply to Benjamin Takacs from comment #3)
As for your second comment, most targets in all the _SEQ variables don't exist.
Comment 8 Mathieu Arnold freebsd_committer freebsd_triage 2026-10-31 06:42:26 UTC
Created attachment 276819 [details]
sbom-D60441.diff

Fixup quoting
Comment 9 void 2026-10-31 13:15:06 UTC
This looks great, can't wait to see it working :D
Comment 12 Mathieu Arnold freebsd_committer freebsd_triage 2026-11-01 08:04:23 UTC
Created attachment 276853 [details]
sbo
Comment 13 Mathieu Arnold freebsd_committer freebsd_triage 2026-11-01 08:05:25 UTC
Created attachment 276854 [details]
sbom-D60441.diff v3
Comment 14 Mathieu Arnold freebsd_committer freebsd_triage 2026-11-01 08:06:51 UTC
Ok, so, ports doing silly stuff with PLIST_FILES or TMPPLIST can be affected, those are fixed.
Comment 15 Antoine Brodin freebsd_committer freebsd_triage 2026-11-01 21:57:17 UTC
Exp-run seems fine
Comment 16 commit-hook freebsd_committer freebsd_triage 2026-11-04 07:14:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0774722088918fc0bf5bd9bef15b087ec8bef028

commit 0774722088918fc0bf5bd9bef15b087ec8bef028
Author:     Mathieu Arnold <mat@FreeBSD.org>
AuthorDate: 2026-10-07 14:16:46 +0000
Commit:     Mathieu Arnold <mat@FreeBSD.org>
CommitDate: 2026-11-04 07:12:21 +0000

    Mk: generate SBOM .pc files for all ports

    Each package and subpackage now installs an SBOM file in pkg-config
    format, see pc(5).  The file is installed in ${PREFIX}/share/sbom/pc/.
    The framework adds it to the plist automatically.

    PR:             300098
    Differential Revision:  https://reviews.freebsd.org/D60441

 CHANGES                         | 25 +++++++++++++++
 Mk/Scripts/check-stagedir.sh    |  4 +++
 Mk/Scripts/create-sbom.sh (new) | 70 +++++++++++++++++++++++++++++++++++++++++
 Mk/bsd.port.mk                  | 60 +++++++++++++++++++++++++++++++++++
 4 files changed, 159 insertions(+)