-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
223 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module Homebrew | ||
module OS | ||
module Linux | ||
module Cleanup | ||
extend T::Helpers | ||
module OS | ||
module Linux | ||
module Cleanup | ||
extend T::Helpers | ||
|
||
requires_ancestor { Homebrew::Cleanup } | ||
requires_ancestor { Homebrew::Cleanup } | ||
|
||
sig { returns(T::Boolean) } | ||
def use_system_ruby? | ||
return false if Homebrew::EnvConfig.force_vendor_ruby? | ||
sig { returns(T::Boolean) } | ||
def use_system_ruby? | ||
return false if Homebrew::EnvConfig.force_vendor_ruby? | ||
|
||
rubies = [which("ruby"), which("ruby", ORIGINAL_PATHS)].compact | ||
system_ruby = Pathname.new("/usr/bin/ruby") | ||
rubies << system_ruby if system_ruby.exist? | ||
rubies = [which("ruby"), which("ruby", ORIGINAL_PATHS)].compact | ||
system_ruby = Pathname.new("/usr/bin/ruby") | ||
rubies << system_ruby if system_ruby.exist? | ||
|
||
check_ruby_version = HOMEBREW_LIBRARY_PATH/"utils/ruby_check_version_script.rb" | ||
rubies.uniq.any? do |ruby| | ||
quiet_system ruby, "--enable-frozen-string-literal", "--disable=gems,did_you_mean,rubyopt", | ||
check_ruby_version, RUBY_VERSION | ||
end | ||
check_ruby_version = HOMEBREW_LIBRARY_PATH/"utils/ruby_check_version_script.rb" | ||
rubies.uniq.any? do |ruby| | ||
quiet_system ruby, "--enable-frozen-string-literal", "--disable=gems,did_you_mean,rubyopt", | ||
check_ruby_version, RUBY_VERSION | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Homebrew::Cleanup.prepend(Homebrew::OS::Linux::Cleanup) | ||
Homebrew::Cleanup.prepend(OS::Linux::Cleanup) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module Homebrew | ||
module OS | ||
module Linux | ||
module CLI | ||
module Parser | ||
extend T::Helpers | ||
module OS | ||
module Linux | ||
module CLI | ||
module Parser | ||
extend T::Helpers | ||
|
||
requires_ancestor { Homebrew::CLI::Parser } | ||
requires_ancestor { Homebrew::CLI::Parser } | ||
|
||
sig { void } | ||
def set_default_options | ||
args["formula?"] = true if args.respond_to?(:formula?) | ||
end | ||
sig { void } | ||
def set_default_options | ||
args["formula?"] = true if args.respond_to?(:formula?) | ||
end | ||
|
||
sig { void } | ||
def validate_options | ||
return unless args.respond_to?(:cask?) | ||
return unless args.cask? | ||
sig { void } | ||
def validate_options | ||
return unless args.respond_to?(:cask?) | ||
return unless args.cask? | ||
|
||
# NOTE: We don't raise an error here because we don't want | ||
# to print the help page or a stack trace. | ||
odie "Invalid `--cask` usage: Casks do not work on Linux" | ||
end | ||
# NOTE: We don't raise an error here because we don't want | ||
# to print the help page or a stack trace. | ||
odie "Invalid `--cask` usage: Casks do not work on Linux" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Homebrew::CLI::Parser.prepend(Homebrew::OS::Linux::CLI::Parser) | ||
Homebrew::CLI::Parser.prepend(OS::Linux::CLI::Parser) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,56 @@ | ||
# typed: true # rubocop:disable Sorbet/StrictSigil | ||
# frozen_string_literal: true | ||
|
||
module Homebrew | ||
module OS | ||
module Linux | ||
module Formula | ||
extend T::Helpers | ||
|
||
requires_ancestor { ::Formula } | ||
|
||
sig { params(name: String, version: T.nilable(T.any(String, Integer))).returns(String) } | ||
def shared_library(name, version = nil) | ||
suffix = if version == "*" || (name == "*" && version.blank?) | ||
"{,.*}" | ||
elsif version.present? | ||
".#{version}" | ||
end | ||
"#{name}.so#{suffix}" | ||
module OS | ||
module Linux | ||
module Formula | ||
extend T::Helpers | ||
|
||
requires_ancestor { ::Formula } | ||
|
||
sig { params(name: String, version: T.nilable(T.any(String, Integer))).returns(String) } | ||
def shared_library(name, version = nil) | ||
suffix = if version == "*" || (name == "*" && version.blank?) | ||
"{,.*}" | ||
elsif version.present? | ||
".#{version}" | ||
end | ||
"#{name}.so#{suffix}" | ||
end | ||
|
||
sig { returns(String) } | ||
def loader_path | ||
"$ORIGIN" | ||
end | ||
sig { returns(String) } | ||
def loader_path | ||
"$ORIGIN" | ||
end | ||
|
||
sig { params(targets: T.nilable(T.any(Pathname, String))).void } | ||
def deuniversalize_machos(*targets); end | ||
|
||
sig { params(spec: SoftwareSpec).void } | ||
def add_global_deps_to_spec(spec) | ||
return unless DevelopmentTools.needs_build_formulae? | ||
|
||
@global_deps ||= begin | ||
dependency_collector = spec.dependency_collector | ||
related_formula_names = Set.new([ | ||
name, | ||
*aliases, | ||
*versioned_formulae_names, | ||
]) | ||
[ | ||
dependency_collector.gcc_dep_if_needed(related_formula_names), | ||
dependency_collector.glibc_dep_if_needed(related_formula_names), | ||
].compact.freeze | ||
end | ||
@global_deps.each { |dep| spec.dependency_collector.add(dep) } | ||
sig { params(targets: T.nilable(T.any(Pathname, String))).void } | ||
def deuniversalize_machos(*targets); end | ||
|
||
sig { params(spec: SoftwareSpec).void } | ||
def add_global_deps_to_spec(spec) | ||
return unless DevelopmentTools.needs_build_formulae? | ||
|
||
@global_deps ||= begin | ||
dependency_collector = spec.dependency_collector | ||
related_formula_names = Set.new([ | ||
name, | ||
*aliases, | ||
*versioned_formulae_names, | ||
]) | ||
[ | ||
dependency_collector.gcc_dep_if_needed(related_formula_names), | ||
dependency_collector.glibc_dep_if_needed(related_formula_names), | ||
].compact.freeze | ||
end | ||
@global_deps.each { |dep| spec.dependency_collector.add(dep) } | ||
end | ||
|
||
sig { returns(T::Boolean) } | ||
def valid_platform? | ||
requirements.none?(MacOSRequirement) | ||
end | ||
sig { returns(T::Boolean) } | ||
def valid_platform? | ||
requirements.none?(MacOSRequirement) | ||
end | ||
end | ||
end | ||
end | ||
|
||
Formula.prepend(Homebrew::OS::Linux::Formula) | ||
Formula.prepend(OS::Linux::Formula) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module Homebrew | ||
module OS | ||
module MacOS | ||
module Cleaner | ||
private | ||
module OS | ||
module Mac | ||
module Cleaner | ||
private | ||
|
||
sig { params(path: Pathname).returns(T::Boolean) } | ||
def executable_path?(path) | ||
path.mach_o_executable? || path.text_executable? | ||
end | ||
sig { params(path: Pathname).returns(T::Boolean) } | ||
def executable_path?(path) | ||
path.mach_o_executable? || path.text_executable? | ||
end | ||
end | ||
end | ||
end | ||
|
||
Cleaner.prepend(Homebrew::OS::MacOS::Cleaner) | ||
Cleaner.prepend(OS::Mac::Cleaner) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module Homebrew | ||
module OS | ||
module MacOS | ||
module Cleanup | ||
sig { returns(T::Boolean) } | ||
def use_system_ruby? | ||
return false if Homebrew::EnvConfig.force_vendor_ruby? | ||
module OS | ||
module Mac | ||
module Cleanup | ||
sig { returns(T::Boolean) } | ||
def use_system_ruby? | ||
return false if Homebrew::EnvConfig.force_vendor_ruby? | ||
|
||
Homebrew::EnvConfig.developer? && ENV["HOMEBREW_USE_RUBY_FROM_PATH"].present? | ||
end | ||
Homebrew::EnvConfig.developer? && ENV["HOMEBREW_USE_RUBY_FROM_PATH"].present? | ||
end | ||
end | ||
end | ||
end | ||
|
||
Homebrew::Cleanup.prepend(Homebrew::OS::MacOS::Cleanup) | ||
Homebrew::Cleanup.prepend(OS::Mac::Cleanup) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,26 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module Homebrew | ||
module OS | ||
module MacOS | ||
module DevCmd | ||
module Bottle | ||
sig { returns(T::Array[String]) } | ||
def tar_args | ||
if ::MacOS.version >= :catalina | ||
["--no-mac-metadata", "--no-acls", "--no-xattrs"].freeze | ||
else | ||
[].freeze | ||
end | ||
module OS | ||
module Mac | ||
module DevCmd | ||
module Bottle | ||
sig { returns(T::Array[String]) } | ||
def tar_args | ||
if MacOS.version >= :catalina | ||
["--no-mac-metadata", "--no-acls", "--no-xattrs"].freeze | ||
else | ||
[].freeze | ||
end | ||
end | ||
|
||
sig { params(gnu_tar_formula: Formula).returns(String) } | ||
def gnu_tar(gnu_tar_formula) | ||
"#{gnu_tar_formula.opt_bin}/gtar" | ||
end | ||
sig { params(gnu_tar_formula: Formula).returns(String) } | ||
def gnu_tar(gnu_tar_formula) | ||
"#{gnu_tar_formula.opt_bin}/gtar" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Homebrew::DevCmd::Bottle.prepend(Homebrew::OS::MacOS::DevCmd::Bottle) | ||
Homebrew::DevCmd::Bottle.prepend(OS::Mac::DevCmd::Bottle) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.