Skip to content

Commit

Permalink
fix: allow not validating SBOM
Browse files Browse the repository at this point in the history
  • Loading branch information
SMillerDev authored May 26, 2024
1 parent 9e2ff32 commit 9d75d09
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Library/Homebrew/sbom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ def self.fetch_schema!
end
end

sig { params(bottling: T::Boolean).returns(T::Boolean) }
sig { params(bottling: T::Boolean).returns(T.nilable(T::Boolean)) }
def valid?(bottling: false)
unless require? "json_schemer"
error_message = "Need json_schemer to validate SBOM, run `brew install-bundler-gems --add-groups=bottle`!"
odie error_message if ENV["HOMEBREW_ENFORCE_SBOM"]
return false
return nil
end

schema = SBOM.fetch_schema!
Expand Down Expand Up @@ -156,7 +156,8 @@ def write(validate: true, bottling: false)
# will no longer be valid.
Formula.clear_cache unless spdxfile.exist?

if validate && !valid?(bottling:)
valid = valid?(bottling:)
if validate && valid.present? && !valid
opoo "SBOM is not valid, not writing to disk!"
return
end
Expand Down

0 comments on commit 9d75d09

Please sign in to comment.