9 Commits

Author SHA1 Message Date
Mike McQuaid
6bd0823f7e
sbom: fix dependency bottle information in SBOM.
This breaks the possibility for some `:all` bottle creation if they
reference a non-`:all` bottle as a dependency.

Instead, omit this information in the bottle and generate it only at
install time.
2024-05-26 16:48:48 +01:00
Mike McQuaid
7be26329c5
Apply suggestions from code review 2024-05-26 15:28:53 +01:00
Sean Molenaar
fdb347c35f
Update Library/Homebrew/sbom.rb
Co-authored-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2024-05-26 13:20:04 +02:00
Sean Molenaar
9d75d09a82
fix: allow not validating SBOM 2024-05-26 13:16:43 +02:00
Mike McQuaid
b066ac414c
SBOM: various fixes.
- be a bit stricter with SBOM handling with the test default formula
  flow in CI by making it raise errors if SBOM's aren't generated and
  validated as expected
- fix handling of HEAD installations of formulae so SBOM generation is
  both correct and doesn't raise errors
- make `Formula#bottle_hash` more accepting of edge cases e.g. HEAD-only
  formulae without a stable spec

Fixes #17333
2024-05-20 09:41:29 +01:00
Mike McQuaid
7461bf81a1
SBOM: more fixes.
- Remove use of (unused) `Cachable` module.
- Pass whether we're bottling to determine whether to create
  reproducible SBOM or not. A reproducible SBOM omits the time and
  compiler.
- Remove bottle information when bottling: we cannot know what e.g.
  the checksum (and, with GitHub Packages, therefore also the download
  location) will be before we've created the tarball contents.
- Always write a bottle on installation (unless we're bottling) to
  provide new bottle information or freshen the existing one with the
  information we stripped out for reproducibility e.g. the time and
  compiler.
- Don't need to handle a `nil` `@source_modified_time` as it's always
  set.

Fixes #17281
2024-05-13 07:36:51 +01:00
Sean Molenaar
df0bd4cd73 fix: use UTC for all SBOM times
Issue GH-17281
2024-05-12 10:56:10 +02:00
Mike McQuaid
442aa91704
SBOM improvements
- write a schema when installing formulae (if not already present)
- cache the schema on disk rather than downloading it every time
- make more methods/attributes `private`
- allow validation to be optional, only enable for Homebrew developers
  at installation time
- use the tab for more, correct information
- ensure that dependencies/bottles are written correctly
- use new SBOM 3 schema URL
- improve test coverage
2024-05-09 13:10:37 +01:00
Sean Molenaar
a43b7464c2 feat: add generated SPDX file on bottling 2024-05-07 20:33:22 +02:00