Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Library/Homebrew/extend/os/dev-cmd/bottle.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# typed: strict
# frozen_string_literal: true

require "extend/os/linux/dev-cmd/bottle" if OS.linux?
require "extend/os/mac/dev-cmd/bottle" if OS.mac?
32 changes: 32 additions & 0 deletions Library/Homebrew/extend/os/linux/dev-cmd/bottle.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# typed: strict
# frozen_string_literal: true

module OS
module Linux
module DevCmd
module Bottle
sig { params(formula: Formula).returns(T::Array[Regexp]) }
def formula_ignores(formula)
ignores = super

cellar_regex = Regexp.escape(HOMEBREW_CELLAR)
prefix_regex = Regexp.escape(HOMEBREW_PREFIX)

ignores << case formula.name
# On Linux, GCC installation can be moved so long as the whole directory tree is moved together:
# https://gcc-help.gcc.gnu.narkive.com/GnwuCA7l/moving-gcc-from-the-installation-path-is-it-allowed.
when Version.formula_optionally_versioned_regex(:gcc)
Regexp.union(%r{#{cellar_regex}/gcc}, %r{#{prefix_regex}/opt/gcc})
# binutils is relocatable for the same reason: https://github.com/Homebrew/brew/pull/11899#issuecomment-906804451.
when Version.formula_optionally_versioned_regex(:binutils)
%r{#{cellar_regex}/binutils}
end

ignores.compact
end
end
end
end
end

Homebrew::DevCmd::Bottle.prepend(OS::Linux::DevCmd::Bottle)
20 changes: 0 additions & 20 deletions Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,6 @@ def tar_args
def gnu_tar(gnu_tar_formula)
"#{gnu_tar_formula.opt_bin}/gtar"
end

sig { params(formula: Formula).returns(T::Array[Regexp]) }
def formula_ignores(formula)
ignores = super

cellar_regex = Regexp.escape(HOMEBREW_CELLAR)
prefix_regex = Regexp.escape(HOMEBREW_PREFIX)

ignores << case formula.name
# On Linux, GCC installation can be moved so long as the whole directory tree is moved together:
# https://gcc-help.gcc.gnu.narkive.com/GnwuCA7l/moving-gcc-from-the-installation-path-is-it-allowed.
when Version.formula_optionally_versioned_regex(:gcc)
Regexp.union(%r{#{cellar_regex}/gcc}, %r{#{prefix_regex}/opt/gcc}) if OS.linux?
# binutils is relocatable for the same reason: https://github.com/Homebrew/brew/pull/11899#issuecomment-906804451.
when Version.formula_optionally_versioned_regex(:binutils)
%r{#{cellar_regex}/binutils} if OS.linux?
end

ignores.compact
end
end
end
end
Expand Down
Loading