From 9d75d09a821adfe2cda386ba59cb88b0703e5aab Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Sun, 26 May 2024 13:16:43 +0200 Subject: [PATCH] fix: allow not validating SBOM --- Library/Homebrew/sbom.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/sbom.rb b/Library/Homebrew/sbom.rb index c57193f1a3..6b4d559a8b 100644 --- a/Library/Homebrew/sbom.rb +++ b/Library/Homebrew/sbom.rb @@ -121,12 +121,12 @@ class SBOM 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! @@ -156,7 +156,8 @@ class SBOM # 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