Skip to content

Commit

Permalink
formula_installer: handle unexpected .brew presence/absence
Browse files Browse the repository at this point in the history
  • Loading branch information
EricFromCanada committed Apr 12, 2022
1 parent e1c1157 commit 3c1d0ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Library/Homebrew/formula_cellar_checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ def check_service_command(formula)
end

def check_cpuid_instruction(formula)
return unless formula.prefix.directory?
# TODO: add methods to `utils/ast` to allow checking for method use
return unless (formula.prefix/".brew/#{formula.name}.rb").read.include? "ENV.runtime_cpu_detection"
# Checking for `cpuid` only makes sense on Intel:
# https://en.wikipedia.org/wiki/CPUID
return unless Hardware::CPU.intel?
return unless (formula.prefix/".brew/#{formula.name}.rb").exist?
# TODO: add methods to `utils/ast` to allow checking for method use
return unless (formula.prefix/".brew/#{formula.name}.rb").read.include? "ENV.runtime_cpu_detection"

# macOS `objdump` is a bit slow, so we prioritise llvm's `llvm-objdump` (~5.7x faster)
# or binutils' `objdump` (~1.8x faster) if they are installed.
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def install
end
s = formula_contents.gsub(/ bottle do.+?end\n\n?/m, "")
brew_prefix = formula.prefix/".brew"
brew_prefix.mkdir
brew_prefix.mkpath
Pathname(brew_prefix/"#{formula.name}.rb").atomic_write(s)

keg = Keg.new(formula.prefix)
Expand Down

0 comments on commit 3c1d0ef

Please sign in to comment.