Skip to content

Commit e694e76

Browse files
authored
Merge pull request #20120 from Homebrew/remove_alias_generic
Remove `alias generic_*` definitions in favour of using `super`
2 parents b6167f6 + 9ac306e commit e694e76

33 files changed

Lines changed: 1124 additions & 1035 deletions

Library/Homebrew/api/analytics.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class << self
1010
def analytics_api_path
1111
"analytics"
1212
end
13-
alias generic_analytics_api_path analytics_api_path
1413

1514
sig { params(category: String, days: T.any(Integer, String)).returns(T::Hash[String, T.untyped]) }
1615
def fetch(category, days)

Library/Homebrew/dev-cmd/update-test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def run
142142

143143
private
144144

145+
sig { returns(String) }
145146
def git_tags
146147
tags = Utils.popen_read("git", "tag", "--list", "--sort=-version:refname")
147148
if tags.blank?

Library/Homebrew/diagnostic.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ def check_tmpdir_sticky_bit
350350
sudo chmod +t #{HOMEBREW_TEMP}
351351
EOS
352352
end
353-
alias generic_check_tmpdir_sticky_bit check_tmpdir_sticky_bit
354353

355354
def check_exist_directories
356355
return if HOMEBREW_PREFIX.writable?

Library/Homebrew/extend/ENV/shared.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_a
5454
@debug_symbols = debug_symbols
5555
reset
5656
end
57-
alias generic_shared_setup_build_environment setup_build_environment
58-
private :generic_shared_setup_build_environment
5957

6058
sig { void }
6159
def reset

Library/Homebrew/extend/ENV/std.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_a
6868
gcc_formula = gcc_version_formula(cc)
6969
append_path "PATH", gcc_formula.opt_bin.to_s
7070
end
71-
alias generic_setup_build_environment setup_build_environment
7271

7372
sig { returns(T.nilable(PATH)) }
7473
def determine_pkg_config_libdir

Library/Homebrew/extend/ENV/super.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_a
125125
# These flags will also be present:
126126
# a - apply fix for apr-1-config path
127127
end
128-
alias generic_setup_build_environment setup_build_environment
129128

130129
private
131130

@@ -152,7 +151,6 @@ def homebrew_extra_paths
152151
.reverse
153152
.map { |d| d.opt_libexec/"bin" }
154153
end
155-
alias generic_homebrew_extra_paths homebrew_extra_paths
156154

157155
sig { returns(T.nilable(PATH)) }
158156
def determine_path
@@ -372,8 +370,8 @@ def refurbish_args
372370
append_to_cccfg "O"
373371
end
374372

373+
# This is an exception where we want to use this method name format.
375374
# rubocop: disable Naming/MethodName
376-
# Fixes style error `Naming/MethodName: Use snake_case for method names.`
377375
sig { params(block: T.nilable(T.proc.void)).void }
378376
def O0(&block)
379377
if block
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# typed: strict
22
# frozen_string_literal: true
33

4-
module Homebrew
5-
module DevCmd
6-
class UpdateTest < AbstractCommand
7-
alias generic_git_tags git_tags
4+
module OS
5+
module Linux
6+
module DevCmd
7+
module UpdateTest
8+
private
89

9-
private
10-
11-
sig { returns(String) }
12-
def git_tags
13-
tags = generic_git_tags
14-
tags = Utils.popen_read("git tag --list | sort -rV") if tags.blank?
15-
tags
10+
sig { returns(String) }
11+
def git_tags
12+
super.presence || Utils.popen_read("git tag --list | sort -rV")
13+
end
1614
end
1715
end
1816
end
1917
end
18+
19+
Homebrew::DevCmd::UpdateTest.prepend(OS::Linux::DevCmd::UpdateTest)

Library/Homebrew/extend/os/linux/development_tools.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def needs_compiler_formula?
6262
def build_system_info
6363
super.merge({
6464
"glibc_version" => OS::Linux::Glibc.version.to_s.presence,
65-
"oldest_cpu_family" => Hardware.oldest_cpu.to_s,
65+
"oldest_cpu_family" => ::Hardware.oldest_cpu.to_s,
6666
})
6767
end
6868
end

Library/Homebrew/extend/os/linux/diagnostic.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def supported_configuration_checks
3232
end
3333

3434
def check_tmpdir_sticky_bit
35-
message = generic_check_tmpdir_sticky_bit
35+
message = super
3636
return if message.nil?
3737

3838
message + <<~EOS
@@ -74,11 +74,11 @@ def check_umask_not_zero
7474
end
7575

7676
def check_supported_architecture
77-
return if Hardware::CPU.intel?
78-
return if Homebrew::EnvConfig.developer? && ENV["HOMEBREW_ARM64_TESTING"].present? && Hardware::CPU.arm?
77+
return if ::Hardware::CPU.intel?
78+
return if Homebrew::EnvConfig.developer? && ENV["HOMEBREW_ARM64_TESTING"].present? && ::Hardware::CPU.arm?
7979

8080
<<~EOS
81-
Your CPU architecture (#{Hardware::CPU.arch}) is not supported. We only support
81+
Your CPU architecture (#{::Hardware::CPU.arch}) is not supported. We only support
8282
x86_64 CPU architectures. You will be unable to use binary packages (bottles).
8383
8484
#{support_tier_message(tier: 2)}
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
# typed: true # rubocop:todo Sorbet/StrictSigil
22
# frozen_string_literal: true
33

4-
module SharedEnvExtension
5-
def effective_arch
6-
if @build_bottle && @bottle_arch
7-
@bottle_arch.to_sym
8-
elsif @build_bottle
9-
Hardware.oldest_cpu
10-
elsif Hardware::CPU.intel? || Hardware::CPU.arm?
11-
:native
12-
else
13-
:dunno
4+
module OS
5+
module Linux
6+
module SharedEnvExtension
7+
def effective_arch
8+
if @build_bottle && @bottle_arch
9+
@bottle_arch.to_sym
10+
elsif @build_bottle
11+
::Hardware.oldest_cpu
12+
elsif ::Hardware::CPU.intel? || ::Hardware::CPU.arm?
13+
:native
14+
else
15+
:dunno
16+
end
17+
end
1418
end
1519
end
1620
end
21+
22+
SharedEnvExtension.prepend(OS::Linux::SharedEnvExtension)

0 commit comments

Comments
 (0)