Skip to content

Commit

Permalink
sbom: ensure Homebrew versions are more consistent.
Browse files Browse the repository at this point in the history
Avoid making bottles non-reproducible by ensuring that the Homebrew
version doesn't include the full commit hash but just a `-dev` suffix.

This is similar to the approach we use for analytics.
  • Loading branch information
MikeMcQuaid committed Jul 26, 2024
1 parent c3ae032 commit f0e5347
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Library/Homebrew/sbom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ def self.create(formula, tab)
end
active_spec_sym = formula.active_spec_sym

homebrew_version_maybe_dev = if (match_data = HOMEBREW_VERSION.match(/^[\d.]+/))
suffix = "-dev" if HOMEBREW_VERSION.include?("-")
match_data[0] + suffix.to_s
else
HOMEBREW_VERSION
end

attributes = {
name: formula.name,
homebrew_version: HOMEBREW_VERSION,
homebrew_version: homebrew_version_maybe_dev,
spdxfile: SBOM.spdxfile(formula),
time: tab.time,
source_modified_time: tab.source_modified_time.to_i,
Expand Down

0 comments on commit f0e5347

Please sign in to comment.