mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
rubocop: enable Style/IfUnlessModifier.
This commit is contained in:
parent
eca4af2031
commit
d64429a736
@ -49,8 +49,7 @@ Style/CollectionMethods:
|
|||||||
Style/FormatStringToken:
|
Style/FormatStringToken:
|
||||||
EnforcedStyle: template
|
EnforcedStyle: template
|
||||||
|
|
||||||
# This often leads to lines longer than the maximum line length.
|
# This shouldn't be enabled until LineLength is lower.
|
||||||
# https://github.com/rubocop-hq/rubocop/issues/6149
|
|
||||||
Style/IfUnlessModifier:
|
Style/IfUnlessModifier:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -125,6 +125,10 @@ Style/GuardClause:
|
|||||||
Style/HashSyntax:
|
Style/HashSyntax:
|
||||||
EnforcedStyle: ruby19_no_mixed_keys
|
EnforcedStyle: ruby19_no_mixed_keys
|
||||||
|
|
||||||
|
# LineLength is low enough here to re-enable it.
|
||||||
|
Style/IfUnlessModifier:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
# so many of these in formulae but none in here
|
# so many of these in formulae but none in here
|
||||||
Style/TrailingBodyOnMethodDefinition:
|
Style/TrailingBodyOnMethodDefinition:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
unless ENV["HOMEBREW_BREW_FILE"]
|
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
|
||||||
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!"
|
|
||||||
end
|
|
||||||
|
|
||||||
std_trap = trap("INT") { exit! 130 } # no backtrace thanks
|
std_trap = trap("INT") { exit! 130 } # no backtrace thanks
|
||||||
|
|
||||||
@ -92,9 +90,7 @@ begin
|
|||||||
# `Homebrew.help` never returns, except for external/unknown commands.
|
# `Homebrew.help` never returns, except for external/unknown commands.
|
||||||
end
|
end
|
||||||
|
|
||||||
if ENV["HOMEBREW_BUILD_FROM_SOURCE"]
|
odisabled("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source") if ENV["HOMEBREW_BUILD_FROM_SOURCE"]
|
||||||
odisabled("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source")
|
|
||||||
end
|
|
||||||
|
|
||||||
if internal_cmd
|
if internal_cmd
|
||||||
Homebrew.send cmd.to_s.tr("-", "_").downcase
|
Homebrew.send cmd.to_s.tr("-", "_").downcase
|
||||||
@ -113,9 +109,7 @@ begin
|
|||||||
|
|
||||||
brew_uid = HOMEBREW_BREW_FILE.stat.uid
|
brew_uid = HOMEBREW_BREW_FILE.stat.uid
|
||||||
tap_commands = []
|
tap_commands = []
|
||||||
if Process.uid.zero? && !brew_uid.zero?
|
tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}] if Process.uid.zero? && !brew_uid.zero?
|
||||||
tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}]
|
|
||||||
end
|
|
||||||
# Unset HOMEBREW_HELP to avoid confusing the tap
|
# Unset HOMEBREW_HELP to avoid confusing the tap
|
||||||
ENV.delete("HOMEBREW_HELP") if help_flag
|
ENV.delete("HOMEBREW_HELP") if help_flag
|
||||||
tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap}]
|
tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap}]
|
||||||
|
@ -179,9 +179,7 @@ module Cask
|
|||||||
# :signal should come after :quit so it can be used as a backup when :quit fails
|
# :signal should come after :quit so it can be used as a backup when :quit fails
|
||||||
def uninstall_signal(*signals, command: nil, **_)
|
def uninstall_signal(*signals, command: nil, **_)
|
||||||
signals.each do |pair|
|
signals.each do |pair|
|
||||||
unless pair.size == 2
|
raise CaskInvalidError.new(cask, "Each #{stanza} :signal must consist of 2 elements.") unless pair.size == 2
|
||||||
raise CaskInvalidError.new(cask, "Each #{stanza} :signal must consist of 2 elements.")
|
|
||||||
end
|
|
||||||
|
|
||||||
signal, bundle_id = pair
|
signal, bundle_id = pair
|
||||||
ohai "Signalling '#{signal}' to application ID '#{bundle_id}'"
|
ohai "Signalling '#{signal}' to application ID '#{bundle_id}'"
|
||||||
|
@ -13,9 +13,7 @@ module Cask
|
|||||||
def self.from_args(cask, *args)
|
def self.from_args(cask, *args)
|
||||||
source_string, target_hash = args
|
source_string, target_hash = args
|
||||||
|
|
||||||
if source_string.nil?
|
raise CaskInvalidError.new(cask.token, "no source given for #{english_name}") if source_string.nil?
|
||||||
raise CaskInvalidError.new(cask.token, "no source given for #{english_name}")
|
|
||||||
end
|
|
||||||
|
|
||||||
unless target_hash.is_a?(Hash)
|
unless target_hash.is_a?(Hash)
|
||||||
raise CaskInvalidError.new(cask.token, "target required for #{english_name} '#{source_string}'")
|
raise CaskInvalidError.new(cask.token, "target required for #{english_name} '#{source_string}'")
|
||||||
|
@ -32,9 +32,7 @@ module Cask
|
|||||||
cask.staged_path.join(path)
|
cask.staged_path.join(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
if absolute_path.exist? && !absolute_path.executable?
|
FileUtils.chmod "+x", absolute_path if absolute_path.exist? && !absolute_path.executable?
|
||||||
FileUtils.chmod "+x", absolute_path
|
|
||||||
end
|
|
||||||
|
|
||||||
executable = if absolute_path.exist?
|
executable = if absolute_path.exist?
|
||||||
absolute_path
|
absolute_path
|
||||||
|
@ -46,9 +46,7 @@ module Cask
|
|||||||
"-target", "/"
|
"-target", "/"
|
||||||
]
|
]
|
||||||
args << "-verboseR" if verbose
|
args << "-verboseR" if verbose
|
||||||
if stanza_options.fetch(:allow_untrusted, false)
|
args << "-allowUntrusted" if stanza_options.fetch(:allow_untrusted, false)
|
||||||
args << "-allowUntrusted"
|
|
||||||
end
|
|
||||||
with_choices_file do |choices_path|
|
with_choices_file do |choices_path|
|
||||||
args << "-applyChoiceChangesXML" << choices_path if choices_path
|
args << "-applyChoiceChangesXML" << choices_path if choices_path
|
||||||
env = {
|
env = {
|
||||||
|
@ -4,9 +4,7 @@ module Cask
|
|||||||
module Artifact
|
module Artifact
|
||||||
class StageOnly < AbstractArtifact
|
class StageOnly < AbstractArtifact
|
||||||
def self.from_args(cask, *args)
|
def self.from_args(cask, *args)
|
||||||
if args != [true]
|
raise CaskInvalidError.new(cask.token, "'stage_only' takes only a single argument: true") if args != [true]
|
||||||
raise CaskInvalidError.new(cask.token, "'stage_only' takes only a single argument: true")
|
|
||||||
end
|
|
||||||
|
|
||||||
new(cask)
|
new(cask)
|
||||||
end
|
end
|
||||||
|
@ -106,18 +106,14 @@ module Cask
|
|||||||
k.directives.key?(:uninstall_preflight)
|
k.directives.key?(:uninstall_preflight)
|
||||||
end
|
end
|
||||||
|
|
||||||
if count > 1
|
add_warning "only a single uninstall_preflight stanza is allowed" if count > 1
|
||||||
add_warning "only a single uninstall_preflight stanza is allowed"
|
|
||||||
end
|
|
||||||
|
|
||||||
count = cask.artifacts.count do |k|
|
count = cask.artifacts.count do |k|
|
||||||
k.is_a?(Artifact::PostflightBlock) &&
|
k.is_a?(Artifact::PostflightBlock) &&
|
||||||
k.directives.key?(:uninstall_postflight)
|
k.directives.key?(:uninstall_postflight)
|
||||||
end
|
end
|
||||||
|
|
||||||
if count > 1
|
add_warning "only a single uninstall_postflight stanza is allowed" if count > 1
|
||||||
add_warning "only a single uninstall_postflight stanza is allowed"
|
|
||||||
end
|
|
||||||
|
|
||||||
return unless cask.artifacts.count { |k| k.is_a?(Artifact::Zap) } > 1
|
return unless cask.artifacts.count { |k| k.is_a?(Artifact::Zap) } > 1
|
||||||
|
|
||||||
|
@ -58,9 +58,7 @@ module Cask
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
instance_eval(content, path).tap do |cask|
|
instance_eval(content, path).tap do |cask|
|
||||||
unless cask.is_a?(Cask)
|
raise CaskUnreadableError.new(token, "'#{path}' does not contain a cask.") unless cask.is_a?(Cask)
|
||||||
raise CaskUnreadableError.new(token, "'#{path}' does not contain a cask.")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
rescue NameError, ArgumentError, ScriptError => e
|
rescue NameError, ArgumentError, ScriptError => e
|
||||||
raise CaskUnreadableError.new(token, e.message)
|
raise CaskUnreadableError.new(token, e.message)
|
||||||
@ -70,9 +68,7 @@ module Cask
|
|||||||
private
|
private
|
||||||
|
|
||||||
def cask(header_token, **options, &block)
|
def cask(header_token, **options, &block)
|
||||||
if token != header_token
|
raise CaskTokenMismatchError.new(token, header_token) if token != header_token
|
||||||
raise CaskTokenMismatchError.new(token, header_token)
|
|
||||||
end
|
|
||||||
|
|
||||||
super(header_token, **options, sourcefile_path: path, &block)
|
super(header_token, **options, sourcefile_path: path, &block)
|
||||||
end
|
end
|
||||||
@ -192,9 +188,7 @@ module Cask
|
|||||||
return loader_class.new(ref) if loader_class.can_load?(ref)
|
return loader_class.new(ref) if loader_class.can_load?(ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
if FromTapPathLoader.can_load?(default_path(ref))
|
return FromTapPathLoader.new(default_path(ref)) if FromTapPathLoader.can_load?(default_path(ref))
|
||||||
return FromTapPathLoader.new(default_path(ref))
|
|
||||||
end
|
|
||||||
|
|
||||||
case (possible_tap_casks = tap_paths(ref)).count
|
case (possible_tap_casks = tap_paths(ref)).count
|
||||||
when 1
|
when 1
|
||||||
@ -209,9 +203,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
possible_installed_cask = Cask.new(ref)
|
possible_installed_cask = Cask.new(ref)
|
||||||
if possible_installed_cask.installed?
|
return FromPathLoader.new(possible_installed_cask.installed_caskfile) if possible_installed_cask.installed?
|
||||||
return FromPathLoader.new(possible_installed_cask.installed_caskfile)
|
|
||||||
end
|
|
||||||
|
|
||||||
NullLoader.new(ref)
|
NullLoader.new(ref)
|
||||||
end
|
end
|
||||||
|
@ -131,9 +131,7 @@ module Cask
|
|||||||
|
|
||||||
return @language = nil if @language_blocks.nil? || @language_blocks.empty?
|
return @language = nil if @language_blocks.nil? || @language_blocks.empty?
|
||||||
|
|
||||||
if @language_blocks.default.nil?
|
raise CaskInvalidError.new(cask, "No default language specified.") if @language_blocks.default.nil?
|
||||||
raise CaskInvalidError.new(cask, "No default language specified.")
|
|
||||||
end
|
|
||||||
|
|
||||||
locales = MacOS.languages
|
locales = MacOS.languages
|
||||||
.map do |language|
|
.map do |language|
|
||||||
|
@ -82,9 +82,7 @@ module Cask
|
|||||||
|
|
||||||
old_config = @cask.config
|
old_config = @cask.config
|
||||||
|
|
||||||
if @cask.installed? && !force? && !reinstall? && !upgrade?
|
raise CaskAlreadyInstalledError, @cask if @cask.installed? && !force? && !reinstall? && !upgrade?
|
||||||
raise CaskAlreadyInstalledError, @cask
|
|
||||||
end
|
|
||||||
|
|
||||||
check_conflicts
|
check_conflicts
|
||||||
|
|
||||||
@ -100,9 +98,7 @@ module Cask
|
|||||||
|
|
||||||
install_artifacts
|
install_artifacts
|
||||||
|
|
||||||
unless @cask.tap&.private?
|
::Utils::Analytics.report_event("cask_install", @cask.token) unless @cask.tap&.private?
|
||||||
::Utils::Analytics.report_event("cask_install", @cask.token)
|
|
||||||
end
|
|
||||||
|
|
||||||
puts summary
|
puts summary
|
||||||
end
|
end
|
||||||
@ -113,9 +109,7 @@ module Cask
|
|||||||
@cask.conflicts_with[:cask].each do |conflicting_cask|
|
@cask.conflicts_with[:cask].each do |conflicting_cask|
|
||||||
begin
|
begin
|
||||||
conflicting_cask = CaskLoader.load(conflicting_cask)
|
conflicting_cask = CaskLoader.load(conflicting_cask)
|
||||||
if conflicting_cask.installed?
|
raise CaskConflictError.new(@cask, conflicting_cask) if conflicting_cask.installed?
|
||||||
raise CaskConflictError.new(@cask, conflicting_cask)
|
|
||||||
end
|
|
||||||
rescue CaskUnavailableError
|
rescue CaskUnavailableError
|
||||||
next # Ignore conflicting Casks that do not exist.
|
next # Ignore conflicting Casks that do not exist.
|
||||||
end
|
end
|
||||||
|
@ -9,17 +9,13 @@ module Cask
|
|||||||
def metadata_versioned_path(version: self.version)
|
def metadata_versioned_path(version: self.version)
|
||||||
cask_version = (version || :unknown).to_s
|
cask_version = (version || :unknown).to_s
|
||||||
|
|
||||||
if cask_version.empty?
|
raise CaskError, "Cannot create metadata path with empty version." if cask_version.empty?
|
||||||
raise CaskError, "Cannot create metadata path with empty version."
|
|
||||||
end
|
|
||||||
|
|
||||||
metadata_master_container_path.join(cask_version)
|
metadata_master_container_path.join(cask_version)
|
||||||
end
|
end
|
||||||
|
|
||||||
def metadata_timestamped_path(version: self.version, timestamp: :latest, create: false)
|
def metadata_timestamped_path(version: self.version, timestamp: :latest, create: false)
|
||||||
if create && timestamp == :latest
|
raise CaskError, "Cannot create metadata path when timestamp is :latest." if create && timestamp == :latest
|
||||||
raise CaskError, "Cannot create metadata path when timestamp is :latest."
|
|
||||||
end
|
|
||||||
|
|
||||||
path = if timestamp == :latest
|
path = if timestamp == :latest
|
||||||
Pathname.glob(metadata_versioned_path(version: version).join("*")).max
|
Pathname.glob(metadata_versioned_path(version: version).join("*")).max
|
||||||
@ -37,9 +33,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def metadata_subdir(leaf, version: self.version, timestamp: :latest, create: false)
|
def metadata_subdir(leaf, version: self.version, timestamp: :latest, create: false)
|
||||||
if create && timestamp == :latest
|
raise CaskError, "Cannot create metadata subdir when timestamp is :latest." if create && timestamp == :latest
|
||||||
raise CaskError, "Cannot create metadata subdir when timestamp is :latest."
|
|
||||||
end
|
|
||||||
|
|
||||||
unless leaf.respond_to?(:empty?) && !leaf.empty?
|
unless leaf.respond_to?(:empty?) && !leaf.empty?
|
||||||
raise CaskError, "Cannot create metadata subdir for empty leaf."
|
raise CaskError, "Cannot create metadata subdir for empty leaf."
|
||||||
|
@ -47,12 +47,8 @@ class Caveats
|
|||||||
|
|
||||||
If you need to have #{f.name} first in your PATH run:
|
If you need to have #{f.name} first in your PATH run:
|
||||||
EOS
|
EOS
|
||||||
if f.bin.directory?
|
s << " #{Utils::Shell.prepend_path_in_profile(f.opt_bin.to_s)}\n" if f.bin.directory?
|
||||||
s << " #{Utils::Shell.prepend_path_in_profile(f.opt_bin.to_s)}\n"
|
s << " #{Utils::Shell.prepend_path_in_profile(f.opt_sbin.to_s)}\n" if f.sbin.directory?
|
||||||
end
|
|
||||||
if f.sbin.directory?
|
|
||||||
s << " #{Utils::Shell.prepend_path_in_profile(f.opt_sbin.to_s)}\n"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.lib.directory? || f.include.directory?
|
if f.lib.directory? || f.include.directory?
|
||||||
@ -61,13 +57,9 @@ class Caveats
|
|||||||
For compilers to find #{f.name} you may need to set:
|
For compilers to find #{f.name} you may need to set:
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
if f.lib.directory?
|
s << " #{Utils::Shell.export_value("LDFLAGS", "-L#{f.opt_lib}")}\n" if f.lib.directory?
|
||||||
s << " #{Utils::Shell.export_value("LDFLAGS", "-L#{f.opt_lib}")}\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
if f.include.directory?
|
s << " #{Utils::Shell.export_value("CPPFLAGS", "-I#{f.opt_include}")}\n" if f.include.directory?
|
||||||
s << " #{Utils::Shell.export_value("CPPFLAGS", "-I#{f.opt_include}")}\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
if which("pkg-config", ENV["HOMEBREW_PATH"]) &&
|
if which("pkg-config", ENV["HOMEBREW_PATH"]) &&
|
||||||
((f.lib/"pkgconfig").directory? || (f.share/"pkgconfig").directory?)
|
((f.lib/"pkgconfig").directory? || (f.share/"pkgconfig").directory?)
|
||||||
|
@ -25,9 +25,7 @@ class Cleaner
|
|||||||
|
|
||||||
# Get rid of any info 'dir' files, so they don't conflict at the link stage
|
# Get rid of any info 'dir' files, so they don't conflict at the link stage
|
||||||
info_dir_file = @f.info + "dir"
|
info_dir_file = @f.info + "dir"
|
||||||
if info_dir_file.file? && !@f.skip_clean?(info_dir_file)
|
observe_file_removal info_dir_file if info_dir_file.file? && !@f.skip_clean?(info_dir_file)
|
||||||
observe_file_removal info_dir_file
|
|
||||||
end
|
|
||||||
|
|
||||||
prune
|
prune
|
||||||
end
|
end
|
||||||
@ -111,9 +109,7 @@ class Cleaner
|
|||||||
end
|
end
|
||||||
if ARGV.debug?
|
if ARGV.debug?
|
||||||
old_perms = path.stat.mode & 0777
|
old_perms = path.stat.mode & 0777
|
||||||
if perms != old_perms
|
puts "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}" if perms != old_perms
|
||||||
puts "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
path.chmod perms
|
path.chmod perms
|
||||||
end
|
end
|
||||||
|
@ -120,9 +120,7 @@ module CleanupRefinement
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
unless basename.to_s.match?(/\A#{Regexp.escape(name)}\-\-#{Regexp.escape(cask.version)}\b/)
|
return true unless basename.to_s.match?(/\A#{Regexp.escape(name)}\-\-#{Regexp.escape(cask.version)}\b/)
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return true if scrub && !cask.versions.include?(cask.version)
|
return true if scrub && !cask.versions.include?(cask.version)
|
||||||
|
|
||||||
@ -334,9 +332,7 @@ module Homebrew
|
|||||||
def cleanup_lockfiles(*lockfiles)
|
def cleanup_lockfiles(*lockfiles)
|
||||||
return if dry_run?
|
return if dry_run?
|
||||||
|
|
||||||
if lockfiles.empty? && HOMEBREW_LOCKS.directory?
|
lockfiles = HOMEBREW_LOCKS.children.select(&:file?) if lockfiles.empty? && HOMEBREW_LOCKS.directory?
|
||||||
lockfiles = HOMEBREW_LOCKS.children.select(&:file?)
|
|
||||||
end
|
|
||||||
|
|
||||||
lockfiles.each do |file|
|
lockfiles.each do |file|
|
||||||
next unless file.readable?
|
next unless file.readable?
|
||||||
|
@ -220,9 +220,7 @@ module Homebrew
|
|||||||
if :mandatory.equal?(constraint_type) && primary_passed && !secondary_passed
|
if :mandatory.equal?(constraint_type) && primary_passed && !secondary_passed
|
||||||
raise OptionConstraintError.new(primary, secondary)
|
raise OptionConstraintError.new(primary, secondary)
|
||||||
end
|
end
|
||||||
if secondary_passed && !primary_passed
|
raise OptionConstraintError.new(primary, secondary, missing: true) if secondary_passed && !primary_passed
|
||||||
raise OptionConstraintError.new(primary, secondary, missing: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -200,9 +200,7 @@ module Homebrew
|
|||||||
"│ "
|
"│ "
|
||||||
end
|
end
|
||||||
|
|
||||||
if dep.is_a? Dependency
|
recursive_deps_tree(Formulary.factory(dep.name), prefix + prefix_addition, true) if dep.is_a? Dependency
|
||||||
recursive_deps_tree(Formulary.factory(dep.name), prefix + prefix_addition, true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@dep_stack.pop
|
@dep_stack.pop
|
||||||
|
@ -73,9 +73,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
url = create_gist(files, descr)
|
url = create_gist(files, descr)
|
||||||
|
|
||||||
if args.new_issue?
|
url = create_issue(f.tap, "#{f.name} failed to build on #{MacOS.full_version}", url) if args.new_issue?
|
||||||
url = create_issue(f.tap, "#{f.name} failed to build on #{MacOS.full_version}", url)
|
|
||||||
end
|
|
||||||
|
|
||||||
puts url if url
|
puts url if url
|
||||||
end
|
end
|
||||||
|
@ -310,9 +310,7 @@ module Homebrew
|
|||||||
def output_analytics(filter: nil)
|
def output_analytics(filter: nil)
|
||||||
days = args.days || "30"
|
days = args.days || "30"
|
||||||
valid_days = %w[30 90 365]
|
valid_days = %w[30 90 365]
|
||||||
unless valid_days.include?(days)
|
raise ArgumentError("Days must be one of #{valid_days.join(", ")}!") unless valid_days.include?(days)
|
||||||
raise ArgumentError("Days must be one of #{valid_days.join(", ")}!")
|
|
||||||
end
|
|
||||||
|
|
||||||
category = args.category || "install"
|
category = args.category || "install"
|
||||||
valid_categories = %w[install install-on-request build-error os-version]
|
valid_categories = %w[install install-on-request build-error os-version]
|
||||||
|
@ -94,9 +94,7 @@ module Homebrew
|
|||||||
unless args.force?
|
unless args.force?
|
||||||
ARGV.named.each do |name|
|
ARGV.named.each do |name|
|
||||||
next if File.exist?(name)
|
next if File.exist?(name)
|
||||||
if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX
|
next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
|
tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
|
||||||
tap.install unless tap.installed?
|
tap.install unless tap.installed?
|
||||||
@ -143,14 +141,10 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
# --HEAD, fail with no head defined
|
# --HEAD, fail with no head defined
|
||||||
if args.head? && f.head.nil?
|
raise "No head is defined for #{f.full_name}" if args.head? && f.head.nil?
|
||||||
raise "No head is defined for #{f.full_name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
# --devel, fail with no devel defined
|
# --devel, fail with no devel defined
|
||||||
if args.devel? && f.devel.nil?
|
raise "No devel block is defined for #{f.full_name}" if args.devel? && f.devel.nil?
|
||||||
raise "No devel block is defined for #{f.full_name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
installed_head_version = f.latest_head_version
|
installed_head_version = f.latest_head_version
|
||||||
if installed_head_version &&
|
if installed_head_version &&
|
||||||
|
@ -133,9 +133,7 @@ module Homebrew
|
|||||||
pinned_versions = {}
|
pinned_versions = {}
|
||||||
names.sort.each do |d|
|
names.sort.each do |d|
|
||||||
keg_pin = (HOMEBREW_PINNED_KEGS/d.basename.to_s)
|
keg_pin = (HOMEBREW_PINNED_KEGS/d.basename.to_s)
|
||||||
if keg_pin.exist? || keg_pin.symlink?
|
pinned_versions[d] = keg_pin.readlink.basename.to_s if keg_pin.exist? || keg_pin.symlink?
|
||||||
pinned_versions[d] = keg_pin.readlink.basename.to_s
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
pinned_versions.each do |d, version|
|
pinned_versions.each do |d, version|
|
||||||
puts d.basename.to_s.concat(args.versions? ? " #{version}" : "")
|
puts d.basename.to_s.concat(args.versions? ? " #{version}" : "")
|
||||||
|
@ -75,9 +75,7 @@ module Homebrew
|
|||||||
puts " #{Formatter.url("https://github.com/Homebrew/brew#donations")}\n"
|
puts " #{Formatter.url("https://github.com/Homebrew/brew#donations")}\n"
|
||||||
|
|
||||||
# Consider the message possibly missed if not a TTY.
|
# Consider the message possibly missed if not a TTY.
|
||||||
if $stdout.tty?
|
safe_system "git", "config", "--local", "--replace-all", "homebrew.donationmessage", "true" if $stdout.tty?
|
||||||
safe_system "git", "config", "--local", "--replace-all", "homebrew.donationmessage", "true"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -88,9 +86,7 @@ module Homebrew
|
|||||||
|
|
||||||
initial_revision = ENV["HOMEBREW_UPDATE_BEFORE"].to_s
|
initial_revision = ENV["HOMEBREW_UPDATE_BEFORE"].to_s
|
||||||
current_revision = ENV["HOMEBREW_UPDATE_AFTER"].to_s
|
current_revision = ENV["HOMEBREW_UPDATE_AFTER"].to_s
|
||||||
if initial_revision.empty? || current_revision.empty?
|
odie "update-report should not be called directly!" if initial_revision.empty? || current_revision.empty?
|
||||||
odie "update-report should not be called directly!"
|
|
||||||
end
|
|
||||||
|
|
||||||
if initial_revision != current_revision
|
if initial_revision != current_revision
|
||||||
update_preinstall_header
|
update_preinstall_header
|
||||||
@ -121,9 +117,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
if !updated
|
if !updated
|
||||||
if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"]
|
puts "Already up-to-date." if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"]
|
||||||
puts "Already up-to-date."
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if hub.empty?
|
if hub.empty?
|
||||||
puts "No changes to formulae."
|
puts "No changes to formulae."
|
||||||
|
@ -18,9 +18,7 @@ class CompilerFailure
|
|||||||
def version(val = nil)
|
def version(val = nil)
|
||||||
if val
|
if val
|
||||||
@version = Version.parse(val.to_s)
|
@version = Version.parse(val.to_s)
|
||||||
if name.to_s == "clang" && val.to_i < 600
|
odisabled "'fails_with :clang' with 'build' < 600" if name.to_s == "clang" && val.to_i < 600
|
||||||
odisabled "'fails_with :clang' with 'build' < 600"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@version
|
@version
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
unless ENV["HOMEBREW_BREW_FILE"]
|
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
|
||||||
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Path to `bin/brew` main executable in `HOMEBREW_PREFIX`
|
# Path to `bin/brew` main executable in `HOMEBREW_PREFIX`
|
||||||
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
|
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
|
||||||
@ -8,9 +6,7 @@ HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
|
|||||||
class MissingEnvironmentVariables < RuntimeError; end
|
class MissingEnvironmentVariables < RuntimeError; end
|
||||||
|
|
||||||
def get_env_or_raise(env)
|
def get_env_or_raise(env)
|
||||||
unless ENV[env]
|
raise MissingEnvironmentVariables, "#{env} was not exported!" unless ENV[env]
|
||||||
raise MissingEnvironmentVariables, "#{env} was not exported!"
|
|
||||||
end
|
|
||||||
ENV[env]
|
ENV[env]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,9 +13,7 @@ class CxxStdlib
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.create(type, compiler)
|
def self.create(type, compiler)
|
||||||
if type && ![:libstdcxx, :libcxx].include?(type)
|
raise ArgumentError, "Invalid C++ stdlib type: #{type}" if type && ![:libstdcxx, :libcxx].include?(type)
|
||||||
raise ArgumentError, "Invalid C++ stdlib type: #{type}"
|
|
||||||
end
|
|
||||||
|
|
||||||
klass = (compiler.to_s =~ GNU_GCC_REGEXP) ? GnuStdlib : AppleStdlib
|
klass = (compiler.to_s =~ GNU_GCC_REGEXP) ? GnuStdlib : AppleStdlib
|
||||||
klass.new(type, compiler)
|
klass.new(type, compiler)
|
||||||
@ -60,9 +58,7 @@ class CxxStdlib
|
|||||||
next if dep.build?
|
next if dep.build?
|
||||||
|
|
||||||
dep_stdlib = Tab.for_formula(dep.to_formula).cxxstdlib
|
dep_stdlib = Tab.for_formula(dep.to_formula).cxxstdlib
|
||||||
unless compatible_with? dep_stdlib
|
raise CompatibilityError.new(formula, dep, dep_stdlib) unless compatible_with? dep_stdlib
|
||||||
raise CompatibilityError.new(formula, dep, dep_stdlib)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -95,21 +95,15 @@ module Homebrew
|
|||||||
|
|
||||||
formula.send("recursive_#{type}") do |dependent, dep|
|
formula.send("recursive_#{type}") do |dependent, dep|
|
||||||
if dep.recommended?
|
if dep.recommended?
|
||||||
if ignores.include?("recommended?") || dependent.build.without?(dep)
|
klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep)
|
||||||
klass.prune
|
|
||||||
end
|
|
||||||
elsif dep.test?
|
elsif dep.test?
|
||||||
if includes.include?("test?")
|
if includes.include?("test?")
|
||||||
if type == :dependencies
|
Dependency.keep_but_prune_recursive_deps if type == :dependencies
|
||||||
Dependency.keep_but_prune_recursive_deps
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
klass.prune
|
klass.prune
|
||||||
end
|
end
|
||||||
elsif dep.optional?
|
elsif dep.optional?
|
||||||
if !includes.include?("optional?") && !dependent.build.with?(dep)
|
klass.prune if !includes.include?("optional?") && !dependent.build.with?(dep)
|
||||||
klass.prune
|
|
||||||
end
|
|
||||||
elsif dep.build?
|
elsif dep.build?
|
||||||
klass.prune unless includes.include?("build?")
|
klass.prune unless includes.include?("build?")
|
||||||
end
|
end
|
||||||
|
@ -134,9 +134,7 @@ class DependencyCollector
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parse_class_spec(spec, tags)
|
def parse_class_spec(spec, tags)
|
||||||
unless spec < Requirement
|
raise TypeError, "#{spec.inspect} is not a Requirement subclass" unless spec < Requirement
|
||||||
raise TypeError, "#{spec.inspect} is not a Requirement subclass"
|
|
||||||
end
|
|
||||||
|
|
||||||
spec.new(tags)
|
spec.new(tags)
|
||||||
end
|
end
|
||||||
|
@ -136,9 +136,7 @@ module Homebrew
|
|||||||
created_pr_comment = false
|
created_pr_comment = false
|
||||||
if new_formula && !new_formula_problem_lines.empty?
|
if new_formula && !new_formula_problem_lines.empty?
|
||||||
begin
|
begin
|
||||||
if GitHub.create_issue_comment(new_formula_problem_lines.join("\n"))
|
created_pr_comment = true if GitHub.create_issue_comment(new_formula_problem_lines.join("\n"))
|
||||||
created_pr_comment = true
|
|
||||||
end
|
|
||||||
rescue *GitHub.api_errors => e
|
rescue *GitHub.api_errors => e
|
||||||
opoo "Unable to create issue comment: #{e.message}"
|
opoo "Unable to create issue comment: #{e.message}"
|
||||||
end
|
end
|
||||||
@ -154,9 +152,7 @@ module Homebrew
|
|||||||
formula_plural = "#{formula_count} #{"formula".pluralize(formula_count)}"
|
formula_plural = "#{formula_count} #{"formula".pluralize(formula_count)}"
|
||||||
corrected_problem_plural = "#{corrected_problem_count} #{"problem".pluralize(corrected_problem_count)}"
|
corrected_problem_plural = "#{corrected_problem_count} #{"problem".pluralize(corrected_problem_count)}"
|
||||||
errors_summary = "#{problem_plural} in #{formula_plural} detected"
|
errors_summary = "#{problem_plural} in #{formula_plural} detected"
|
||||||
if corrected_problem_count.positive?
|
errors_summary += ", #{corrected_problem_plural} corrected" if corrected_problem_count.positive?
|
||||||
errors_summary += ", #{corrected_problem_plural} corrected"
|
|
||||||
end
|
|
||||||
|
|
||||||
if problem_count.positive? ||
|
if problem_count.positive? ||
|
||||||
(new_formula_problem_count.positive? && !created_pr_comment)
|
(new_formula_problem_count.positive? && !created_pr_comment)
|
||||||
@ -263,9 +259,7 @@ module Homebrew
|
|||||||
|
|
||||||
problem "'DATA' was found, but no '__END__'" if text.data? && !text.end?
|
problem "'DATA' was found, but no '__END__'" if text.data? && !text.end?
|
||||||
|
|
||||||
if text.end? && !text.data?
|
problem "'__END__' was found, but 'DATA' is not used" if text.end? && !text.data?
|
||||||
problem "'__END__' was found, but 'DATA' is not used"
|
|
||||||
end
|
|
||||||
|
|
||||||
if text =~ /inreplace [^\n]* do [^\n]*\n[^\n]*\.gsub![^\n]*\n\ *end/m
|
if text =~ /inreplace [^\n]* do [^\n]*\n[^\n]*\.gsub![^\n]*\n\ *end/m
|
||||||
problem "'inreplace ... do' was used for a single substitution (use the non-block form instead)."
|
problem "'inreplace ... do' was used for a single substitution (use the non-block form instead)."
|
||||||
@ -344,9 +338,7 @@ module Homebrew
|
|||||||
|
|
||||||
name = formula.name
|
name = formula.name
|
||||||
|
|
||||||
if MissingFormula.blacklisted_reason(name)
|
problem "'#{name}' is blacklisted." if MissingFormula.blacklisted_reason(name)
|
||||||
problem "'#{name}' is blacklisted."
|
|
||||||
end
|
|
||||||
|
|
||||||
if Formula.aliases.include? name
|
if Formula.aliases.include? name
|
||||||
problem "Formula name conflicts with existing aliases."
|
problem "Formula name conflicts with existing aliases."
|
||||||
@ -418,13 +410,9 @@ module Homebrew
|
|||||||
problem "Dependency #{dep} does not define option #{opt.name.inspect}"
|
problem "Dependency #{dep} does not define option #{opt.name.inspect}"
|
||||||
end
|
end
|
||||||
|
|
||||||
if dep.name == "git"
|
problem "Don't use git as a dependency (it's always available)" if dep.name == "git"
|
||||||
problem "Don't use git as a dependency (it's always available)"
|
|
||||||
end
|
|
||||||
|
|
||||||
if dep.tags.include?(:run)
|
problem "Dependency '#{dep.name}' is marked as :run. Remove :run; it is a no-op." if dep.tags.include?(:run)
|
||||||
problem "Dependency '#{dep.name}' is marked as :run. Remove :run; it is a no-op."
|
|
||||||
end
|
|
||||||
|
|
||||||
next unless @core_tap
|
next unless @core_tap
|
||||||
|
|
||||||
@ -565,9 +553,7 @@ module Homebrew
|
|||||||
return unless formula.bottle_disabled?
|
return unless formula.bottle_disabled?
|
||||||
return if formula.bottle_unneeded?
|
return if formula.bottle_unneeded?
|
||||||
|
|
||||||
unless formula.bottle_disable_reason.valid?
|
problem "Unrecognized bottle modifier" unless formula.bottle_disable_reason.valid?
|
||||||
problem "Unrecognized bottle modifier"
|
|
||||||
end
|
|
||||||
|
|
||||||
return unless @core_tap
|
return unless @core_tap
|
||||||
problem "Formulae should not use `bottle :disabled`"
|
problem "Formulae should not use `bottle :disabled`"
|
||||||
@ -635,9 +621,7 @@ module Homebrew
|
|||||||
next unless spec = formula.send(name.downcase)
|
next unless spec = formula.send(name.downcase)
|
||||||
|
|
||||||
version = spec.version
|
version = spec.version
|
||||||
if version.to_s !~ /\d/
|
problem "#{name}: version (#{version}) is set to a string without a digit" if version.to_s !~ /\d/
|
||||||
problem "#{name}: version (#{version}) is set to a string without a digit"
|
|
||||||
end
|
|
||||||
if version.to_s.start_with?("HEAD")
|
if version.to_s.start_with?("HEAD")
|
||||||
problem "#{name}: non-HEAD version name (#{version}) should not begin with HEAD"
|
problem "#{name}: non-HEAD version name (#{version}) should not begin with HEAD"
|
||||||
end
|
end
|
||||||
@ -733,9 +717,7 @@ module Homebrew
|
|||||||
version = Version.parse(stable.url)
|
version = Version.parse(stable.url)
|
||||||
if version >= Version.create("1.0")
|
if version >= Version.create("1.0")
|
||||||
_, minor_version, = version.to_s.split(".", 3).map(&:to_i)
|
_, minor_version, = version.to_s.split(".", 3).map(&:to_i)
|
||||||
if minor_version.odd?
|
problem "#{stable.version} is a development release" if minor_version.odd?
|
||||||
problem "#{stable.version} is a development release"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -875,9 +857,7 @@ module Homebrew
|
|||||||
|
|
||||||
return unless @strict
|
return unless @strict
|
||||||
|
|
||||||
if line.include?("env :userpaths")
|
problem "`env :userpaths` in formulae is deprecated" if line.include?("env :userpaths")
|
||||||
problem "`env :userpaths` in formulae is deprecated"
|
|
||||||
end
|
|
||||||
|
|
||||||
if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/
|
if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/
|
||||||
bad_system = Regexp.last_match(1)
|
bad_system = Regexp.last_match(1)
|
||||||
@ -954,9 +934,7 @@ module Homebrew
|
|||||||
def audit
|
def audit
|
||||||
only_audits = @only
|
only_audits = @only
|
||||||
except_audits = @except
|
except_audits = @except
|
||||||
if only_audits && except_audits
|
odie "--only and --except cannot be used simultaneously!" if only_audits && except_audits
|
||||||
odie "--only and --except cannot be used simultaneously!"
|
|
||||||
end
|
|
||||||
|
|
||||||
methods.map(&:to_s).grep(/^audit_/).each do |audit_method_name|
|
methods.map(&:to_s).grep(/^audit_/).each do |audit_method_name|
|
||||||
name = audit_method_name.gsub(/^audit_/, "")
|
name = audit_method_name.gsub(/^audit_/, "")
|
||||||
@ -1027,9 +1005,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if version.to_s.start_with?("v")
|
problem "version #{version} should not have a leading 'v'" if version.to_s.start_with?("v")
|
||||||
problem "version #{version} should not have a leading 'v'"
|
|
||||||
end
|
|
||||||
|
|
||||||
return unless version.to_s =~ /_\d+$/
|
return unless version.to_s =~ /_\d+$/
|
||||||
|
|
||||||
@ -1044,9 +1020,7 @@ module Homebrew
|
|||||||
url_strategy = DownloadStrategyDetector.detect(url)
|
url_strategy = DownloadStrategyDetector.detect(url)
|
||||||
|
|
||||||
if using == :git || url_strategy == GitDownloadStrategy
|
if using == :git || url_strategy == GitDownloadStrategy
|
||||||
if specs[:tag] && !specs[:revision]
|
problem "Git should specify :revision when a :tag is specified." if specs[:tag] && !specs[:revision]
|
||||||
problem "Git should specify :revision when a :tag is specified."
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return unless using
|
return unless using
|
||||||
@ -1101,16 +1075,12 @@ module Homebrew
|
|||||||
problem http_content_problem
|
problem http_content_problem
|
||||||
end
|
end
|
||||||
elsif strategy <= GitDownloadStrategy
|
elsif strategy <= GitDownloadStrategy
|
||||||
unless Utils.git_remote_exists? url
|
problem "The URL #{url} is not a valid git URL" unless Utils.git_remote_exists? url
|
||||||
problem "The URL #{url} is not a valid git URL"
|
|
||||||
end
|
|
||||||
elsif strategy <= SubversionDownloadStrategy
|
elsif strategy <= SubversionDownloadStrategy
|
||||||
next unless DevelopmentTools.subversion_handles_most_https_certificates?
|
next unless DevelopmentTools.subversion_handles_most_https_certificates?
|
||||||
next unless Utils.svn_available?
|
next unless Utils.svn_available?
|
||||||
|
|
||||||
unless Utils.svn_remote_exists? url
|
problem "The URL #{url} is not a valid svn URL" unless Utils.svn_remote_exists? url
|
||||||
problem "The URL #{url} is not a valid svn URL"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -205,14 +205,10 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def bottle_formula(f)
|
def bottle_formula(f)
|
||||||
unless f.installed?
|
return ofail "Formula not installed or up-to-date: #{f.full_name}" unless f.installed?
|
||||||
return ofail "Formula not installed or up-to-date: #{f.full_name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
unless tap = f.tap
|
unless tap = f.tap
|
||||||
unless args.force_core_tap?
|
return ofail "Formula not from core or any installed taps: #{f.full_name}" unless args.force_core_tap?
|
||||||
return ofail "Formula not from core or any installed taps: #{f.full_name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
tap = CoreTap.instance
|
tap = CoreTap.instance
|
||||||
end
|
end
|
||||||
@ -223,9 +219,7 @@ module Homebrew
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
unless Utils::Bottles.built_as? f
|
return ofail "Formula not installed with '--build-bottle': #{f.full_name}" unless Utils::Bottles.built_as? f
|
||||||
return ofail "Formula not installed with '--build-bottle': #{f.full_name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
return ofail "Formula has no stable version: #{f.full_name}" unless f.stable
|
return ofail "Formula has no stable version: #{f.full_name}" unless f.stable
|
||||||
|
|
||||||
@ -265,9 +259,7 @@ module Homebrew
|
|||||||
begin
|
begin
|
||||||
keg.delete_pyc_files!
|
keg.delete_pyc_files!
|
||||||
|
|
||||||
unless args.skip_relocation?
|
changed_files = keg.replace_locations_with_placeholders unless args.skip_relocation?
|
||||||
changed_files = keg.replace_locations_with_placeholders
|
|
||||||
end
|
|
||||||
|
|
||||||
Tab.clear_cache
|
Tab.clear_cache
|
||||||
tab = Tab.for_keg(keg)
|
tab = Tab.for_keg(keg)
|
||||||
@ -300,9 +292,7 @@ module Homebrew
|
|||||||
mv "#{relocatable_tar_path}.gz", bottle_path
|
mv "#{relocatable_tar_path}.gz", bottle_path
|
||||||
end
|
end
|
||||||
|
|
||||||
if bottle_path.size > 1 * 1024 * 1024
|
ohai "Detecting if #{filename} is relocatable..." if bottle_path.size > 1 * 1024 * 1024
|
||||||
ohai "Detecting if #{filename} is relocatable..."
|
|
||||||
end
|
|
||||||
|
|
||||||
if Homebrew.default_prefix?(prefix)
|
if Homebrew.default_prefix?(prefix)
|
||||||
prefix_check = File.join(prefix, "opt")
|
prefix_check = File.join(prefix, "opt")
|
||||||
@ -344,9 +334,7 @@ module Homebrew
|
|||||||
ensure
|
ensure
|
||||||
ignore_interrupts do
|
ignore_interrupts do
|
||||||
original_tab&.write
|
original_tab&.write
|
||||||
unless args.skip_relocation?
|
keg.replace_placeholders_with_locations changed_files unless args.skip_relocation?
|
||||||
keg.replace_placeholders_with_locations changed_files
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -510,9 +498,7 @@ module Homebrew
|
|||||||
string = s.sub!(/ bottle do.+?end\n/m, output)
|
string = s.sub!(/ bottle do.+?end\n/m, output)
|
||||||
odie "Bottle block update failed!" unless string
|
odie "Bottle block update failed!" unless string
|
||||||
else
|
else
|
||||||
if args.keep_old?
|
odie "--keep-old was passed but there was no existing bottle block!" if args.keep_old?
|
||||||
odie "--keep-old was passed but there was no existing bottle block!"
|
|
||||||
end
|
|
||||||
puts output
|
puts output
|
||||||
update_or_add = "add"
|
update_or_add = "add"
|
||||||
if s.include? "stable do"
|
if s.include? "stable do"
|
||||||
|
@ -380,30 +380,20 @@ module Homebrew
|
|||||||
contents = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read }
|
contents = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read }
|
||||||
contents.extend(StringInreplaceExtension)
|
contents.extend(StringInreplaceExtension)
|
||||||
replacement_pairs.each do |old, new|
|
replacement_pairs.each do |old, new|
|
||||||
unless Homebrew.args.quiet?
|
ohai "replace #{old.inspect} with #{new.inspect}" unless Homebrew.args.quiet?
|
||||||
ohai "replace #{old.inspect} with #{new.inspect}"
|
raise "No old value for new value #{new}! Did you pass the wrong arguments?" unless old
|
||||||
end
|
|
||||||
unless old
|
|
||||||
raise "No old value for new value #{new}! Did you pass the wrong arguments?"
|
|
||||||
end
|
|
||||||
|
|
||||||
contents.gsub!(old, new)
|
contents.gsub!(old, new)
|
||||||
end
|
end
|
||||||
unless contents.errors.empty?
|
raise Utils::InreplaceError, path => contents.errors unless contents.errors.empty?
|
||||||
raise Utils::InreplaceError, path => contents.errors
|
|
||||||
end
|
|
||||||
|
|
||||||
path.atomic_write(contents) if args.write?
|
path.atomic_write(contents) if args.write?
|
||||||
contents
|
contents
|
||||||
else
|
else
|
||||||
Utils::Inreplace.inreplace(path) do |s|
|
Utils::Inreplace.inreplace(path) do |s|
|
||||||
replacement_pairs.each do |old, new|
|
replacement_pairs.each do |old, new|
|
||||||
unless Homebrew.args.quiet?
|
ohai "replace #{old.inspect} with #{new.inspect}" unless Homebrew.args.quiet?
|
||||||
ohai "replace #{old.inspect} with #{new.inspect}"
|
raise "No old value for new value #{new}! Did you pass the wrong arguments?" unless old
|
||||||
end
|
|
||||||
unless old
|
|
||||||
raise "No old value for new value #{new}! Did you pass the wrong arguments?"
|
|
||||||
end
|
|
||||||
|
|
||||||
s.gsub!(old, new)
|
s.gsub!(old, new)
|
||||||
end
|
end
|
||||||
|
@ -5,38 +5,28 @@ require "tap"
|
|||||||
|
|
||||||
def with_monkey_patch
|
def with_monkey_patch
|
||||||
BottleSpecification.class_eval do
|
BottleSpecification.class_eval do
|
||||||
if method_defined?(:method_missing)
|
alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
|
||||||
alias_method :old_method_missing, :method_missing
|
|
||||||
end
|
|
||||||
define_method(:method_missing) { |*| }
|
define_method(:method_missing) { |*| }
|
||||||
end
|
end
|
||||||
|
|
||||||
Module.class_eval do
|
Module.class_eval do
|
||||||
if method_defined?(:method_missing)
|
alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
|
||||||
alias_method :old_method_missing, :method_missing
|
|
||||||
end
|
|
||||||
define_method(:method_missing) { |*| }
|
define_method(:method_missing) { |*| }
|
||||||
end
|
end
|
||||||
|
|
||||||
Resource.class_eval do
|
Resource.class_eval do
|
||||||
if method_defined?(:method_missing)
|
alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
|
||||||
alias_method :old_method_missing, :method_missing
|
|
||||||
end
|
|
||||||
define_method(:method_missing) { |*| }
|
define_method(:method_missing) { |*| }
|
||||||
end
|
end
|
||||||
|
|
||||||
DependencyCollector.class_eval do
|
DependencyCollector.class_eval do
|
||||||
if method_defined?(:parse_symbol_spec)
|
alias_method :old_parse_symbol_spec, :parse_symbol_spec if method_defined?(:parse_symbol_spec)
|
||||||
alias_method :old_parse_symbol_spec, :parse_symbol_spec
|
|
||||||
end
|
|
||||||
define_method(:parse_symbol_spec) { |*| }
|
define_method(:parse_symbol_spec) { |*| }
|
||||||
end
|
end
|
||||||
|
|
||||||
if defined?(DependencyCollector::Compat)
|
if defined?(DependencyCollector::Compat)
|
||||||
DependencyCollector::Compat.class_eval do
|
DependencyCollector::Compat.class_eval do
|
||||||
if method_defined?(:parse_string_spec)
|
alias_method :old_parse_string_spec, :parse_string_spec if method_defined?(:parse_string_spec)
|
||||||
alias_method :old_parse_string_spec, :parse_string_spec
|
|
||||||
end
|
|
||||||
define_method(:parse_string_spec) { |*| }
|
define_method(:parse_string_spec) { |*| }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -34,9 +34,7 @@ module Homebrew
|
|||||||
|
|
||||||
raise UsageError unless ARGV.named.empty?
|
raise UsageError unless ARGV.named.empty?
|
||||||
|
|
||||||
if args.link?
|
odie "`brew man --link` is now done automatically by `brew update`." if args.link?
|
||||||
odie "`brew man --link` is now done automatically by `brew update`."
|
|
||||||
end
|
|
||||||
|
|
||||||
regenerate_man_pages
|
regenerate_man_pages
|
||||||
|
|
||||||
|
@ -23,9 +23,7 @@ module Homebrew
|
|||||||
|
|
||||||
bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
|
bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
|
||||||
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
|
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
|
||||||
if !bintray_user || !bintray_key
|
raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!" if !bintray_user || !bintray_key
|
||||||
raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!"
|
|
||||||
end
|
|
||||||
|
|
||||||
ARGV.formulae.each do |f|
|
ARGV.formulae.each do |f|
|
||||||
bintray_package = Utils::Bottles::Bintray.package f.name
|
bintray_package = Utils::Bottles::Bintray.package f.name
|
||||||
|
@ -66,17 +66,11 @@ module Homebrew
|
|||||||
|
|
||||||
pull_args.parse
|
pull_args.parse
|
||||||
|
|
||||||
if ARGV.named.empty?
|
odie "This command requires at least one argument containing a URL or pull request number" if ARGV.named.empty?
|
||||||
odie "This command requires at least one argument containing a URL or pull request number"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Passthrough Git environment variables for e.g. git am
|
# Passthrough Git environment variables for e.g. git am
|
||||||
if ENV["HOMEBREW_GIT_NAME"]
|
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"]
|
||||||
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"]
|
ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"] if ENV["HOMEBREW_GIT_EMAIL"]
|
||||||
end
|
|
||||||
if ENV["HOMEBREW_GIT_EMAIL"]
|
|
||||||
ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"]
|
|
||||||
end
|
|
||||||
|
|
||||||
# Depending on user configuration, git may try to invoke gpg.
|
# Depending on user configuration, git may try to invoke gpg.
|
||||||
if Utils.popen_read("git config --get --bool commit.gpgsign").chomp == "true"
|
if Utils.popen_read("git config --get --bool commit.gpgsign").chomp == "true"
|
||||||
@ -123,9 +117,7 @@ module Homebrew
|
|||||||
odie "Not a GitHub pull request or commit: #{arg}"
|
odie "Not a GitHub pull request or commit: #{arg}"
|
||||||
end
|
end
|
||||||
|
|
||||||
if !testing_job && args.bottle? && issue.nil?
|
odie "No pull request detected!" if !testing_job && args.bottle? && issue.nil?
|
||||||
odie "No pull request detected!"
|
|
||||||
end
|
|
||||||
|
|
||||||
if tap
|
if tap
|
||||||
tap.install unless tap.installed?
|
tap.install unless tap.installed?
|
||||||
@ -157,9 +149,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
odie "Can not bump if non-formula files are changed" unless patch_changes[:others].empty?
|
odie "Can not bump if non-formula files are changed" unless patch_changes[:others].empty?
|
||||||
end
|
end
|
||||||
if is_bumpable
|
old_versions = current_versions_from_info_external(patch_changes[:formulae].first) if is_bumpable
|
||||||
old_versions = current_versions_from_info_external(patch_changes[:formulae].first)
|
|
||||||
end
|
|
||||||
patch_puller.apply_patch
|
patch_puller.apply_patch
|
||||||
|
|
||||||
changed_formulae_names = []
|
changed_formulae_names = []
|
||||||
@ -288,9 +278,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def publish_changed_formula_bottles(tap, changed_formulae_names)
|
def publish_changed_formula_bottles(tap, changed_formulae_names)
|
||||||
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
|
raise "Need to load formulae to publish them!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
|
||||||
raise "Need to load formulae to publish them!"
|
|
||||||
end
|
|
||||||
|
|
||||||
published = []
|
published = []
|
||||||
bintray_creds = { user: ENV["HOMEBREW_BINTRAY_USER"], key: ENV["HOMEBREW_BINTRAY_KEY"] }
|
bintray_creds = { user: ENV["HOMEBREW_BINTRAY_USER"], key: ENV["HOMEBREW_BINTRAY_KEY"] }
|
||||||
@ -458,9 +446,7 @@ module Homebrew
|
|||||||
repo = Utils::Bottles::Bintray.repository(f.tap)
|
repo = Utils::Bottles::Bintray.repository(f.tap)
|
||||||
package = Utils::Bottles::Bintray.package(f.name)
|
package = Utils::Bottles::Bintray.package(f.name)
|
||||||
info = FormulaInfoFromJson.lookup(f.full_name)
|
info = FormulaInfoFromJson.lookup(f.full_name)
|
||||||
if info.nil?
|
raise "Failed publishing bottle: failed reading formula info for #{f.full_name}" if info.nil?
|
||||||
raise "Failed publishing bottle: failed reading formula info for #{f.full_name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
unless info.bottle_info_any
|
unless info.bottle_info_any
|
||||||
opoo "No bottle defined in formula #{package}"
|
opoo "No bottle defined in formula #{package}"
|
||||||
@ -562,9 +548,7 @@ module Homebrew
|
|||||||
def verify_bintray_published(formulae_names)
|
def verify_bintray_published(formulae_names)
|
||||||
return if formulae_names.empty?
|
return if formulae_names.empty?
|
||||||
|
|
||||||
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
|
raise "Need to load formulae to verify their publication!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
|
||||||
raise "Need to load formulae to verify their publication!"
|
|
||||||
end
|
|
||||||
|
|
||||||
ohai "Verifying bottles published on Bintray"
|
ohai "Verifying bottles published on Bintray"
|
||||||
formulae = formulae_names.map { |n| Formula[n] }
|
formulae = formulae_names.map { |n| Formula[n] }
|
||||||
@ -605,9 +589,7 @@ module Homebrew
|
|||||||
raise "Failed to find published #{f} bottle at #{url} (#{res.code} #{res.message})!"
|
raise "Failed to find published #{f} bottle at #{url} (#{res.code} #{res.message})!"
|
||||||
end
|
end
|
||||||
|
|
||||||
if retry_count >= max_retries
|
raise "Failed to find published #{f} bottle at #{url}!" if retry_count >= max_retries
|
||||||
raise "Failed to find published #{f} bottle at #{url}!"
|
|
||||||
end
|
|
||||||
|
|
||||||
print(wrote_dots ? "." : "Waiting on Bintray.")
|
print(wrote_dots ? "." : "Waiting on Bintray.")
|
||||||
wrote_dots = true
|
wrote_dots = true
|
||||||
@ -630,9 +612,7 @@ module Homebrew
|
|||||||
curl_download url, to: filename
|
curl_download url, to: filename
|
||||||
break
|
break
|
||||||
rescue
|
rescue
|
||||||
if retry_count >= max_curl_retries
|
raise "Failed to download #{f} bottle from #{url}!" if retry_count >= max_curl_retries
|
||||||
raise "Failed to download #{f} bottle from #{url}!"
|
|
||||||
end
|
|
||||||
|
|
||||||
puts "curl download failed; retrying in #{curl_retry_delay_seconds} sec"
|
puts "curl download failed; retrying in #{curl_retry_delay_seconds} sec"
|
||||||
sleep curl_retry_delay_seconds
|
sleep curl_retry_delay_seconds
|
||||||
|
@ -278,9 +278,7 @@ module Homebrew
|
|||||||
next unless d.directory?
|
next unless d.directory?
|
||||||
|
|
||||||
d.find do |path|
|
d.find do |path|
|
||||||
if path.symlink? && !path.resolved_path_exists?
|
broken_symlinks << path if path.symlink? && !path.resolved_path_exists?
|
||||||
broken_symlinks << path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return if broken_symlinks.empty?
|
return if broken_symlinks.empty?
|
||||||
|
@ -375,9 +375,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
|
|
||||||
if filename_with_encoding = content_disposition.parameters["filename*"]
|
if filename_with_encoding = content_disposition.parameters["filename*"]
|
||||||
encoding, encoded_filename = filename_with_encoding.split("''", 2)
|
encoding, encoded_filename = filename_with_encoding.split("''", 2)
|
||||||
if encoding && encoded_filename
|
filename = URI.decode_www_form_component(encoded_filename).encode(encoding) if encoding && encoded_filename
|
||||||
filename = URI.decode_www_form_component(encoded_filename).encode(encoding)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
filename || content_disposition.filename
|
filename || content_disposition.filename
|
||||||
|
@ -110,9 +110,7 @@ module Superenv
|
|||||||
path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin")
|
path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin")
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if homebrew_cc =~ GNU_GCC_REGEXP
|
path.append(gcc_version_formula($&).opt_bin) if homebrew_cc =~ GNU_GCC_REGEXP
|
||||||
path.append(gcc_version_formula($&).opt_bin)
|
|
||||||
end
|
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
# Don't fail and don't add these formulae to the path if they don't exist.
|
# Don't fail and don't add these formulae to the path if they don't exist.
|
||||||
nil
|
nil
|
||||||
|
@ -36,21 +36,15 @@ class SystemConfig
|
|||||||
end
|
end
|
||||||
|
|
||||||
def clt
|
def clt
|
||||||
@clt ||= if MacOS::CLT.installed?
|
@clt ||= MacOS::CLT.version if MacOS::CLT.installed?
|
||||||
MacOS::CLT.version
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def clt_headers
|
def clt_headers
|
||||||
@clt_headers ||= if MacOS::CLT.headers_installed?
|
@clt_headers ||= MacOS::CLT.headers_version if MacOS::CLT.headers_installed?
|
||||||
MacOS::CLT.headers_version
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def xquartz
|
def xquartz
|
||||||
@xquartz ||= if MacOS::XQuartz.installed?
|
@xquartz ||= "#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}" if MacOS::XQuartz.installed?
|
||||||
"#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def dump_verbose_config(f = $stdout)
|
def dump_verbose_config(f = $stdout)
|
||||||
|
@ -345,9 +345,7 @@ class Pathname
|
|||||||
# Writes an exec script that invokes a Java jar
|
# Writes an exec script that invokes a Java jar
|
||||||
def write_jar_script(target_jar, script_name, java_opts = "", java_version: nil)
|
def write_jar_script(target_jar, script_name, java_opts = "", java_version: nil)
|
||||||
mkpath
|
mkpath
|
||||||
java_home = if java_version
|
java_home = ("JAVA_HOME=\"#{Language::Java.java_home_shell(java_version)}\" " if java_version)
|
||||||
"JAVA_HOME=\"#{Language::Java.java_home_shell(java_version)}\" "
|
|
||||||
end
|
|
||||||
join(script_name).write <<~SH
|
join(script_name).write <<~SH
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#{java_home}exec java #{java_opts} -jar #{target_jar} "$@"
|
#{java_home}exec java #{java_opts} -jar #{target_jar} "$@"
|
||||||
|
@ -28,18 +28,14 @@ module StringInreplaceExtension
|
|||||||
|
|
||||||
def sub!(before, after)
|
def sub!(before, after)
|
||||||
result = super
|
result = super
|
||||||
unless result
|
errors << "expected replacement of #{before.inspect} with #{after.inspect}" unless result
|
||||||
errors << "expected replacement of #{before.inspect} with #{after.inspect}"
|
|
||||||
end
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# Warn if nothing was replaced
|
# Warn if nothing was replaced
|
||||||
def gsub!(before, after, audit_result = true)
|
def gsub!(before, after, audit_result = true)
|
||||||
result = super(before, after)
|
result = super(before, after)
|
||||||
if audit_result && result.nil?
|
errors << "expected replacement of #{before.inspect} with #{after.inspect}" if audit_result && result.nil?
|
||||||
errors << "expected replacement of #{before.inspect} with #{after.inspect}"
|
|
||||||
end
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -55,9 +51,7 @@ module StringInreplaceExtension
|
|||||||
def remove_make_var!(flags)
|
def remove_make_var!(flags)
|
||||||
Array(flags).each do |flag|
|
Array(flags).each do |flag|
|
||||||
# Also remove trailing \n, if present.
|
# Also remove trailing \n, if present.
|
||||||
unless gsub!(/^#{Regexp.escape(flag)}[ \t]*=.*$\n?/, "", false)
|
errors << "expected to remove #{flag.inspect}" unless gsub!(/^#{Regexp.escape(flag)}[ \t]*=.*$\n?/, "", false)
|
||||||
errors << "expected to remove #{flag.inspect}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -176,9 +176,7 @@ class Formula
|
|||||||
@name = name
|
@name = name
|
||||||
@path = path
|
@path = path
|
||||||
@alias_path = alias_path
|
@alias_path = alias_path
|
||||||
@alias_name = if alias_path
|
@alias_name = (File.basename(alias_path) if alias_path)
|
||||||
File.basename(alias_path)
|
|
||||||
end
|
|
||||||
@revision = self.class.revision || 0
|
@revision = self.class.revision || 0
|
||||||
@version_scheme = self.class.version_scheme || 0
|
@version_scheme = self.class.version_scheme || 0
|
||||||
|
|
||||||
@ -248,14 +246,10 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
def validate_attributes!
|
def validate_attributes!
|
||||||
if name.nil? || name.empty? || name =~ /\s/
|
raise FormulaValidationError.new(full_name, :name, name) if name.nil? || name.empty? || name =~ /\s/
|
||||||
raise FormulaValidationError.new(full_name, :name, name)
|
|
||||||
end
|
|
||||||
|
|
||||||
url = active_spec.url
|
url = active_spec.url
|
||||||
if url.nil? || url.empty? || url =~ /\s/
|
raise FormulaValidationError.new(full_name, :url, url) if url.nil? || url.empty? || url =~ /\s/
|
||||||
raise FormulaValidationError.new(full_name, :url, url)
|
|
||||||
end
|
|
||||||
|
|
||||||
val = version.respond_to?(:to_str) ? version.to_str : version
|
val = version.respond_to?(:to_str) ? version.to_str : version
|
||||||
return unless val.nil? || val.empty? || val =~ /\s/
|
return unless val.nil? || val.empty? || val =~ /\s/
|
||||||
@ -1338,9 +1332,7 @@ class Formula
|
|||||||
|
|
||||||
# Avoid false positives for clock_gettime support on 10.11.
|
# Avoid false positives for clock_gettime support on 10.11.
|
||||||
# CMake cache entries for other weak symbols may be added here as needed.
|
# CMake cache entries for other weak symbols may be added here as needed.
|
||||||
if MacOS.version == "10.11" && MacOS::Xcode.version >= "8.0"
|
args << "-DHAVE_CLOCK_GETTIME:INTERNAL=0" if MacOS.version == "10.11" && MacOS::Xcode.version >= "8.0"
|
||||||
args << "-DHAVE_CLOCK_GETTIME:INTERNAL=0"
|
|
||||||
end
|
|
||||||
|
|
||||||
args
|
args
|
||||||
end
|
end
|
||||||
@ -1842,9 +1834,7 @@ class Formula
|
|||||||
pretty_args.delete "--disable-debug"
|
pretty_args.delete "--disable-debug"
|
||||||
end
|
end
|
||||||
pretty_args.each_index do |i|
|
pretty_args.each_index do |i|
|
||||||
if pretty_args[i].to_s.start_with? "import setuptools"
|
pretty_args[i] = "import setuptools..." if pretty_args[i].to_s.start_with? "import setuptools"
|
||||||
pretty_args[i] = "import setuptools..."
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
ohai "#{cmd} #{pretty_args * " "}".strip
|
ohai "#{cmd} #{pretty_args * " "}".strip
|
||||||
|
|
||||||
@ -1957,9 +1947,7 @@ class Formula
|
|||||||
# If the cellar only has one version installed, don't complain
|
# If the cellar only has one version installed, don't complain
|
||||||
# that we can't tell which one to keep. Don't complain at all if the
|
# that we can't tell which one to keep. Don't complain at all if the
|
||||||
# only installed version is a pinned formula.
|
# only installed version is a pinned formula.
|
||||||
unless quiet
|
opoo "Skipping #{full_name}: most recent version #{pkg_version} not installed" unless quiet
|
||||||
opoo "Skipping #{full_name}: most recent version #{pkg_version} not installed"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
eligible_for_cleanup
|
eligible_for_cleanup
|
||||||
end
|
end
|
||||||
|
@ -244,9 +244,7 @@ class FormulaInstaller
|
|||||||
|
|
||||||
check_conflicts
|
check_conflicts
|
||||||
|
|
||||||
if !pour_bottle? && !formula.bottle_unneeded? && !DevelopmentTools.installed?
|
raise BuildToolsError, [formula] if !pour_bottle? && !formula.bottle_unneeded? && !DevelopmentTools.installed?
|
||||||
raise BuildToolsError, [formula]
|
|
||||||
end
|
|
||||||
|
|
||||||
unless ignore_deps?
|
unless ignore_deps?
|
||||||
deps = compute_dependencies
|
deps = compute_dependencies
|
||||||
@ -267,17 +265,13 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
options = display_options(formula)
|
options = display_options(formula)
|
||||||
if show_header?
|
oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options}".strip if show_header?
|
||||||
oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options}".strip
|
|
||||||
end
|
|
||||||
|
|
||||||
unless formula.tap&.private?
|
unless formula.tap&.private?
|
||||||
action = "#{formula.full_name} #{options}".strip
|
action = "#{formula.full_name} #{options}".strip
|
||||||
Utils::Analytics.report_event("install", action)
|
Utils::Analytics.report_event("install", action)
|
||||||
|
|
||||||
if installed_on_request
|
Utils::Analytics.report_event("install_on_request", action) if installed_on_request
|
||||||
Utils::Analytics.report_event("install_on_request", action)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self.class.attempted << formula
|
self.class.attempted << formula
|
||||||
@ -624,9 +618,7 @@ class FormulaInstaller
|
|||||||
keg = Keg.new(formula.prefix)
|
keg = Keg.new(formula.prefix)
|
||||||
link(keg)
|
link(keg)
|
||||||
|
|
||||||
unless @poured_bottle && formula.bottle_specification.skip_relocation?
|
fix_dynamic_linkage(keg) unless @poured_bottle && formula.bottle_specification.skip_relocation?
|
||||||
fix_dynamic_linkage(keg)
|
|
||||||
end
|
|
||||||
|
|
||||||
if build_bottle?
|
if build_bottle?
|
||||||
ohai "Not running post_install as we're building a bottle"
|
ohai "Not running post_install as we're building a bottle"
|
||||||
@ -757,9 +749,7 @@ class FormulaInstaller
|
|||||||
|
|
||||||
formula.update_head_version
|
formula.update_head_version
|
||||||
|
|
||||||
if !formula.prefix.directory? || Keg.new(formula.prefix).empty_installation?
|
raise "Empty installation" if !formula.prefix.directory? || Keg.new(formula.prefix).empty_installation?
|
||||||
raise "Empty installation"
|
|
||||||
end
|
|
||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
if e.is_a? BuildError
|
if e.is_a? BuildError
|
||||||
e.formula = formula
|
e.formula = formula
|
||||||
|
@ -16,9 +16,7 @@ module Formulary
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.load_formula(name, path, contents, namespace)
|
def self.load_formula(name, path, contents, namespace)
|
||||||
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
|
raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
|
||||||
raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!"
|
|
||||||
end
|
|
||||||
|
|
||||||
mod = Module.new
|
mod = Module.new
|
||||||
const_set(namespace, mod)
|
const_set(namespace, mod)
|
||||||
@ -244,9 +242,7 @@ module Formulary
|
|||||||
new_name = new_tap.core_tap? ? name : new_tapped_name
|
new_name = new_tap.core_tap? ? name : new_tapped_name
|
||||||
end
|
end
|
||||||
|
|
||||||
if warn && old_name && new_name
|
opoo "Use #{new_name} instead of deprecated #{old_name}" if warn && old_name && new_name
|
||||||
opoo "Use #{new_name} instead of deprecated #{old_name}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
[name, path]
|
[name, path]
|
||||||
@ -397,22 +393,16 @@ module Formulary
|
|||||||
return TapLoader.new(ref, from: from)
|
return TapLoader.new(ref, from: from)
|
||||||
end
|
end
|
||||||
|
|
||||||
if File.extname(ref) == ".rb" && Pathname.new(ref).expand_path.exist?
|
return FromPathLoader.new(ref) if File.extname(ref) == ".rb" && Pathname.new(ref).expand_path.exist?
|
||||||
return FromPathLoader.new(ref)
|
|
||||||
end
|
|
||||||
|
|
||||||
formula_with_that_name = core_path(ref)
|
formula_with_that_name = core_path(ref)
|
||||||
if formula_with_that_name.file?
|
return FormulaLoader.new(ref, formula_with_that_name) if formula_with_that_name.file?
|
||||||
return FormulaLoader.new(ref, formula_with_that_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
possible_alias = CoreTap.instance.alias_dir/ref
|
possible_alias = CoreTap.instance.alias_dir/ref
|
||||||
return AliasLoader.new(possible_alias) if possible_alias.file?
|
return AliasLoader.new(possible_alias) if possible_alias.file?
|
||||||
|
|
||||||
possible_tap_formulae = tap_paths(ref)
|
possible_tap_formulae = tap_paths(ref)
|
||||||
if possible_tap_formulae.size > 1
|
raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae) if possible_tap_formulae.size > 1
|
||||||
raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae)
|
|
||||||
end
|
|
||||||
|
|
||||||
if possible_tap_formulae.size == 1
|
if possible_tap_formulae.size == 1
|
||||||
path = possible_tap_formulae.first.resolved_path
|
path = possible_tap_formulae.first.resolved_path
|
||||||
@ -422,9 +412,7 @@ module Formulary
|
|||||||
|
|
||||||
if newref = CoreTap.instance.formula_renames[ref]
|
if newref = CoreTap.instance.formula_renames[ref]
|
||||||
formula_with_that_oldname = core_path(newref)
|
formula_with_that_oldname = core_path(newref)
|
||||||
if formula_with_that_oldname.file?
|
return FormulaLoader.new(newref, formula_with_that_oldname) if formula_with_that_oldname.file?
|
||||||
return FormulaLoader.new(newref, formula_with_that_oldname)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
possible_tap_newname_formulae = []
|
possible_tap_newname_formulae = []
|
||||||
@ -438,19 +426,13 @@ module Formulary
|
|||||||
raise TapFormulaWithOldnameAmbiguityError.new(ref, possible_tap_newname_formulae)
|
raise TapFormulaWithOldnameAmbiguityError.new(ref, possible_tap_newname_formulae)
|
||||||
end
|
end
|
||||||
|
|
||||||
unless possible_tap_newname_formulae.empty?
|
return TapLoader.new(possible_tap_newname_formulae.first, from: from) unless possible_tap_newname_formulae.empty?
|
||||||
return TapLoader.new(possible_tap_newname_formulae.first, from: from)
|
|
||||||
end
|
|
||||||
|
|
||||||
possible_keg_formula = Pathname.new("#{HOMEBREW_PREFIX}/opt/#{ref}/.brew/#{ref}.rb")
|
possible_keg_formula = Pathname.new("#{HOMEBREW_PREFIX}/opt/#{ref}/.brew/#{ref}.rb")
|
||||||
if possible_keg_formula.file?
|
return FormulaLoader.new(ref, possible_keg_formula) if possible_keg_formula.file?
|
||||||
return FormulaLoader.new(ref, possible_keg_formula)
|
|
||||||
end
|
|
||||||
|
|
||||||
possible_cached_formula = Pathname.new("#{HOMEBREW_CACHE_FORMULA}/#{ref}.rb")
|
possible_cached_formula = Pathname.new("#{HOMEBREW_CACHE_FORMULA}/#{ref}.rb")
|
||||||
if possible_cached_formula.file?
|
return FormulaLoader.new(ref, possible_cached_formula) if possible_cached_formula.file?
|
||||||
return FormulaLoader.new(ref, possible_cached_formula)
|
|
||||||
end
|
|
||||||
|
|
||||||
NullLoader.new(ref)
|
NullLoader.new(ref)
|
||||||
end
|
end
|
||||||
@ -473,9 +455,7 @@ module Formulary
|
|||||||
|
|
||||||
def self.find_with_priority(ref, spec = :stable)
|
def self.find_with_priority(ref, spec = :stable)
|
||||||
possible_pinned_tap_formulae = tap_paths(ref, Dir["#{HOMEBREW_LIBRARY}/PinnedTaps/*/*/"]).map(&:realpath)
|
possible_pinned_tap_formulae = tap_paths(ref, Dir["#{HOMEBREW_LIBRARY}/PinnedTaps/*/*/"]).map(&:realpath)
|
||||||
if possible_pinned_tap_formulae.size > 1
|
raise TapFormulaAmbiguityError.new(ref, possible_pinned_tap_formulae) if possible_pinned_tap_formulae.size > 1
|
||||||
raise TapFormulaAmbiguityError.new(ref, possible_pinned_tap_formulae)
|
|
||||||
end
|
|
||||||
|
|
||||||
if possible_pinned_tap_formulae.size == 1
|
if possible_pinned_tap_formulae.size == 1
|
||||||
selected_formula = factory(possible_pinned_tap_formulae.first, spec)
|
selected_formula = factory(possible_pinned_tap_formulae.first, spec)
|
||||||
|
@ -148,6 +148,4 @@ require "official_taps"
|
|||||||
require "tap"
|
require "tap"
|
||||||
require "tap_constants"
|
require "tap_constants"
|
||||||
|
|
||||||
if !ARGV.include?("--no-compat") && !ENV["HOMEBREW_NO_COMPAT"]
|
require "compat" if !ARGV.include?("--no-compat") && !ENV["HOMEBREW_NO_COMPAT"]
|
||||||
require "compat"
|
|
||||||
end
|
|
||||||
|
@ -263,9 +263,7 @@ class Keg
|
|||||||
|
|
||||||
if tap
|
if tap
|
||||||
bad_tap_opt = opt/tap.user
|
bad_tap_opt = opt/tap.user
|
||||||
if !bad_tap_opt.symlink? && bad_tap_opt.directory?
|
FileUtils.rm_rf bad_tap_opt if !bad_tap_opt.symlink? && bad_tap_opt.directory?
|
||||||
FileUtils.rm_rf bad_tap_opt
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
aliases.each do |a|
|
aliases.each do |a|
|
||||||
@ -569,9 +567,7 @@ class Keg
|
|||||||
begin
|
begin
|
||||||
keg = Keg.for(src)
|
keg = Keg.for(src)
|
||||||
rescue NotAKegError
|
rescue NotAKegError
|
||||||
if ARGV.verbose?
|
puts "Won't resolve conflicts for symlink #{dst} as it doesn't resolve into the Cellar" if ARGV.verbose?
|
||||||
puts "Won't resolve conflicts for symlink #{dst} as it doesn't resolve into the Cellar"
|
|
||||||
end
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -636,9 +632,7 @@ class Keg
|
|||||||
# Don't link pyc or pyo files because Python overwrites these
|
# Don't link pyc or pyo files because Python overwrites these
|
||||||
# cached object files and next time brew wants to link, the
|
# cached object files and next time brew wants to link, the
|
||||||
# file is in the way.
|
# file is in the way.
|
||||||
if %w[.pyc .pyo].include?(src.extname) && src.to_s.include?("/site-packages/")
|
Find.prune if %w[.pyc .pyo].include?(src.extname) && src.to_s.include?("/site-packages/")
|
||||||
Find.prune
|
|
||||||
end
|
|
||||||
|
|
||||||
case yield src.relative_path_from(root)
|
case yield src.relative_path_from(root)
|
||||||
when :skip_file, nil
|
when :skip_file, nil
|
||||||
|
@ -11,9 +11,7 @@ module Language
|
|||||||
# directory, consequently breaking that assumption. We require a tarball
|
# directory, consequently breaking that assumption. We require a tarball
|
||||||
# because npm install creates a "real" installation when fed a tarball.
|
# because npm install creates a "real" installation when fed a tarball.
|
||||||
output = Utils.popen_read("npm pack --ignore-scripts")
|
output = Utils.popen_read("npm pack --ignore-scripts")
|
||||||
if !$CHILD_STATUS.exitstatus.zero? || output.lines.empty?
|
raise "npm failed to pack #{Dir.pwd}" if !$CHILD_STATUS.exitstatus.zero? || output.lines.empty?
|
||||||
raise "npm failed to pack #{Dir.pwd}"
|
|
||||||
end
|
|
||||||
|
|
||||||
output.lines.last.chomp
|
output.lines.last.chomp
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,6 @@ require "pathname"
|
|||||||
|
|
||||||
HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath
|
HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath
|
||||||
|
|
||||||
unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
|
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.to_s) unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
|
||||||
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.to_s)
|
|
||||||
end
|
|
||||||
|
|
||||||
require "vendor/bundle-standalone/bundler/setup"
|
require "vendor/bundle-standalone/bundler/setup"
|
||||||
|
@ -11,9 +11,7 @@ class Locale
|
|||||||
def self.parse(string)
|
def self.parse(string)
|
||||||
string = string.to_s
|
string = string.to_s
|
||||||
|
|
||||||
if string !~ LOCALE_REGEX
|
raise ParserError, "'#{string}' cannot be parsed to a #{self}" if string !~ LOCALE_REGEX
|
||||||
raise ParserError, "'#{string}' cannot be parsed to a #{self}"
|
|
||||||
end
|
|
||||||
|
|
||||||
scan = proc do |regex|
|
scan = proc do |regex|
|
||||||
string.scan(/(?:\-|^)(#{regex})(?:\-|$)/).flatten.first
|
string.scan(/(?:\-|^)(#{regex})(?:\-|$)/).flatten.first
|
||||||
@ -29,9 +27,7 @@ class Locale
|
|||||||
attr_reader :language, :region, :script
|
attr_reader :language, :region, :script
|
||||||
|
|
||||||
def initialize(language, region, script)
|
def initialize(language, region, script)
|
||||||
if language.nil? && region.nil? && script.nil?
|
raise ArgumentError, "#{self.class} cannot be empty" if language.nil? && region.nil? && script.nil?
|
||||||
raise ArgumentError, "#{self.class} cannot be empty"
|
|
||||||
end
|
|
||||||
|
|
||||||
{
|
{
|
||||||
language: language,
|
language: language,
|
||||||
|
@ -118,9 +118,7 @@ class Migrator
|
|||||||
@old_tabs = old_cellar.subdirs.map { |d| Tab.for_keg(Keg.new(d)) }
|
@old_tabs = old_cellar.subdirs.map { |d| Tab.for_keg(Keg.new(d)) }
|
||||||
@old_tap = old_tabs.first.tap
|
@old_tap = old_tabs.first.tap
|
||||||
|
|
||||||
if !force && !from_same_tap_user?
|
raise MigratorDifferentTapsError.new(formula, old_tap) if !force && !from_same_tap_user?
|
||||||
raise MigratorDifferentTapsError.new(formula, old_tap)
|
|
||||||
end
|
|
||||||
|
|
||||||
@new_cellar = HOMEBREW_CELLAR/formula.name
|
@new_cellar = HOMEBREW_CELLAR/formula.name
|
||||||
@new_cellar_existed = @new_cellar.exist?
|
@new_cellar_existed = @new_cellar.exist?
|
||||||
@ -233,9 +231,7 @@ class Migrator
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if conflicted
|
odie "Remove #{new_cellar} manually and run brew migrate #{oldname}." if conflicted
|
||||||
odie "Remove #{new_cellar} manually and run brew migrate #{oldname}."
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
oh1 "Moving #{Formatter.identifier(oldname)} versions to #{new_cellar}"
|
oh1 "Moving #{Formatter.identifier(oldname)} versions to #{new_cellar}"
|
||||||
|
@ -87,9 +87,7 @@ module OS
|
|||||||
# remain public. New code should use `MacOS::X11.bin`, `MacOS::X11.lib` and
|
# remain public. New code should use `MacOS::X11.bin`, `MacOS::X11.lib` and
|
||||||
# `MacOS::X11.include` instead, as that accounts for Xcode-only systems.
|
# `MacOS::X11.include` instead, as that accounts for Xcode-only systems.
|
||||||
def prefix
|
def prefix
|
||||||
@prefix ||= if Pathname.new("/opt/X11/lib/libpng.dylib").exist?
|
@prefix ||= Pathname.new("/opt/X11") if Pathname.new("/opt/X11/lib/libpng.dylib").exist?
|
||||||
Pathname.new("/opt/X11")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def installed?
|
def installed?
|
||||||
|
@ -3,12 +3,8 @@ class CodesignRequirement < Requirement
|
|||||||
|
|
||||||
def initialize(tags)
|
def initialize(tags)
|
||||||
options = tags.shift
|
options = tags.shift
|
||||||
unless options.is_a?(Hash)
|
raise ArgumentError("CodesignRequirement requires an options Hash!") unless options.is_a?(Hash)
|
||||||
raise ArgumentError("CodesignRequirement requires an options Hash!")
|
raise ArgumentError("CodesignRequirement requires an identity key!") unless options.key?(:identity)
|
||||||
end
|
|
||||||
unless options.key?(:identity)
|
|
||||||
raise ArgumentError("CodesignRequirement requires an identity key!")
|
|
||||||
end
|
|
||||||
|
|
||||||
@identity = options.fetch(:identity)
|
@identity = options.fetch(:identity)
|
||||||
@with = options.fetch(:with, "code signing")
|
@with = options.fetch(:with, "code signing")
|
||||||
|
@ -66,9 +66,7 @@ class Resource
|
|||||||
# directory. Subclasses that override stage should implement the tmp
|
# directory. Subclasses that override stage should implement the tmp
|
||||||
# dir using {Mktemp} so that works with all subtypes.
|
# dir using {Mktemp} so that works with all subtypes.
|
||||||
def stage(target = nil, &block)
|
def stage(target = nil, &block)
|
||||||
unless target || block
|
raise ArgumentError, "target directory or block is required" unless target || block
|
||||||
raise ArgumentError, "target directory or block is required"
|
|
||||||
end
|
|
||||||
|
|
||||||
verify_download_integrity(fetch)
|
verify_download_integrity(fetch)
|
||||||
prepare_patches
|
prepare_patches
|
||||||
|
@ -7,13 +7,9 @@ module RuboCop
|
|||||||
def audit_formula(_node, _class_node, _parent_class_node, body_node)
|
def audit_formula(_node, _class_node, _parent_class_node, body_node)
|
||||||
return if body_node.nil?
|
return if body_node.nil?
|
||||||
|
|
||||||
if method_called_ever?(body_node, :md5)
|
problem "MD5 checksums are deprecated, please use SHA256" if method_called_ever?(body_node, :md5)
|
||||||
problem "MD5 checksums are deprecated, please use SHA256"
|
|
||||||
end
|
|
||||||
|
|
||||||
if method_called_ever?(body_node, :sha1)
|
problem "SHA1 checksums are deprecated, please use SHA256" if method_called_ever?(body_node, :sha1)
|
||||||
problem "SHA1 checksums are deprecated, please use SHA256"
|
|
||||||
end
|
|
||||||
|
|
||||||
sha256_calls = find_every_method_call_by_name(body_node, :sha256)
|
sha256_calls = find_every_method_call_by_name(body_node, :sha256)
|
||||||
sha256_calls.each do |sha256_call|
|
sha256_calls.each do |sha256_call|
|
||||||
|
@ -367,9 +367,7 @@ module RuboCop
|
|||||||
def check_precedence(first_nodes, next_nodes)
|
def check_precedence(first_nodes, next_nodes)
|
||||||
next_nodes.each do |each_next_node|
|
next_nodes.each do |each_next_node|
|
||||||
first_nodes.each do |each_first_node|
|
first_nodes.each do |each_first_node|
|
||||||
if component_precedes?(each_first_node, each_next_node)
|
return [each_first_node, each_next_node] if component_precedes?(each_first_node, each_next_node)
|
||||||
return [each_first_node, each_next_node]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
nil
|
nil
|
||||||
|
@ -65,14 +65,10 @@ module RuboCop
|
|||||||
desc = parameters(desc_call).first
|
desc = parameters(desc_call).first
|
||||||
|
|
||||||
# Check for leading whitespace.
|
# Check for leading whitespace.
|
||||||
if regex_match_group(desc, /^\s+/)
|
problem "Description shouldn't have a leading space" if regex_match_group(desc, /^\s+/)
|
||||||
problem "Description shouldn't have a leading space"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Check for trailing whitespace.
|
# Check for trailing whitespace.
|
||||||
if regex_match_group(desc, /\s+$/)
|
problem "Description shouldn't have a trailing space" if regex_match_group(desc, /\s+$/)
|
||||||
problem "Description shouldn't have a trailing space"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Check if command-line is wrongly used in formula's desc
|
# Check if command-line is wrongly used in formula's desc
|
||||||
if match = regex_match_group(desc, /(command ?line)/i)
|
if match = regex_match_group(desc, /(command ?line)/i)
|
||||||
|
@ -89,9 +89,7 @@ module RuboCop
|
|||||||
|
|
||||||
class OptionDeclarations < FormulaCop
|
class OptionDeclarations < FormulaCop
|
||||||
def audit_formula(_node, _class_node, _parent_class_node, body_node)
|
def audit_formula(_node, _class_node, _parent_class_node, body_node)
|
||||||
if find_method_def(body_node, :options)
|
problem "Use new-style option definitions" if find_method_def(body_node, :options)
|
||||||
problem "Use new-style option definitions"
|
|
||||||
end
|
|
||||||
|
|
||||||
find_instance_method_call(body_node, :build, :without?) do |method|
|
find_instance_method_call(body_node, :build, :without?) do |method|
|
||||||
next unless unless_modifier?(method.parent)
|
next unless unless_modifier?(method.parent)
|
||||||
@ -327,9 +325,7 @@ module RuboCop
|
|||||||
problem "Use Language::Node for npm install args" unless languageNodeModule?(method_node)
|
problem "Use Language::Node for npm install args" unless languageNodeModule?(method_node)
|
||||||
end
|
end
|
||||||
|
|
||||||
if find_method_def(body_node, :test)
|
problem "Use new-style test definitions (test do)" if find_method_def(body_node, :test)
|
||||||
problem "Use new-style test definitions (test do)"
|
|
||||||
end
|
|
||||||
|
|
||||||
find_method_with_args(body_node, :skip_clean, :all) do
|
find_method_with_args(body_node, :skip_clean, :all) do
|
||||||
problem "`skip_clean :all` is deprecated; brew no longer strips symbols. " \
|
problem "`skip_clean :all` is deprecated; brew no longer strips symbols. " \
|
||||||
|
@ -97,9 +97,7 @@ module RuboCop
|
|||||||
problem "Don't use #{Regexp.last_match(1)}use_mirror in SourceForge urls (url is #{url})."
|
problem "Don't use #{Regexp.last_match(1)}use_mirror in SourceForge urls (url is #{url})."
|
||||||
end
|
end
|
||||||
|
|
||||||
if url.end_with?("/download")
|
problem "Don't use /download in SourceForge urls (url is #{url})." if url.end_with?("/download")
|
||||||
problem "Don't use /download in SourceForge urls (url is #{url})."
|
|
||||||
end
|
|
||||||
|
|
||||||
if url =~ %r{^https?://sourceforge\.}
|
if url =~ %r{^https?://sourceforge\.}
|
||||||
problem "Use https://downloads.sourceforge.net to get geolocation (url is #{url})."
|
problem "Use https://downloads.sourceforge.net to get geolocation (url is #{url})."
|
||||||
|
@ -55,9 +55,7 @@ class SoftwareSpec
|
|||||||
resources.each_value do |r|
|
resources.each_value do |r|
|
||||||
r.owner = self
|
r.owner = self
|
||||||
r.version ||= begin
|
r.version ||= begin
|
||||||
if version.nil?
|
raise "#{full_name}: version missing for \"#{r.name}\" resource!" if version.nil?
|
||||||
raise "#{full_name}: version missing for \"#{r.name}\" resource!"
|
|
||||||
end
|
|
||||||
|
|
||||||
if version.head?
|
if version.head?
|
||||||
Version.create("HEAD")
|
Version.create("HEAD")
|
||||||
|
@ -30,9 +30,7 @@ module Homebrew
|
|||||||
args << "--parallel"
|
args << "--parallel"
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.verbose?
|
args += ["--extra-details", "--display-cop-names"] if ARGV.verbose?
|
||||||
args += ["--extra-details", "--display-cop-names"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if options[:except_cops]
|
if options[:except_cops]
|
||||||
options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
|
options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
|
||||||
@ -49,9 +47,7 @@ module Homebrew
|
|||||||
RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym)
|
RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym)
|
||||||
end
|
end
|
||||||
|
|
||||||
if cops_to_include.empty?
|
odie "RuboCops #{options[:only_cops].join(",")} were not found" if cops_to_include.empty?
|
||||||
odie "RuboCops #{options[:only_cops].join(",")} were not found"
|
|
||||||
end
|
|
||||||
|
|
||||||
args << "--only" << cops_to_include.join(",")
|
args << "--only" << cops_to_include.join(",")
|
||||||
end
|
end
|
||||||
|
@ -157,15 +157,9 @@ class SystemConfig
|
|||||||
if defaults_hash[:HOMEBREW_REPOSITORY] != HOMEBREW_REPOSITORY.to_s
|
if defaults_hash[:HOMEBREW_REPOSITORY] != HOMEBREW_REPOSITORY.to_s
|
||||||
f.puts "HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY}"
|
f.puts "HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY}"
|
||||||
end
|
end
|
||||||
if defaults_hash[:HOMEBREW_CELLAR] != HOMEBREW_CELLAR.to_s
|
f.puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}" if defaults_hash[:HOMEBREW_CELLAR] != HOMEBREW_CELLAR.to_s
|
||||||
f.puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}"
|
f.puts "HOMEBREW_CACHE: #{HOMEBREW_CACHE}" if defaults_hash[:HOMEBREW_CACHE] != HOMEBREW_CACHE.to_s
|
||||||
end
|
f.puts "HOMEBREW_TEMP: #{HOMEBREW_TEMP}" if defaults_hash[:HOMEBREW_TEMP] != HOMEBREW_TEMP.to_s
|
||||||
if defaults_hash[:HOMEBREW_CACHE] != HOMEBREW_CACHE.to_s
|
|
||||||
f.puts "HOMEBREW_CACHE: #{HOMEBREW_CACHE}"
|
|
||||||
end
|
|
||||||
if defaults_hash[:HOMEBREW_TEMP] != HOMEBREW_TEMP.to_s
|
|
||||||
f.puts "HOMEBREW_TEMP: #{HOMEBREW_TEMP}"
|
|
||||||
end
|
|
||||||
if defaults_hash[:HOMEBREW_RUBY_WARNINGS] != ENV["HOMEBREW_RUBY_WARNINGS"].to_s
|
if defaults_hash[:HOMEBREW_RUBY_WARNINGS] != ENV["HOMEBREW_RUBY_WARNINGS"].to_s
|
||||||
f.puts "HOMEBREW_RUBY_WARNINGS: #{ENV["HOMEBREW_RUBY_WARNINGS"]}"
|
f.puts "HOMEBREW_RUBY_WARNINGS: #{ENV["HOMEBREW_RUBY_WARNINGS"]}"
|
||||||
end
|
end
|
||||||
|
@ -133,13 +133,9 @@ class Tab < OpenStruct
|
|||||||
def self.for_formula(f)
|
def self.for_formula(f)
|
||||||
paths = []
|
paths = []
|
||||||
|
|
||||||
if f.opt_prefix.symlink? && f.opt_prefix.directory?
|
paths << f.opt_prefix.resolved_path if f.opt_prefix.symlink? && f.opt_prefix.directory?
|
||||||
paths << f.opt_prefix.resolved_path
|
|
||||||
end
|
|
||||||
|
|
||||||
if f.linked_keg.symlink? && f.linked_keg.directory?
|
paths << f.linked_keg.resolved_path if f.linked_keg.symlink? && f.linked_keg.directory?
|
||||||
paths << f.linked_keg.resolved_path
|
|
||||||
end
|
|
||||||
|
|
||||||
if (dirs = f.installed_prefixes).length == 1
|
if (dirs = f.installed_prefixes).length == 1
|
||||||
paths << dirs.first
|
paths << dirs.first
|
||||||
|
@ -22,17 +22,13 @@ class Tap
|
|||||||
repo = args.second
|
repo = args.second
|
||||||
end
|
end
|
||||||
|
|
||||||
if [user, repo].any? { |part| part.nil? || part.include?("/") }
|
raise "Invalid tap name '#{args.join("/")}'" if [user, repo].any? { |part| part.nil? || part.include?("/") }
|
||||||
raise "Invalid tap name '#{args.join("/")}'"
|
|
||||||
end
|
|
||||||
|
|
||||||
# We special case homebrew and linuxbrew so that users don't have to shift in a terminal.
|
# We special case homebrew and linuxbrew so that users don't have to shift in a terminal.
|
||||||
user = user.capitalize if ["homebrew", "linuxbrew"].include? user
|
user = user.capitalize if ["homebrew", "linuxbrew"].include? user
|
||||||
repo = repo.delete_prefix "homebrew-"
|
repo = repo.delete_prefix "homebrew-"
|
||||||
|
|
||||||
if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
|
return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
|
||||||
return CoreTap.instance
|
|
||||||
end
|
|
||||||
|
|
||||||
cache_key = "#{user}/#{repo}".downcase
|
cache_key = "#{user}/#{repo}".downcase
|
||||||
cache.fetch(cache_key) { |key| cache[key] = Tap.new(user, repo) }
|
cache.fetch(cache_key) { |key| cache[key] = Tap.new(user, repo) }
|
||||||
@ -280,9 +276,7 @@ class Tap
|
|||||||
begin
|
begin
|
||||||
safe_system "git", *args
|
safe_system "git", *args
|
||||||
unless Readall.valid_tap?(self, aliases: true)
|
unless Readall.valid_tap?(self, aliases: true)
|
||||||
unless ARGV.homebrew_developer?
|
raise "Cannot tap #{name}: invalid syntax in tap!" unless ARGV.homebrew_developer?
|
||||||
raise "Cannot tap #{name}: invalid syntax in tap!"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
rescue Interrupt, RuntimeError
|
rescue Interrupt, RuntimeError
|
||||||
ignore_interrupts do
|
ignore_interrupts do
|
||||||
|
@ -5,9 +5,7 @@ if ENV["HOMEBREW_TESTS_COVERAGE"]
|
|||||||
if ENV["HOMEBREW_COVERALLS_REPO_TOKEN"]
|
if ENV["HOMEBREW_COVERALLS_REPO_TOKEN"]
|
||||||
require "coveralls"
|
require "coveralls"
|
||||||
|
|
||||||
if !ENV["HOMEBREW_COLOR"] && (ENV["HOMEBREW_NO_COLOR"] || !$stdout.tty?)
|
Coveralls::Output.no_color if !ENV["HOMEBREW_COLOR"] && (ENV["HOMEBREW_NO_COLOR"] || !$stdout.tty?)
|
||||||
Coveralls::Output.no_color
|
|
||||||
end
|
|
||||||
|
|
||||||
formatters << Coveralls::SimpleCov::Formatter
|
formatters << Coveralls::SimpleCov::Formatter
|
||||||
|
|
||||||
@ -128,9 +126,7 @@ RSpec.configure do |config|
|
|||||||
|
|
||||||
config.before(:each, :needs_svn) do
|
config.before(:each, :needs_svn) do
|
||||||
homebrew_bin = File.dirname HOMEBREW_BREW_FILE
|
homebrew_bin = File.dirname HOMEBREW_BREW_FILE
|
||||||
unless %W[/usr/bin/svn #{homebrew_bin}/svn].map { |x| File.executable?(x) }.any?
|
skip "subversion not installed." unless %W[/usr/bin/svn #{homebrew_bin}/svn].map { |x| File.executable?(x) }.any?
|
||||||
skip "subversion not installed."
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
config.before(:each, :needs_unzip) do
|
config.before(:each, :needs_unzip) do
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
unless ENV["HOMEBREW_BREW_FILE"]
|
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
|
||||||
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!"
|
|
||||||
end
|
|
||||||
|
|
||||||
require "pathname"
|
require "pathname"
|
||||||
|
|
||||||
|
@ -17,9 +17,7 @@ module UnpackStrategy
|
|||||||
def self.can_extract?(path)
|
def self.can_extract?(path)
|
||||||
return true if path.magic_number.match?(/\A.{257}ustar/n)
|
return true if path.magic_number.match?(/\A.{257}ustar/n)
|
||||||
|
|
||||||
unless [Bzip2, Gzip, Lzip, Xz].any? { |s| s.can_extract?(path) }
|
return false unless [Bzip2, Gzip, Lzip, Xz].any? { |s| s.can_extract?(path) }
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
# Check if `tar` can list the contents, then it can also extract it.
|
# Check if `tar` can list the contents, then it can also extract it.
|
||||||
IO.popen(["tar", "tf", path], err: File::NULL) do |stdout|
|
IO.popen(["tar", "tf", path], err: File::NULL) do |stdout|
|
||||||
|
@ -37,9 +37,7 @@ def odebug(title, *sput)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def oh1(title, options = {})
|
def oh1(title, options = {})
|
||||||
if $stdout.tty? && !ARGV.verbose? && options.fetch(:truncate, :auto) == :auto
|
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose? && options.fetch(:truncate, :auto) == :auto
|
||||||
title = Tty.truncate(title)
|
|
||||||
end
|
|
||||||
puts Formatter.headline(title, color: :green)
|
puts Formatter.headline(title, color: :green)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -491,9 +489,7 @@ end
|
|||||||
# shortfall or overrun may vary.
|
# shortfall or overrun may vary.
|
||||||
def truncate_text_to_approximate_size(s, max_bytes, options = {})
|
def truncate_text_to_approximate_size(s, max_bytes, options = {})
|
||||||
front_weight = options.fetch(:front_weight, 0.5)
|
front_weight = options.fetch(:front_weight, 0.5)
|
||||||
if front_weight < 0.0 || front_weight > 1.0
|
raise "opts[:front_weight] must be between 0.0 and 1.0" if front_weight < 0.0 || front_weight > 1.0
|
||||||
raise "opts[:front_weight] must be between 0.0 and 1.0"
|
|
||||||
end
|
|
||||||
return s if s.bytesize <= max_bytes
|
return s if s.bytesize <= max_bytes
|
||||||
|
|
||||||
glue = "\n[...snip...]\n"
|
glue = "\n[...snip...]\n"
|
||||||
|
@ -185,9 +185,7 @@ module GitHub
|
|||||||
data_tmpfile.close
|
data_tmpfile.close
|
||||||
args += ["--data", "@#{data_tmpfile.path}"]
|
args += ["--data", "@#{data_tmpfile.path}"]
|
||||||
|
|
||||||
if request_method
|
args += ["--request", request_method.to_s] if request_method
|
||||||
args += ["--request", request_method.to_s]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
args += ["--dump-header", headers_tmpfile.path]
|
args += ["--dump-header", headers_tmpfile.path]
|
||||||
@ -206,9 +204,7 @@ module GitHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if !http_code.start_with?("2") || !status.success?
|
raise_api_error(output, errors, http_code, headers, scopes) if !http_code.start_with?("2") || !status.success?
|
||||||
raise_api_error(output, errors, http_code, headers, scopes)
|
|
||||||
end
|
|
||||||
|
|
||||||
return if http_code == "204" # No Content
|
return if http_code == "204" # No Content
|
||||||
|
|
||||||
|
@ -62,9 +62,7 @@ module Tty
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
if !ENV["HOMEBREW_COLOR"] && (ENV["HOMEBREW_NO_COLOR"] || !$stdout.tty?)
|
return "" if !ENV["HOMEBREW_COLOR"] && (ENV["HOMEBREW_NO_COLOR"] || !$stdout.tty?)
|
||||||
return ""
|
|
||||||
end
|
|
||||||
|
|
||||||
current_escape_sequence
|
current_escape_sequence
|
||||||
ensure
|
ensure
|
||||||
|
@ -206,9 +206,7 @@ class Version
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.create(val)
|
def self.create(val)
|
||||||
unless val.respond_to?(:to_str)
|
raise TypeError, "Version value must be a string; got a #{val.class} (#{val})" unless val.respond_to?(:to_str)
|
||||||
raise TypeError, "Version value must be a string; got a #{val.class} (#{val})"
|
|
||||||
end
|
|
||||||
|
|
||||||
if val.to_str.start_with?("HEAD")
|
if val.to_str.start_with?("HEAD")
|
||||||
HeadVersion.new(val)
|
HeadVersion.new(val)
|
||||||
@ -365,9 +363,7 @@ class Version
|
|||||||
private_class_method :_parse
|
private_class_method :_parse
|
||||||
|
|
||||||
def initialize(val)
|
def initialize(val)
|
||||||
unless val.respond_to?(:to_str)
|
raise TypeError, "Version value must be a string; got a #{val.class} (#{val})" unless val.respond_to?(:to_str)
|
||||||
raise TypeError, "Version value must be a string; got a #{val.class} (#{val})"
|
|
||||||
end
|
|
||||||
|
|
||||||
@version = val.to_str
|
@version = val.to_str
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user