Merge pull request #4919 from reitermarkus/rubocop
Update to RuboCop 0.59.1.
This commit is contained in:
commit
4897ec02d0
@ -47,11 +47,14 @@ Layout/SpaceAroundOperators:
|
|||||||
Layout/Tab:
|
Layout/Tab:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6300).
|
||||||
|
Layout/EmptyLineAfterGuardClause:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
# favour parens-less DSL-style arguments
|
# favour parens-less DSL-style arguments
|
||||||
Lint/AmbiguousBlockAssociation:
|
Lint/AmbiguousBlockAssociation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
|
||||||
# so many of these in formulae and can't be autocorrected
|
# so many of these in formulae and can't be autocorrected
|
||||||
# TODO: fix these as `ruby -w` complains about them.
|
# TODO: fix these as `ruby -w` complains about them.
|
||||||
Lint/AmbiguousRegexpLiteral:
|
Lint/AmbiguousRegexpLiteral:
|
||||||
|
|||||||
@ -97,6 +97,11 @@ Naming/UncommunicativeMethodParamName:
|
|||||||
- 'to'
|
- 'to'
|
||||||
- 'v'
|
- 'v'
|
||||||
|
|
||||||
|
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6258)
|
||||||
|
# and layout is not configurable (https://github.com/rubocop-hq/rubocop/issues/6254).
|
||||||
|
Layout/RescueEnsureAlignment:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
# Avoid false positives on modifiers used on symbols of methods
|
# Avoid false positives on modifiers used on symbols of methods
|
||||||
# See https://github.com/rubocop-hq/rubocop/issues/5953
|
# See https://github.com/rubocop-hq/rubocop/issues/5953
|
||||||
Style/AccessModifierDeclarations:
|
Style/AccessModifierDeclarations:
|
||||||
|
|||||||
@ -128,6 +128,7 @@ rescue BuildError => e
|
|||||||
exit 1
|
exit 1
|
||||||
rescue RuntimeError, SystemCallError => e
|
rescue RuntimeError, SystemCallError => e
|
||||||
raise if e.message.empty?
|
raise if e.message.empty?
|
||||||
|
|
||||||
onoe e
|
onoe e
|
||||||
$stderr.puts e.backtrace if ARGV.debug?
|
$stderr.puts e.backtrace if ARGV.debug?
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@ -32,6 +32,7 @@ class Build
|
|||||||
# Only allow Homebrew-approved directories into the PATH, unless
|
# Only allow Homebrew-approved directories into the PATH, unless
|
||||||
# a formula opts-in to allowing the user's path.
|
# a formula opts-in to allowing the user's path.
|
||||||
return unless formula.env.userpaths? || reqs.any? { |rq| rq.env.userpaths? }
|
return unless formula.env.userpaths? || reqs.any? { |rq| rq.env.userpaths? }
|
||||||
|
|
||||||
ENV.userpaths!
|
ENV.userpaths!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -26,12 +26,14 @@ class CacheStoreDatabase
|
|||||||
# Gets a value from the underlying database (if it already exists).
|
# Gets a value from the underlying database (if it already exists).
|
||||||
def get(key)
|
def get(key)
|
||||||
return unless created?
|
return unless created?
|
||||||
|
|
||||||
db[key]
|
db[key]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Gets a value from the underlying database (if it already exists).
|
# Gets a value from the underlying database (if it already exists).
|
||||||
def delete(key)
|
def delete(key)
|
||||||
return unless created?
|
return unless created?
|
||||||
|
|
||||||
db.delete(key)
|
db.delete(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,7 @@ module Cask
|
|||||||
|
|
||||||
def abstract_phase(dsl_key)
|
def abstract_phase(dsl_key)
|
||||||
return if (block = directives[dsl_key]).nil?
|
return if (block = directives[dsl_key]).nil?
|
||||||
|
|
||||||
class_for_dsl_key(dsl_key).new(cask).instance_eval(&block)
|
class_for_dsl_key(dsl_key).new(cask).instance_eval(&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -54,6 +54,7 @@ module Cask
|
|||||||
|
|
||||||
ORDERED_DIRECTIVES.each do |directive_sym|
|
ORDERED_DIRECTIVES.each do |directive_sym|
|
||||||
next unless directives.key?(directive_sym)
|
next unless directives.key?(directive_sym)
|
||||||
|
|
||||||
args = directives[directive_sym]
|
args = directives[directive_sym]
|
||||||
send("uninstall_#{directive_sym}", *(args.is_a?(Hash) ? [args] : args), **options)
|
send("uninstall_#{directive_sym}", *(args.is_a?(Hash) ? [args] : args), **options)
|
||||||
end
|
end
|
||||||
@ -66,6 +67,7 @@ module Cask
|
|||||||
def warn_for_unknown_directives(directives)
|
def warn_for_unknown_directives(directives)
|
||||||
unknown_keys = directives.keys - ORDERED_DIRECTIVES
|
unknown_keys = directives.keys - ORDERED_DIRECTIVES
|
||||||
return if unknown_keys.empty?
|
return if unknown_keys.empty?
|
||||||
|
|
||||||
opoo "Unknown arguments to #{stanza} -- #{unknown_keys.inspect}. " \
|
opoo "Unknown arguments to #{stanza} -- #{unknown_keys.inspect}. " \
|
||||||
"Running \"brew update; brew cleanup\" will likely fix it."
|
"Running \"brew update; brew cleanup\" will likely fix it."
|
||||||
end
|
end
|
||||||
@ -100,6 +102,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
# undocumented and untested: pass a path to uninstall :launchctl
|
# undocumented and untested: pass a path to uninstall :launchctl
|
||||||
next unless Pathname(service).exist?
|
next unless Pathname(service).exist?
|
||||||
|
|
||||||
command.run!("/bin/launchctl", args: ["unload", "-w", "--", service], sudo: with_sudo)
|
command.run!("/bin/launchctl", args: ["unload", "-w", "--", service], sudo: with_sudo)
|
||||||
command.run!("/bin/rm", args: ["-f", "--", service], sudo: with_sudo)
|
command.run!("/bin/rm", args: ["-f", "--", service], sudo: with_sudo)
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -113,6 +116,7 @@ module Cask
|
|||||||
.map { |pid, state, id| [pid.to_i, state.to_i, id] }
|
.map { |pid, state, id| [pid.to_i, state.to_i, id] }
|
||||||
.select do |fields|
|
.select do |fields|
|
||||||
next if fields[0].zero?
|
next if fields[0].zero?
|
||||||
|
|
||||||
fields[2] =~ /^#{Regexp.escape(bundle_id)}($|\.\d+)/
|
fields[2] =~ /^#{Regexp.escape(bundle_id)}($|\.\d+)/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -122,6 +126,7 @@ module Cask
|
|||||||
bundle_ids.each do |bundle_id|
|
bundle_ids.each do |bundle_id|
|
||||||
ohai "Quitting application ID #{bundle_id}"
|
ohai "Quitting application ID #{bundle_id}"
|
||||||
next if running_processes(bundle_id, command: command).empty?
|
next if running_processes(bundle_id, command: command).empty?
|
||||||
|
|
||||||
command.run!("/usr/bin/osascript", args: ["-e", %Q(tell application id "#{bundle_id}" to quit)], sudo: true)
|
command.run!("/usr/bin/osascript", args: ["-e", %Q(tell application id "#{bundle_id}" to quit)], sudo: true)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -147,6 +152,7 @@ module Cask
|
|||||||
ohai "Signalling '#{signal}' to application ID '#{bundle_id}'"
|
ohai "Signalling '#{signal}' to application ID '#{bundle_id}'"
|
||||||
pids = running_processes(bundle_id, command: command).map(&:first)
|
pids = running_processes(bundle_id, command: command).map(&:first)
|
||||||
next unless pids.any?
|
next unless pids.any?
|
||||||
|
|
||||||
# Note that unlike :quit, signals are sent from the current user (not
|
# Note that unlike :quit, signals are sent from the current user (not
|
||||||
# upgraded to the superuser). This is a todo item for the future, but
|
# upgraded to the superuser). This is a todo item for the future, but
|
||||||
# there should be some additional thought/safety checks about that, as a
|
# there should be some additional thought/safety checks about that, as a
|
||||||
@ -201,11 +207,13 @@ module Cask
|
|||||||
|
|
||||||
ohai "Running uninstall script #{executable}"
|
ohai "Running uninstall script #{executable}"
|
||||||
raise CaskInvalidError.new(cask, "#{stanza} :#{directive_name} without :executable.") if executable.nil?
|
raise CaskInvalidError.new(cask, "#{stanza} :#{directive_name} without :executable.") if executable.nil?
|
||||||
|
|
||||||
executable_path = cask.staged_path.join(executable)
|
executable_path = cask.staged_path.join(executable)
|
||||||
|
|
||||||
unless executable_path.exist?
|
unless executable_path.exist?
|
||||||
message = "uninstall script #{executable} does not exist"
|
message = "uninstall script #{executable} does not exist"
|
||||||
raise CaskError, "#{message}." unless force
|
raise CaskError, "#{message}." unless force
|
||||||
|
|
||||||
opoo "#{message}, skipping."
|
opoo "#{message}, skipping."
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@ -6,6 +6,7 @@ module Cask
|
|||||||
def link(command: nil, **options)
|
def link(command: nil, **options)
|
||||||
super(command: command, **options)
|
super(command: command, **options)
|
||||||
return if source.executable?
|
return if source.executable?
|
||||||
|
|
||||||
if source.writable?
|
if source.writable?
|
||||||
FileUtils.chmod "+x", source
|
FileUtils.chmod "+x", source
|
||||||
else
|
else
|
||||||
|
|||||||
@ -30,6 +30,7 @@ module Cask
|
|||||||
message = "It seems there is already #{self.class.english_article} " \
|
message = "It seems there is already #{self.class.english_article} " \
|
||||||
"#{self.class.english_name} at '#{target}'"
|
"#{self.class.english_name} at '#{target}'"
|
||||||
raise CaskError, "#{message}." unless force
|
raise CaskError, "#{message}." unless force
|
||||||
|
|
||||||
opoo "#{message}; overwriting."
|
opoo "#{message}; overwriting."
|
||||||
delete(target, force: force, command: command, **options)
|
delete(target, force: force, command: command, **options)
|
||||||
end
|
end
|
||||||
@ -55,12 +56,14 @@ module Cask
|
|||||||
message = "It seems there is already #{self.class.english_article} " \
|
message = "It seems there is already #{self.class.english_article} " \
|
||||||
"#{self.class.english_name} at '#{source}'"
|
"#{self.class.english_name} at '#{source}'"
|
||||||
raise CaskError, "#{message}." unless force
|
raise CaskError, "#{message}." unless force
|
||||||
|
|
||||||
opoo "#{message}; overwriting."
|
opoo "#{message}; overwriting."
|
||||||
delete(source, force: force, command: command, **options)
|
delete(source, force: force, command: command, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
unless target.exist?
|
unless target.exist?
|
||||||
return if skip || force
|
return if skip || force
|
||||||
|
|
||||||
raise CaskError, "It seems the #{self.class.english_name} source '#{target}' is not there."
|
raise CaskError, "It seems the #{self.class.english_name} source '#{target}' is not there."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,7 @@ module Cask
|
|||||||
unless path.exist?
|
unless path.exist?
|
||||||
raise CaskError, "pkg source file not found: '#{path.relative_path_from(cask.staged_path)}'"
|
raise CaskError, "pkg source file not found: '#{path.relative_path_from(cask.staged_path)}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"-pkg", path,
|
"-pkg", path,
|
||||||
"-target", "/"
|
"-target", "/"
|
||||||
|
|||||||
@ -11,6 +11,7 @@ module Cask
|
|||||||
|
|
||||||
if target_hash
|
if target_hash
|
||||||
raise CaskInvalidError unless target_hash.respond_to?(:keys)
|
raise CaskInvalidError unless target_hash.respond_to?(:keys)
|
||||||
|
|
||||||
target_hash.assert_valid_keys!(:target)
|
target_hash.assert_valid_keys!(:target)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ module Cask
|
|||||||
# bundles. Alfred 2.2 respects it even for App bundles.
|
# bundles. Alfred 2.2 respects it even for App bundles.
|
||||||
def add_altname_metadata(file, altname, command: nil)
|
def add_altname_metadata(file, altname, command: nil)
|
||||||
return if altname.to_s.casecmp(file.basename.to_s).zero?
|
return if altname.to_s.casecmp(file.basename.to_s).zero?
|
||||||
|
|
||||||
odebug "Adding #{ALT_NAME_ATTRIBUTE} metadata"
|
odebug "Adding #{ALT_NAME_ATTRIBUTE} metadata"
|
||||||
altnames = command.run("/usr/bin/xattr",
|
altnames = command.run("/usr/bin/xattr",
|
||||||
args: ["-p", ALT_NAME_ATTRIBUTE, file],
|
args: ["-p", ALT_NAME_ATTRIBUTE, file],
|
||||||
|
|||||||
@ -54,6 +54,7 @@ module Cask
|
|||||||
|
|
||||||
def unlink(**)
|
def unlink(**)
|
||||||
return unless target.symlink?
|
return unless target.symlink?
|
||||||
|
|
||||||
ohai "Unlinking #{self.class.english_name} '#{target}'."
|
ohai "Unlinking #{self.class.english_name} '#{target}'."
|
||||||
target.delete
|
target.delete
|
||||||
end
|
end
|
||||||
|
|||||||
@ -65,6 +65,7 @@ module Cask
|
|||||||
return if tap.user != "Homebrew"
|
return if tap.user != "Homebrew"
|
||||||
|
|
||||||
return unless cask.artifacts.any? { |k| k.is_a?(Artifact::Pkg) && k.stanza_options.key?(:allow_untrusted) }
|
return unless cask.artifacts.any? { |k| k.is_a?(Artifact::Pkg) && k.stanza_options.key?(:allow_untrusted) }
|
||||||
|
|
||||||
add_warning "allow_untrusted is not permitted in official Homebrew Cask taps"
|
add_warning "allow_untrusted is not permitted in official Homebrew Cask taps"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -73,6 +74,7 @@ module Cask
|
|||||||
|
|
||||||
return if cask.artifacts.none? { |k| k.is_a?(Artifact::Pkg) || k.is_a?(Artifact::Installer) }
|
return if cask.artifacts.none? { |k| k.is_a?(Artifact::Pkg) || k.is_a?(Artifact::Installer) }
|
||||||
return if cask.artifacts.any? { |k| k.is_a?(Artifact::Uninstall) }
|
return if cask.artifacts.any? { |k| k.is_a?(Artifact::Uninstall) }
|
||||||
|
|
||||||
add_warning "installer and pkg stanzas require an uninstall stanza"
|
add_warning "installer and pkg stanzas require an uninstall stanza"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -118,6 +120,7 @@ module Cask
|
|||||||
end
|
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
|
||||||
|
|
||||||
add_warning "only a single zap stanza is allowed"
|
add_warning "only a single zap stanza is allowed"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -141,6 +144,7 @@ module Cask
|
|||||||
return if tap.nil?
|
return if tap.nil?
|
||||||
|
|
||||||
return if commit_range.nil?
|
return if commit_range.nil?
|
||||||
|
|
||||||
previous_cask_contents = Git.last_revision_of_file(tap.path, @cask.sourcefile_path, before_commit: commit_range)
|
previous_cask_contents = Git.last_revision_of_file(tap.path, @cask.sourcefile_path, before_commit: commit_range)
|
||||||
return if previous_cask_contents.empty?
|
return if previous_cask_contents.empty?
|
||||||
|
|
||||||
@ -158,6 +162,7 @@ module Cask
|
|||||||
|
|
||||||
def check_version
|
def check_version
|
||||||
return unless cask.version
|
return unless cask.version
|
||||||
|
|
||||||
check_no_string_version_latest
|
check_no_string_version_latest
|
||||||
check_no_file_separator_in_version
|
check_no_file_separator_in_version
|
||||||
end
|
end
|
||||||
@ -165,6 +170,7 @@ module Cask
|
|||||||
def check_no_string_version_latest
|
def check_no_string_version_latest
|
||||||
odebug "Verifying version :latest does not appear as a string ('latest')"
|
odebug "Verifying version :latest does not appear as a string ('latest')"
|
||||||
return unless cask.version.raw_version == "latest"
|
return unless cask.version.raw_version == "latest"
|
||||||
|
|
||||||
add_error "you should use version :latest instead of version 'latest'"
|
add_error "you should use version :latest instead of version 'latest'"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -172,11 +178,13 @@ module Cask
|
|||||||
odebug "Verifying version does not contain '#{File::SEPARATOR}'"
|
odebug "Verifying version does not contain '#{File::SEPARATOR}'"
|
||||||
return unless cask.version.raw_version.is_a?(String)
|
return unless cask.version.raw_version.is_a?(String)
|
||||||
return unless cask.version.raw_version.include?(File::SEPARATOR)
|
return unless cask.version.raw_version.include?(File::SEPARATOR)
|
||||||
|
|
||||||
add_error "version should not contain '#{File::SEPARATOR}'"
|
add_error "version should not contain '#{File::SEPARATOR}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_sha256
|
def check_sha256
|
||||||
return unless cask.sha256
|
return unless cask.sha256
|
||||||
|
|
||||||
check_sha256_no_check_if_latest
|
check_sha256_no_check_if_latest
|
||||||
check_sha256_actually_256
|
check_sha256_actually_256
|
||||||
check_sha256_invalid
|
check_sha256_invalid
|
||||||
@ -186,6 +194,7 @@ module Cask
|
|||||||
odebug "Verifying sha256 :no_check with version :latest"
|
odebug "Verifying sha256 :no_check with version :latest"
|
||||||
return unless cask.version.latest?
|
return unless cask.version.latest?
|
||||||
return if cask.sha256 == :no_check
|
return if cask.sha256 == :no_check
|
||||||
|
|
||||||
add_error "you should use sha256 :no_check when version is :latest"
|
add_error "you should use sha256 :no_check when version is :latest"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -193,6 +202,7 @@ module Cask
|
|||||||
odebug "Verifying #{stanza} string is a legal SHA-256 digest"
|
odebug "Verifying #{stanza} string is a legal SHA-256 digest"
|
||||||
return unless sha256.is_a?(String)
|
return unless sha256.is_a?(String)
|
||||||
return if sha256.length == 64 && sha256[/^[0-9a-f]+$/i]
|
return if sha256.length == 64 && sha256[/^[0-9a-f]+$/i]
|
||||||
|
|
||||||
add_error "#{stanza} string must be of 64 hexadecimal characters"
|
add_error "#{stanza} string must be of 64 hexadecimal characters"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -200,6 +210,7 @@ module Cask
|
|||||||
odebug "Verifying #{stanza} is not a known invalid value"
|
odebug "Verifying #{stanza} is not a known invalid value"
|
||||||
empty_sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
empty_sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||||
return unless sha256 == empty_sha256
|
return unless sha256 == empty_sha256
|
||||||
|
|
||||||
add_error "cannot use the sha256 for an empty string in #{stanza}: #{empty_sha256}"
|
add_error "cannot use the sha256 for an empty string in #{stanza}: #{empty_sha256}"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -232,9 +243,11 @@ module Cask
|
|||||||
case cask.url.to_s
|
case cask.url.to_s
|
||||||
when %r{github.com/([^/]+)/([^/]+)/releases/download/(\S+)}
|
when %r{github.com/([^/]+)/([^/]+)/releases/download/(\S+)}
|
||||||
return if cask.version.latest?
|
return if cask.version.latest?
|
||||||
|
|
||||||
add_warning "Download uses GitHub releases, #{add_appcast}"
|
add_warning "Download uses GitHub releases, #{add_appcast}"
|
||||||
when %r{sourceforge.net/(\S+)}
|
when %r{sourceforge.net/(\S+)}
|
||||||
return if cask.version.latest?
|
return if cask.version.latest?
|
||||||
|
|
||||||
add_warning "Download is hosted on SourceForge, #{add_appcast}"
|
add_warning "Download is hosted on SourceForge, #{add_appcast}"
|
||||||
when %r{dl.devmate.com/(\S+)}
|
when %r{dl.devmate.com/(\S+)}
|
||||||
add_warning "Download is hosted on DevMate, #{add_appcast}"
|
add_warning "Download is hosted on DevMate, #{add_appcast}"
|
||||||
@ -245,6 +258,7 @@ module Cask
|
|||||||
|
|
||||||
def check_url
|
def check_url
|
||||||
return unless cask.url
|
return unless cask.url
|
||||||
|
|
||||||
check_download_url_format
|
check_download_url_format
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -259,6 +273,7 @@ module Cask
|
|||||||
|
|
||||||
def bad_url_format?(regex, valid_formats_array)
|
def bad_url_format?(regex, valid_formats_array)
|
||||||
return false unless cask.url.to_s =~ regex
|
return false unless cask.url.to_s =~ regex
|
||||||
|
|
||||||
valid_formats_array.none? { |format| cask.url.to_s =~ format }
|
valid_formats_array.none? { |format| cask.url.to_s =~ format }
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -289,6 +304,7 @@ module Cask
|
|||||||
def check_token_conflicts
|
def check_token_conflicts
|
||||||
return unless check_token_conflicts?
|
return unless check_token_conflicts?
|
||||||
return unless core_formula_names.include?(cask.token)
|
return unless core_formula_names.include?(cask.token)
|
||||||
|
|
||||||
add_warning "possible duplicate, cask token conflicts with Homebrew core formula: #{core_formula_url}"
|
add_warning "possible duplicate, cask token conflicts with Homebrew core formula: #{core_formula_url}"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -306,6 +322,7 @@ module Cask
|
|||||||
|
|
||||||
def check_download
|
def check_download
|
||||||
return unless download && cask.url
|
return unless download && cask.url
|
||||||
|
|
||||||
odebug "Auditing download"
|
odebug "Auditing download"
|
||||||
downloaded_path = download.perform
|
downloaded_path = download.perform
|
||||||
Verify.all(cask, downloaded_path)
|
Verify.all(cask, downloaded_path)
|
||||||
|
|||||||
@ -27,6 +27,7 @@ module Cask
|
|||||||
|
|
||||||
def tap
|
def tap
|
||||||
return super if block_given? # Object#tap
|
return super if block_given? # Object#tap
|
||||||
|
|
||||||
@tap
|
@tap
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ module Cask
|
|||||||
@config = config
|
@config = config
|
||||||
@dsl = DSL.new(self)
|
@dsl = DSL.new(self)
|
||||||
return unless block_given?
|
return unless block_given?
|
||||||
|
|
||||||
@dsl.instance_eval(&block)
|
@dsl.instance_eval(&block)
|
||||||
@dsl.language_eval
|
@dsl.language_eval
|
||||||
end
|
end
|
||||||
@ -62,6 +64,7 @@ module Cask
|
|||||||
def full_name
|
def full_name
|
||||||
return token if tap.nil?
|
return token if tap.nil?
|
||||||
return token if tap.user == "Homebrew"
|
return token if tap.user == "Homebrew"
|
||||||
|
|
||||||
"#{tap.name}/#{token}"
|
"#{tap.name}/#{token}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ module Cask
|
|||||||
|
|
||||||
def graph_dependencies(cask = self.cask, acc = TopologicalHash.new)
|
def graph_dependencies(cask = self.cask, acc = TopologicalHash.new)
|
||||||
return acc if acc.key?(cask)
|
return acc if acc.key?(cask)
|
||||||
|
|
||||||
deps = cask.depends_on.cask.map(&CaskLoader.public_method(:load))
|
deps = cask.depends_on.cask.map(&CaskLoader.public_method(:load))
|
||||||
acc[cask] = deps
|
acc[cask] = deps
|
||||||
deps.each do |dep|
|
deps.each do |dep|
|
||||||
@ -26,6 +27,7 @@ module Cask
|
|||||||
|
|
||||||
def sort
|
def sort
|
||||||
raise CaskSelfReferencingDependencyError, cask.token if graph[cask].include?(cask)
|
raise CaskSelfReferencingDependencyError, cask.token if graph[cask].include?(cask)
|
||||||
|
|
||||||
graph.tsort - [cask]
|
graph.tsort - [cask]
|
||||||
rescue TSort::Cyclic
|
rescue TSort::Cyclic
|
||||||
strongly_connected_components = graph.strongly_connected_components.sort_by(&:count)
|
strongly_connected_components = graph.strongly_connected_components.sort_by(&:count)
|
||||||
|
|||||||
@ -8,6 +8,7 @@ module Cask
|
|||||||
|
|
||||||
def self.can_load?(ref)
|
def self.can_load?(ref)
|
||||||
return false unless ref.respond_to?(:to_str)
|
return false unless ref.respond_to?(:to_str)
|
||||||
|
|
||||||
content = ref.to_str
|
content = ref.to_str
|
||||||
|
|
||||||
token = /(?:"[^"]*"|'[^']*')/
|
token = /(?:"[^"]*"|'[^']*')/
|
||||||
|
|||||||
@ -236,6 +236,7 @@ module Cask
|
|||||||
puts "Commands:\n\n"
|
puts "Commands:\n\n"
|
||||||
Cmd.command_classes.each do |klass|
|
Cmd.command_classes.each do |klass|
|
||||||
next unless klass.visible
|
next unless klass.visible
|
||||||
|
|
||||||
puts " #{klass.command_name.ljust(max_command_len)} #{_help_for(klass)}"
|
puts " #{klass.command_name.ljust(max_command_len)} #{_help_for(klass)}"
|
||||||
end
|
end
|
||||||
puts %Q(\nSee also "man brew-cask")
|
puts %Q(\nSee also "man brew-cask")
|
||||||
|
|||||||
@ -45,6 +45,7 @@ module Cask
|
|||||||
|
|
||||||
def casks(alternative: -> { [] })
|
def casks(alternative: -> { [] })
|
||||||
return @casks if defined?(@casks)
|
return @casks if defined?(@casks)
|
||||||
|
|
||||||
casks = args.empty? ? alternative.call : args
|
casks = args.empty? ? alternative.call : args
|
||||||
@casks = casks.map { |cask| CaskLoader.load(cask) }
|
@casks = casks.map { |cask| CaskLoader.load(cask) }
|
||||||
rescue CaskUnavailableError => e
|
rescue CaskUnavailableError => e
|
||||||
|
|||||||
@ -13,6 +13,7 @@ module Cask
|
|||||||
.reject { |cask| audit(cask) }
|
.reject { |cask| audit(cask) }
|
||||||
|
|
||||||
return if failed_casks.empty?
|
return if failed_casks.empty?
|
||||||
|
|
||||||
raise CaskError, "audit failed for casks: #{failed_casks.join(" ")}"
|
raise CaskError, "audit failed for casks: #{failed_casks.join(" ")}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ module Cask
|
|||||||
def initialize(*)
|
def initialize(*)
|
||||||
super
|
super
|
||||||
return if args.empty?
|
return if args.empty?
|
||||||
|
|
||||||
raise ArgumentError, "#{self.class.command_name} does not take arguments."
|
raise ArgumentError, "#{self.class.command_name} does not take arguments."
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -151,6 +152,7 @@ module Cask
|
|||||||
def self.check_sip
|
def self.check_sip
|
||||||
csrutil = "/usr/bin/csrutil"
|
csrutil = "/usr/bin/csrutil"
|
||||||
return "N/A" unless File.executable?(csrutil)
|
return "N/A" unless File.executable?(csrutil)
|
||||||
|
|
||||||
Open3.capture2(csrutil, "status")
|
Open3.capture2(csrutil, "status")
|
||||||
.first
|
.first
|
||||||
.gsub("This is an unsupported configuration, likely to break in " \
|
.gsub("This is an unsupported configuration, likely to break in " \
|
||||||
@ -186,6 +188,7 @@ module Cask
|
|||||||
|
|
||||||
def self.render_env_var(var)
|
def self.render_env_var(var)
|
||||||
return unless ENV.key?(var)
|
return unless ENV.key?(var)
|
||||||
|
|
||||||
var = %Q(#{var}="#{ENV[var]}")
|
var = %Q(#{var}="#{ENV[var]}")
|
||||||
puts user_tilde(var)
|
puts user_tilde(var)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -20,6 +20,7 @@ module Cask
|
|||||||
rescue CaskInvalidError
|
rescue CaskInvalidError
|
||||||
path = CaskLoader.path(args.first)
|
path = CaskLoader.path(args.first)
|
||||||
return path if path.file?
|
return path if path.file?
|
||||||
|
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,7 @@ module Cask
|
|||||||
cask.artifacts.each do |artifact|
|
cask.artifacts.each do |artifact|
|
||||||
next unless artifact.respond_to?(:install_phase)
|
next unless artifact.respond_to?(:install_phase)
|
||||||
next unless DSL::ORDINARY_ARTIFACT_CLASSES.include?(artifact.class)
|
next unless DSL::ORDINARY_ARTIFACT_CLASSES.include?(artifact.class)
|
||||||
|
|
||||||
puts artifact.to_s
|
puts artifact.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,7 @@ module Cask
|
|||||||
def initialize(*)
|
def initialize(*)
|
||||||
super
|
super
|
||||||
return if args.empty?
|
return if args.empty?
|
||||||
|
|
||||||
raise ArgumentError, "#{self.class.command_name} does not take arguments."
|
raise ArgumentError, "#{self.class.command_name} does not take arguments."
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ module Cask
|
|||||||
puts "Unstable Internal-use Commands:\n\n"
|
puts "Unstable Internal-use Commands:\n\n"
|
||||||
Cmd.command_classes.each do |klass|
|
Cmd.command_classes.each do |klass|
|
||||||
next if klass.visible
|
next if klass.visible
|
||||||
|
|
||||||
puts " #{klass.command_name.ljust(max_command_len)} #{self.class.help_for(klass)}"
|
puts " #{klass.command_name.ljust(max_command_len)} #{self.class.help_for(klass)}"
|
||||||
end
|
end
|
||||||
puts "\n"
|
puts "\n"
|
||||||
|
|||||||
@ -45,6 +45,7 @@ module Cask
|
|||||||
@format = :to_yaml if yaml?
|
@format = :to_yaml if yaml?
|
||||||
|
|
||||||
return if DSL::DSL_METHODS.include?(stanza)
|
return if DSL::DSL_METHODS.include?(stanza)
|
||||||
|
|
||||||
raise ArgumentError,
|
raise ArgumentError,
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Unknown/unsupported stanza: '#{stanza}'
|
Unknown/unsupported stanza: '#{stanza}'
|
||||||
|
|||||||
@ -32,6 +32,7 @@ module Cask
|
|||||||
def self.list_artifacts(cask)
|
def self.list_artifacts(cask)
|
||||||
cask.artifacts.group_by(&:class).each do |klass, artifacts|
|
cask.artifacts.group_by(&:class).each do |klass, artifacts|
|
||||||
next unless klass.respond_to?(:english_description)
|
next unless klass.respond_to?(:english_description)
|
||||||
|
|
||||||
ohai klass.english_description, artifacts.map(&:summarize_installed)
|
ohai klass.english_description, artifacts.map(&:summarize_installed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -9,6 +9,7 @@ module Cask
|
|||||||
def options
|
def options
|
||||||
@options ||= {}
|
@options ||= {}
|
||||||
return @options unless superclass.respond_to?(:options)
|
return @options unless superclass.respond_to?(:options)
|
||||||
|
|
||||||
superclass.options.merge(@options)
|
superclass.options.merge(@options)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -25,11 +26,13 @@ module Cask
|
|||||||
if [true, false].include?(default_value)
|
if [true, false].include?(default_value)
|
||||||
define_method(:"#{method}?") do
|
define_method(:"#{method}?") do
|
||||||
return default_value unless instance_variable_defined?(:"@#{method}")
|
return default_value unless instance_variable_defined?(:"@#{method}")
|
||||||
|
|
||||||
instance_variable_get(:"@#{method}") == true
|
instance_variable_get(:"@#{method}") == true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
define_method(:"#{method}") do
|
define_method(:"#{method}") do
|
||||||
return default_value unless instance_variable_defined?(:"@#{method}")
|
return default_value unless instance_variable_defined?(:"@#{method}")
|
||||||
|
|
||||||
instance_variable_get(:"@#{method}")
|
instance_variable_get(:"@#{method}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -18,6 +18,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
}).select do |cask|
|
}).select do |cask|
|
||||||
raise CaskNotInstalledError, cask unless cask.installed? || force?
|
raise CaskNotInstalledError, cask unless cask.installed? || force?
|
||||||
|
|
||||||
cask.outdated?(true)
|
cask.outdated?(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -87,6 +87,7 @@ module Cask
|
|||||||
def name(*args)
|
def name(*args)
|
||||||
@name ||= []
|
@name ||= []
|
||||||
return @name if args.empty?
|
return @name if args.empty?
|
||||||
|
|
||||||
@name.concat(args.flatten)
|
@name.concat(args.flatten)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -188,6 +189,7 @@ module Cask
|
|||||||
if !arg.is_a?(String) && arg != :latest
|
if !arg.is_a?(String) && arg != :latest
|
||||||
raise CaskInvalidError.new(cask, "invalid 'version' value: '#{arg.inspect}'")
|
raise CaskInvalidError.new(cask, "invalid 'version' value: '#{arg.inspect}'")
|
||||||
end
|
end
|
||||||
|
|
||||||
DSL::Version.new(arg)
|
DSL::Version.new(arg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -197,6 +199,7 @@ module Cask
|
|||||||
if !arg.is_a?(String) && arg != :no_check
|
if !arg.is_a?(String) && arg != :no_check
|
||||||
raise CaskInvalidError.new(cask, "invalid 'sha256' value: '#{arg.inspect}'")
|
raise CaskInvalidError.new(cask, "invalid 'sha256' value: '#{arg.inspect}'")
|
||||||
end
|
end
|
||||||
|
|
||||||
arg
|
arg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -205,6 +208,7 @@ module Cask
|
|||||||
def depends_on(*args)
|
def depends_on(*args)
|
||||||
@depends_on ||= DSL::DependsOn.new
|
@depends_on ||= DSL::DependsOn.new
|
||||||
return @depends_on if args.empty?
|
return @depends_on if args.empty?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@depends_on.load(*args)
|
@depends_on.load(*args)
|
||||||
rescue RuntimeError => e
|
rescue RuntimeError => e
|
||||||
@ -228,6 +232,7 @@ module Cask
|
|||||||
|
|
||||||
def staged_path
|
def staged_path
|
||||||
return @staged_path if @staged_path
|
return @staged_path if @staged_path
|
||||||
|
|
||||||
cask_version = version || :unknown
|
cask_version = version || :unknown
|
||||||
@staged_path = caskroom_path.join(cask_version.to_s)
|
@staged_path = caskroom_path.join(cask_version.to_s)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -39,11 +39,13 @@ module Cask
|
|||||||
result = instance_eval(&block)
|
result = instance_eval(&block)
|
||||||
return unless result
|
return unless result
|
||||||
return if result == :built_in_caveat
|
return if result == :built_in_caveat
|
||||||
|
|
||||||
@custom_caveats << result.to_s.sub(/\s*\Z/, "\n")
|
@custom_caveats << result.to_s.sub(/\s*\Z/, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
caveat :kext do
|
caveat :kext do
|
||||||
next if MacOS.version < :high_sierra
|
next if MacOS.version < :high_sierra
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
To install and/or use #{@cask} you may need to enable their kernel extension in
|
To install and/or use #{@cask} you may need to enable their kernel extension in
|
||||||
|
|
||||||
@ -76,6 +78,7 @@ module Cask
|
|||||||
|
|
||||||
caveat :files_in_usr_local do
|
caveat :files_in_usr_local do
|
||||||
next unless HOMEBREW_PREFIX.to_s.downcase.start_with?("/usr/local")
|
next unless HOMEBREW_PREFIX.to_s.downcase.start_with?("/usr/local")
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Cask #{@cask} installs files under /usr/local. The presence of such
|
Cask #{@cask} installs files under /usr/local. The presence of such
|
||||||
files can cause warnings when running "brew doctor", which is considered
|
files can cause warnings when running "brew doctor", which is considered
|
||||||
|
|||||||
@ -21,6 +21,7 @@ module Cask
|
|||||||
|
|
||||||
pairs.each do |key, value|
|
pairs.each do |key, value|
|
||||||
raise "invalid conflicts_with key: '#{key.inspect}'" unless VALID_KEYS.include?(key)
|
raise "invalid conflicts_with key: '#{key.inspect}'" unless VALID_KEYS.include?(key)
|
||||||
|
|
||||||
instance_variable_set("@#{key}", instance_variable_get("@#{key}").merge([*value]))
|
instance_variable_set("@#{key}", instance_variable_get("@#{key}").merge([*value]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -15,11 +15,13 @@ module Cask
|
|||||||
@pairs = pairs
|
@pairs = pairs
|
||||||
pairs.each do |key, value|
|
pairs.each do |key, value|
|
||||||
raise "invalid container key: '#{key.inspect}'" unless VALID_KEYS.include?(key)
|
raise "invalid container key: '#{key.inspect}'" unless VALID_KEYS.include?(key)
|
||||||
|
|
||||||
send(:"#{key}=", value)
|
send(:"#{key}=", value)
|
||||||
end
|
end
|
||||||
|
|
||||||
return if type.nil?
|
return if type.nil?
|
||||||
return unless UnpackStrategy.from_type(type).nil?
|
return unless UnpackStrategy.from_type(type).nil?
|
||||||
|
|
||||||
raise "invalid container type: #{type.inspect}"
|
raise "invalid container type: #{type.inspect}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ module Cask
|
|||||||
def load(**pairs)
|
def load(**pairs)
|
||||||
pairs.each do |key, value|
|
pairs.each do |key, value|
|
||||||
raise "invalid depends_on key: '#{key.inspect}'" unless VALID_KEYS.include?(key)
|
raise "invalid depends_on key: '#{key.inspect}'" unless VALID_KEYS.include?(key)
|
||||||
|
|
||||||
self[key] = send(:"#{key}=", *value)
|
self[key] = send(:"#{key}=", *value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -65,11 +66,13 @@ module Cask
|
|||||||
@macos ||= []
|
@macos ||= []
|
||||||
macos = if args.count == 1 && args.first =~ /^\s*(<|>|[=<>]=)\s*(\S+)\s*$/
|
macos = if args.count == 1 && args.first =~ /^\s*(<|>|[=<>]=)\s*(\S+)\s*$/
|
||||||
raise "'depends_on macos' comparison expressions cannot be combined" unless @macos.empty?
|
raise "'depends_on macos' comparison expressions cannot be combined" unless @macos.empty?
|
||||||
|
|
||||||
operator = Regexp.last_match[1].to_sym
|
operator = Regexp.last_match[1].to_sym
|
||||||
release = self.class.coerce_os_release(Regexp.last_match[2])
|
release = self.class.coerce_os_release(Regexp.last_match[2])
|
||||||
[[operator, release]]
|
[[operator, release]]
|
||||||
else
|
else
|
||||||
raise "'depends_on macos' comparison expressions cannot be combined" if @macos.first.is_a?(Symbol)
|
raise "'depends_on macos' comparison expressions cannot be combined" if @macos.first.is_a?(Symbol)
|
||||||
|
|
||||||
args.map(&self.class.method(:coerce_os_release)).sort
|
args.map(&self.class.method(:coerce_os_release)).sort
|
||||||
end
|
end
|
||||||
@macos.concat(macos)
|
@macos.concat(macos)
|
||||||
@ -82,11 +85,13 @@ module Cask
|
|||||||
end
|
end
|
||||||
invalid_arches = arches - VALID_ARCHES.keys
|
invalid_arches = arches - VALID_ARCHES.keys
|
||||||
raise "invalid 'depends_on arch' values: #{invalid_arches.inspect}" unless invalid_arches.empty?
|
raise "invalid 'depends_on arch' values: #{invalid_arches.inspect}" unless invalid_arches.empty?
|
||||||
|
|
||||||
@arch.concat(arches.map { |arch| VALID_ARCHES[arch] })
|
@arch.concat(arches.map { |arch| VALID_ARCHES[arch] })
|
||||||
end
|
end
|
||||||
|
|
||||||
def x11=(arg)
|
def x11=(arg)
|
||||||
raise "invalid 'depends_on x11' value: #{arg.inspect}" unless [true, false].include?(arg)
|
raise "invalid 'depends_on x11' value: #{arg.inspect}" unless [true, false].include?(arg)
|
||||||
|
|
||||||
@x11 = arg
|
@x11 = arg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -112,6 +112,7 @@ module Cask
|
|||||||
|
|
||||||
def version
|
def version
|
||||||
return self if empty? || latest?
|
return self if empty? || latest?
|
||||||
|
|
||||||
self.class.new(yield)
|
self.class.new(yield)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -151,6 +151,7 @@ module Cask
|
|||||||
def verify_has_sha
|
def verify_has_sha
|
||||||
odebug "Checking cask has checksum"
|
odebug "Checking cask has checksum"
|
||||||
return unless @cask.sha256 == :no_check
|
return unless @cask.sha256 == :no_check
|
||||||
|
|
||||||
raise CaskNoShasumError, @cask.token
|
raise CaskNoShasumError, @cask.token
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -198,6 +199,7 @@ module Cask
|
|||||||
|
|
||||||
artifacts.each do |artifact|
|
artifacts.each do |artifact|
|
||||||
next unless artifact.respond_to?(:install_phase)
|
next unless artifact.respond_to?(:install_phase)
|
||||||
|
|
||||||
odebug "Installing artifact of class #{artifact.class}"
|
odebug "Installing artifact of class #{artifact.class}"
|
||||||
|
|
||||||
if artifact.is_a?(Artifact::Binary)
|
if artifact.is_a?(Artifact::Binary)
|
||||||
@ -211,6 +213,7 @@ module Cask
|
|||||||
begin
|
begin
|
||||||
already_installed_artifacts.each do |artifact|
|
already_installed_artifacts.each do |artifact|
|
||||||
next unless artifact.respond_to?(:uninstall_phase)
|
next unless artifact.respond_to?(:uninstall_phase)
|
||||||
|
|
||||||
odebug "Reverting installation of artifact of class #{artifact.class}"
|
odebug "Reverting installation of artifact of class #{artifact.class}"
|
||||||
artifact.uninstall_phase(command: @command, verbose: verbose?, force: force?)
|
artifact.uninstall_phase(command: @command, verbose: verbose?, force: force?)
|
||||||
end
|
end
|
||||||
@ -236,6 +239,7 @@ module Cask
|
|||||||
|
|
||||||
def macos_dependencies
|
def macos_dependencies
|
||||||
return unless @cask.depends_on.macos
|
return unless @cask.depends_on.macos
|
||||||
|
|
||||||
if @cask.depends_on.macos.first.is_a?(Array)
|
if @cask.depends_on.macos.first.is_a?(Array)
|
||||||
operator, release = @cask.depends_on.macos.first
|
operator, release = @cask.depends_on.macos.first
|
||||||
unless MacOS.version.send(operator, release)
|
unless MacOS.version.send(operator, release)
|
||||||
@ -262,11 +266,13 @@ module Cask
|
|||||||
|
|
||||||
def arch_dependencies
|
def arch_dependencies
|
||||||
return if @cask.depends_on.arch.nil?
|
return if @cask.depends_on.arch.nil?
|
||||||
|
|
||||||
@current_arch ||= { type: Hardware::CPU.type, bits: Hardware::CPU.bits }
|
@current_arch ||= { type: Hardware::CPU.type, bits: Hardware::CPU.bits }
|
||||||
return if @cask.depends_on.arch.any? do |arch|
|
return if @cask.depends_on.arch.any? do |arch|
|
||||||
arch[:type] == @current_arch[:type] &&
|
arch[:type] == @current_arch[:type] &&
|
||||||
Array(arch[:bits]).include?(@current_arch[:bits])
|
Array(arch[:bits]).include?(@current_arch[:bits])
|
||||||
end
|
end
|
||||||
|
|
||||||
raise CaskError,
|
raise CaskError,
|
||||||
"Cask #{@cask} depends on hardware architecture being one of " \
|
"Cask #{@cask} depends on hardware architecture being one of " \
|
||||||
"[#{@cask.depends_on.arch.map(&:to_s).join(", ")}], " \
|
"[#{@cask.depends_on.arch.map(&:to_s).join(", ")}], " \
|
||||||
@ -362,6 +368,7 @@ module Cask
|
|||||||
# TODO: logically could be in a separate class
|
# TODO: logically could be in a separate class
|
||||||
def enable_accessibility_access
|
def enable_accessibility_access
|
||||||
return unless @cask.accessibility_access
|
return unless @cask.accessibility_access
|
||||||
|
|
||||||
ohai "Enabling accessibility access"
|
ohai "Enabling accessibility access"
|
||||||
if MacOS.version <= :mountain_lion
|
if MacOS.version <= :mountain_lion
|
||||||
@command.run!(
|
@command.run!(
|
||||||
@ -402,6 +409,7 @@ module Cask
|
|||||||
|
|
||||||
def disable_accessibility_access
|
def disable_accessibility_access
|
||||||
return unless @cask.accessibility_access
|
return unless @cask.accessibility_access
|
||||||
|
|
||||||
if MacOS.version >= :mavericks && MacOS.version <= :el_capitan
|
if MacOS.version >= :mavericks && MacOS.version <= :el_capitan
|
||||||
ohai "Disabling accessibility access"
|
ohai "Disabling accessibility access"
|
||||||
@command.run!("/usr/bin/sqlite3",
|
@command.run!("/usr/bin/sqlite3",
|
||||||
@ -480,6 +488,7 @@ module Cask
|
|||||||
|
|
||||||
artifacts.each do |artifact|
|
artifacts.each do |artifact|
|
||||||
next unless artifact.respond_to?(:uninstall_phase)
|
next unless artifact.respond_to?(:uninstall_phase)
|
||||||
|
|
||||||
odebug "Un-installing artifact of class #{artifact.class}"
|
odebug "Un-installing artifact of class #{artifact.class}"
|
||||||
artifact.uninstall_phase(command: @command, verbose: verbose?, skip: clear, force: force?)
|
artifact.uninstall_phase(command: @command, verbose: verbose?, skip: clear, force: force?)
|
||||||
end
|
end
|
||||||
@ -502,11 +511,13 @@ module Cask
|
|||||||
|
|
||||||
def backup_path
|
def backup_path
|
||||||
return if @cask.staged_path.nil?
|
return if @cask.staged_path.nil?
|
||||||
|
|
||||||
Pathname("#{@cask.staged_path}.upgrading")
|
Pathname("#{@cask.staged_path}.upgrading")
|
||||||
end
|
end
|
||||||
|
|
||||||
def backup_metadata_path
|
def backup_metadata_path
|
||||||
return if @cask.metadata_versioned_path.nil?
|
return if @cask.metadata_versioned_path.nil?
|
||||||
|
|
||||||
Pathname("#{@cask.metadata_versioned_path}.upgrading")
|
Pathname("#{@cask.metadata_versioned_path}.upgrading")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -99,6 +99,7 @@ module Cask
|
|||||||
|
|
||||||
def rmdir(path)
|
def rmdir(path)
|
||||||
return unless path.children.empty?
|
return unless path.children.empty?
|
||||||
|
|
||||||
if path.symlink?
|
if path.symlink?
|
||||||
@command.run!("/bin/rm", args: ["-f", "--", path], sudo: true)
|
@command.run!("/bin/rm", args: ["-f", "--", path], sudo: true)
|
||||||
else
|
else
|
||||||
@ -125,6 +126,7 @@ module Cask
|
|||||||
|
|
||||||
def clean_ds_store(dir)
|
def clean_ds_store(dir)
|
||||||
return unless (ds_store = dir.join(".DS_Store")).exist?
|
return unless (ds_store = dir.join(".DS_Store")).exist?
|
||||||
|
|
||||||
@command.run!("/bin/rm", args: ["--", ds_store], sudo: true)
|
@command.run!("/bin/rm", args: ["--", ds_store], sudo: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ module Cask
|
|||||||
def set_permissions(paths, permissions_str)
|
def set_permissions(paths, permissions_str)
|
||||||
full_paths = remove_nonexistent(paths)
|
full_paths = remove_nonexistent(paths)
|
||||||
return if full_paths.empty?
|
return if full_paths.empty?
|
||||||
|
|
||||||
@command.run!("/bin/chmod", args: ["-R", "--", permissions_str] + full_paths,
|
@command.run!("/bin/chmod", args: ["-R", "--", permissions_str] + full_paths,
|
||||||
sudo: false)
|
sudo: false)
|
||||||
end
|
end
|
||||||
@ -33,6 +34,7 @@ module Cask
|
|||||||
def set_ownership(paths, user: current_user, group: "staff")
|
def set_ownership(paths, user: current_user, group: "staff")
|
||||||
full_paths = remove_nonexistent(paths)
|
full_paths = remove_nonexistent(paths)
|
||||||
return if full_paths.empty?
|
return if full_paths.empty?
|
||||||
|
|
||||||
ohai "Changing ownership of paths required by #{@cask}; your password may be necessary"
|
ohai "Changing ownership of paths required by #{@cask}; your password may be necessary"
|
||||||
@command.run!("/usr/sbin/chown", args: ["-R", "--", "#{user}:#{group}"] + full_paths,
|
@command.run!("/usr/sbin/chown", args: ["-R", "--", "#{user}:#{group}"] + full_paths,
|
||||||
sudo: true)
|
sudo: true)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ class URL
|
|||||||
|
|
||||||
ATTRIBUTES.each do |attribute|
|
ATTRIBUTES.each do |attribute|
|
||||||
next unless options.key?(attribute)
|
next unless options.key?(attribute)
|
||||||
|
|
||||||
instance_variable_set("@#{attribute}", options[attribute])
|
instance_variable_set("@#{attribute}", options[attribute])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -57,6 +57,7 @@ module CleanupRefinement
|
|||||||
|
|
||||||
def stale?(scrub = false)
|
def stale?(scrub = false)
|
||||||
return false unless resolved_path.file?
|
return false unless resolved_path.file?
|
||||||
|
|
||||||
stale_formula?(scrub) || stale_cask?(scrub)
|
stale_formula?(scrub) || stale_cask?(scrub)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -162,6 +163,7 @@ module Homebrew
|
|||||||
cleanup_cache
|
cleanup_cache
|
||||||
cleanup_logs
|
cleanup_logs
|
||||||
return if dry_run?
|
return if dry_run?
|
||||||
|
|
||||||
rm_ds_store
|
rm_ds_store
|
||||||
else
|
else
|
||||||
args.each do |arg|
|
args.each do |arg|
|
||||||
@ -211,6 +213,7 @@ module Homebrew
|
|||||||
|
|
||||||
def cleanup_logs
|
def cleanup_logs
|
||||||
return unless HOMEBREW_LOGS.directory?
|
return unless HOMEBREW_LOGS.directory?
|
||||||
|
|
||||||
HOMEBREW_LOGS.subdirs.each do |dir|
|
HOMEBREW_LOGS.subdirs.each do |dir|
|
||||||
cleanup_path(dir) { dir.rmtree } if dir.prune?(days || DEFAULT_LOG_DAYS)
|
cleanup_path(dir) { dir.rmtree } if dir.prune?(days || DEFAULT_LOG_DAYS)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -115,6 +115,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return if depends_on.nil?
|
return if depends_on.nil?
|
||||||
|
|
||||||
primary = option_to_name(depends_on)
|
primary = option_to_name(depends_on)
|
||||||
@constraints << [primary, secondary, :optional]
|
@constraints << [primary, secondary, :optional]
|
||||||
end
|
end
|
||||||
@ -139,6 +140,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
next if violations.count < 2
|
next if violations.count < 2
|
||||||
|
|
||||||
raise OptionConflictError, violations.map(&method(:name_to_option))
|
raise OptionConflictError, violations.map(&method(:name_to_option))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -147,6 +149,7 @@ module Homebrew
|
|||||||
@conflicts.each do |mutually_exclusive_options_group|
|
@conflicts.each do |mutually_exclusive_options_group|
|
||||||
@constraints.each do |p, s|
|
@constraints.each do |p, s|
|
||||||
next unless Set[p, s].subset?(Set[*mutually_exclusive_options_group])
|
next unless Set[p, s].subset?(Set[*mutually_exclusive_options_group])
|
||||||
|
|
||||||
raise InvalidConstraintError.new(p, s)
|
raise InvalidConstraintError.new(p, s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -15,6 +15,7 @@ module Homebrew
|
|||||||
config_file = HOMEBREW_REPOSITORY/".git/config"
|
config_file = HOMEBREW_REPOSITORY/".git/config"
|
||||||
|
|
||||||
raise UsageError if ARGV.named.size > 1
|
raise UsageError if ARGV.named.size > 1
|
||||||
|
|
||||||
case ARGV.named.first
|
case ARGV.named.first
|
||||||
when nil, "state"
|
when nil, "state"
|
||||||
analyticsdisabled = \
|
analyticsdisabled = \
|
||||||
|
|||||||
@ -48,8 +48,10 @@ module Homebrew
|
|||||||
cmd_paths.each_with_object([]) do |path, cmds|
|
cmd_paths.each_with_object([]) do |path, cmds|
|
||||||
Dir["#{path}/brew-*"].each do |file|
|
Dir["#{path}/brew-*"].each do |file|
|
||||||
next unless File.executable?(file)
|
next unless File.executable?(file)
|
||||||
|
|
||||||
cmd = File.basename(file, ".rb")[5..-1]
|
cmd = File.basename(file, ".rb")[5..-1]
|
||||||
next if cmd.include?(".")
|
next if cmd.include?(".")
|
||||||
|
|
||||||
cmds << cmd
|
cmds << cmd
|
||||||
end
|
end
|
||||||
end.sort
|
end.sort
|
||||||
|
|||||||
@ -73,6 +73,7 @@ module Homebrew
|
|||||||
puts_deps_tree Formula.installed.sort, !ARGV.one?
|
puts_deps_tree Formula.installed.sort, !ARGV.one?
|
||||||
else
|
else
|
||||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
raise FormulaUnspecifiedError if ARGV.named.empty?
|
||||||
|
|
||||||
puts_deps_tree ARGV.formulae, !ARGV.one?
|
puts_deps_tree ARGV.formulae, !ARGV.one?
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
@ -92,6 +93,7 @@ module Homebrew
|
|||||||
|
|
||||||
if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
raise FormulaUnspecifiedError unless mode.installed?
|
raise FormulaUnspecifiedError unless mode.installed?
|
||||||
|
|
||||||
puts_deps Formula.installed.sort
|
puts_deps Formula.installed.sort
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -107,6 +109,7 @@ module Homebrew
|
|||||||
|
|
||||||
def condense_requirements(deps)
|
def condense_requirements(deps)
|
||||||
return deps if ARGV.include?("--include-requirements")
|
return deps if ARGV.include?("--include-requirements")
|
||||||
|
|
||||||
deps.select { |dep| dep.is_a? Dependency }
|
deps.select { |dep| dep.is_a? Dependency }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ module Homebrew
|
|||||||
|
|
||||||
if search_type.empty?
|
if search_type.empty?
|
||||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
raise FormulaUnspecifiedError if ARGV.named.empty?
|
||||||
|
|
||||||
desc = {}
|
desc = {}
|
||||||
ARGV.formulae.each { |f| desc[f.full_name] = f.desc }
|
ARGV.formulae.each { |f| desc[f.full_name] = f.desc }
|
||||||
results = Descriptions.new(desc)
|
results = Descriptions.new(desc)
|
||||||
|
|||||||
@ -45,6 +45,7 @@ module Homebrew
|
|||||||
|
|
||||||
out = checks.send(method)
|
out = checks.send(method)
|
||||||
next if out.nil? || out.empty?
|
next if out.nil? || out.empty?
|
||||||
|
|
||||||
if first_warning
|
if first_warning
|
||||||
$stderr.puts <<~EOS
|
$stderr.puts <<~EOS
|
||||||
#{Tty.bold}Please note that these warnings are just used to help the Homebrew maintainers
|
#{Tty.bold}Please note that these warnings are just used to help the Homebrew maintainers
|
||||||
|
|||||||
@ -54,6 +54,7 @@ module Homebrew
|
|||||||
raise
|
raise
|
||||||
rescue => e
|
rescue => e
|
||||||
raise if ARGV.homebrew_developer?
|
raise if ARGV.homebrew_developer?
|
||||||
|
|
||||||
fetched_bottle = false
|
fetched_bottle = false
|
||||||
onoe e.message
|
onoe e.message
|
||||||
opoo "Bottle fetch failed: fetching the source."
|
opoo "Bottle fetch failed: fetching the source."
|
||||||
@ -63,6 +64,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
next if fetched_bottle
|
next if fetched_bottle
|
||||||
|
|
||||||
fetch_formula(f)
|
fetch_formula(f)
|
||||||
|
|
||||||
f.resources.each do |r|
|
f.resources.each do |r|
|
||||||
|
|||||||
@ -106,6 +106,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
raise "No logs." if logs.empty?
|
raise "No logs." if logs.empty?
|
||||||
|
|
||||||
logs
|
logs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -171,6 +171,7 @@ module Homebrew
|
|||||||
%w[build required recommended optional].map do |type|
|
%w[build required recommended optional].map do |type|
|
||||||
reqs = f.requirements.select(&:"#{type}?")
|
reqs = f.requirements.select(&:"#{type}?")
|
||||||
next if reqs.to_a.empty?
|
next if reqs.to_a.empty?
|
||||||
|
|
||||||
puts "#{type.capitalize}: #{decorate_requirements(reqs)}"
|
puts "#{type.capitalize}: #{decorate_requirements(reqs)}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -243,6 +244,7 @@ module Homebrew
|
|||||||
|
|
||||||
def dep_display_s(dep)
|
def dep_display_s(dep)
|
||||||
return dep.name if dep.option_tags.empty?
|
return dep.name if dep.option_tags.empty?
|
||||||
|
|
||||||
"#{dep.name} #{dep.option_tags.map { |o| "--#{o}" }.join(" ")}"
|
"#{dep.name} #{dep.option_tags.map { |o| "--#{o}" }.join(" ")}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -98,6 +98,7 @@ module Homebrew
|
|||||||
if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX
|
if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX
|
||||||
next
|
next
|
||||||
end
|
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?
|
||||||
end
|
end
|
||||||
@ -237,6 +238,7 @@ module Homebrew
|
|||||||
# Even if we don't install this formula mark it as no longer just
|
# Even if we don't install this formula mark it as no longer just
|
||||||
# installed as a dependency.
|
# installed as a dependency.
|
||||||
next unless f.opt_prefix.directory?
|
next unless f.opt_prefix.directory?
|
||||||
|
|
||||||
keg = Keg.new(f.opt_prefix.resolved_path)
|
keg = Keg.new(f.opt_prefix.resolved_path)
|
||||||
tab = Tab.for_keg(keg)
|
tab = Tab.for_keg(keg)
|
||||||
unless tab.installed_on_request
|
unless tab.installed_on_request
|
||||||
@ -246,6 +248,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return if formulae.empty?
|
return if formulae.empty?
|
||||||
|
|
||||||
Install.perform_preinstall_checks
|
Install.perform_preinstall_checks
|
||||||
|
|
||||||
formulae.each do |f|
|
formulae.each do |f|
|
||||||
@ -288,6 +291,7 @@ module Homebrew
|
|||||||
|
|
||||||
# Do not search taps if the formula name is qualified
|
# Do not search taps if the formula name is qualified
|
||||||
return if e.name.include?("/")
|
return if e.name.include?("/")
|
||||||
|
|
||||||
ohai "Searching taps..."
|
ohai "Searching taps..."
|
||||||
taps_search_results = search_taps(e.name)[:formulae]
|
taps_search_results = search_taps(e.name)[:formulae]
|
||||||
case taps_search_results.length
|
case taps_search_results.length
|
||||||
|
|||||||
@ -47,6 +47,7 @@ module Homebrew
|
|||||||
# Things below use the CELLAR, which doesn't until the first formula is installed.
|
# Things below use the CELLAR, which doesn't until the first formula is installed.
|
||||||
unless HOMEBREW_CELLAR.exist?
|
unless HOMEBREW_CELLAR.exist?
|
||||||
raise NoSuchKegError, ARGV.named.first unless ARGV.named.empty?
|
raise NoSuchKegError, ARGV.named.first unless ARGV.named.empty?
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ module Homebrew
|
|||||||
if args.full_name?
|
if args.full_name?
|
||||||
full_names = Formula.installed.map(&:full_name).sort(&tap_and_name_comparison)
|
full_names = Formula.installed.map(&:full_name).sort(&tap_and_name_comparison)
|
||||||
return if full_names.empty?
|
return if full_names.empty?
|
||||||
|
|
||||||
puts Formatter.columns(full_names)
|
puts Formatter.columns(full_names)
|
||||||
else
|
else
|
||||||
ENV["CLICOLOR"] = nil
|
ENV["CLICOLOR"] = nil
|
||||||
@ -136,6 +138,7 @@ module Homebrew
|
|||||||
names.sort.each do |d|
|
names.sort.each do |d|
|
||||||
versions = d.subdirs.map { |pn| pn.basename.to_s }
|
versions = d.subdirs.map { |pn| pn.basename.to_s }
|
||||||
next if args.multiple? && versions.length < 2
|
next if args.multiple? && versions.length < 2
|
||||||
|
|
||||||
puts "#{d.basename} #{versions * " "}"
|
puts "#{d.basename} #{versions * " "}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,6 +21,7 @@ module Homebrew
|
|||||||
puts_options Formula.installed.sort
|
puts_options Formula.installed.sort
|
||||||
else
|
else
|
||||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
raise FormulaUnspecifiedError if ARGV.named.empty?
|
||||||
|
|
||||||
puts_options ARGV.formulae
|
puts_options ARGV.formulae
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -28,6 +29,7 @@ module Homebrew
|
|||||||
def puts_options(formulae)
|
def puts_options(formulae)
|
||||||
formulae.each do |f|
|
formulae.each do |f|
|
||||||
next if f.options.empty?
|
next if f.options.empty?
|
||||||
|
|
||||||
if ARGV.include? "--compact"
|
if ARGV.include? "--compact"
|
||||||
puts f.options.as_flags.sort * " "
|
puts f.options.as_flags.sort * " "
|
||||||
else
|
else
|
||||||
|
|||||||
@ -17,6 +17,7 @@ module Homebrew
|
|||||||
|
|
||||||
Keg::PRUNEABLE_DIRECTORIES.each do |dir|
|
Keg::PRUNEABLE_DIRECTORIES.each do |dir|
|
||||||
next unless dir.directory?
|
next unless dir.directory?
|
||||||
|
|
||||||
dir.find do |path|
|
dir.find do |path|
|
||||||
path.extend(ObserverPathnameExtension)
|
path.extend(ObserverPathnameExtension)
|
||||||
if path.symlink?
|
if path.symlink?
|
||||||
|
|||||||
@ -117,12 +117,14 @@ module Homebrew
|
|||||||
|
|
||||||
return unless $stdout.tty?
|
return unless $stdout.tty?
|
||||||
return if args.remaining.empty?
|
return if args.remaining.empty?
|
||||||
|
|
||||||
metacharacters = %w[\\ | ( ) [ ] { } ^ $ * + ?].freeze
|
metacharacters = %w[\\ | ( ) [ ] { } ^ $ * + ?].freeze
|
||||||
return unless metacharacters.any? do |char|
|
return unless metacharacters.any? do |char|
|
||||||
args.remaining.any? do |arg|
|
args.remaining.any? do |arg|
|
||||||
arg.include?(char) && !arg.start_with?("/")
|
arg.include?(char) && !arg.start_with?("/")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ohai <<~EOS
|
ohai <<~EOS
|
||||||
Did you mean to perform a regular expression search?
|
Did you mean to perform a regular expression search?
|
||||||
Surround your query with /slashes/ to search locally by regex.
|
Surround your query with /slashes/ to search locally by regex.
|
||||||
|
|||||||
@ -9,6 +9,7 @@ module Homebrew
|
|||||||
ARGV.named.each do |name|
|
ARGV.named.each do |name|
|
||||||
tap = Tap.fetch(name)
|
tap = Tap.fetch(name)
|
||||||
raise "pinning #{tap} is not allowed" if tap.core_tap?
|
raise "pinning #{tap} is not allowed" if tap.core_tap?
|
||||||
|
|
||||||
tap.pin
|
tap.pin
|
||||||
ohai "Pinned #{tap}"
|
ohai "Pinned #{tap}"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -8,6 +8,7 @@ module Homebrew
|
|||||||
ARGV.named.each do |name|
|
ARGV.named.each do |name|
|
||||||
tap = Tap.fetch(name)
|
tap = Tap.fetch(name)
|
||||||
raise "unpinning #{tap} is not allowed" if tap.core_tap?
|
raise "unpinning #{tap} is not allowed" if tap.core_tap?
|
||||||
|
|
||||||
tap.unpin
|
tap.unpin
|
||||||
ohai "Unpinned #{tap}"
|
ohai "Unpinned #{tap}"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -22,6 +22,7 @@ module Homebrew
|
|||||||
Hash[ARGV.named.map do |name|
|
Hash[ARGV.named.map do |name|
|
||||||
rack = Formulary.to_rack(name)
|
rack = Formulary.to_rack(name)
|
||||||
next unless rack.directory?
|
next unless rack.directory?
|
||||||
|
|
||||||
[rack, rack.subdirs.map { |d| Keg.new(d) }]
|
[rack, rack.subdirs.map { |d| Keg.new(d) }]
|
||||||
end]
|
end]
|
||||||
else
|
else
|
||||||
|
|||||||
@ -33,6 +33,7 @@ module Homebrew
|
|||||||
|
|
||||||
if stage_dir.exist?
|
if stage_dir.exist?
|
||||||
raise "Destination #{stage_dir} already exists!" unless ARGV.force?
|
raise "Destination #{stage_dir} already exists!" unless ARGV.force?
|
||||||
|
|
||||||
rm_rf stage_dir
|
rm_rf stage_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ module Homebrew
|
|||||||
ENV["VERBOSE"] = nil
|
ENV["VERBOSE"] = nil
|
||||||
|
|
||||||
next unless ARGV.git?
|
next unless ARGV.git?
|
||||||
|
|
||||||
ohai "Setting up git repository"
|
ohai "Setting up git repository"
|
||||||
cd stage_dir
|
cd stage_dir
|
||||||
system "git", "init", "-q"
|
system "git", "init", "-q"
|
||||||
|
|||||||
@ -10,6 +10,7 @@ module Homebrew
|
|||||||
ARGV.named.each do |tapname|
|
ARGV.named.each do |tapname|
|
||||||
tap = Tap.fetch(tapname)
|
tap = Tap.fetch(tapname)
|
||||||
raise "untapping #{tap} is not allowed" if tap.core_tap?
|
raise "untapping #{tap} is not allowed" if tap.core_tap?
|
||||||
|
|
||||||
tap.uninstall
|
tap.uninstall
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -92,6 +92,7 @@ module Homebrew
|
|||||||
updated_taps = []
|
updated_taps = []
|
||||||
Tap.each do |tap|
|
Tap.each do |tap|
|
||||||
next unless tap.git?
|
next unless tap.git?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
reporter = Reporter.new(tap)
|
reporter = Reporter.new(tap)
|
||||||
rescue Reporter::ReporterRevisionUnsetError => e
|
rescue Reporter::ReporterRevisionUnsetError => e
|
||||||
@ -150,8 +151,10 @@ module Homebrew
|
|||||||
|
|
||||||
def install_core_tap_if_necessary
|
def install_core_tap_if_necessary
|
||||||
return if ENV["HOMEBREW_UPDATE_TEST"]
|
return if ENV["HOMEBREW_UPDATE_TEST"]
|
||||||
|
|
||||||
core_tap = CoreTap.instance
|
core_tap = CoreTap.instance
|
||||||
return if core_tap.installed?
|
return if core_tap.installed?
|
||||||
|
|
||||||
CoreTap.ensure_installed!
|
CoreTap.ensure_installed!
|
||||||
revision = core_tap.git_head
|
revision = core_tap.git_head
|
||||||
ENV["HOMEBREW_UPDATE_BEFORE_HOMEBREW_HOMEBREW_CORE"] = revision
|
ENV["HOMEBREW_UPDATE_BEFORE_HOMEBREW_HOMEBREW_CORE"] = revision
|
||||||
@ -236,6 +239,7 @@ class Reporter
|
|||||||
dst_full_name = tap.formula_file_to_name(dst)
|
dst_full_name = tap.formula_file_to_name(dst)
|
||||||
# Don't report formulae that are moved within a tap but not renamed
|
# Don't report formulae that are moved within a tap but not renamed
|
||||||
next if src_full_name == dst_full_name
|
next if src_full_name == dst_full_name
|
||||||
|
|
||||||
@report[:D] << src_full_name
|
@report[:D] << src_full_name
|
||||||
@report[:A] << dst_full_name
|
@report[:A] << dst_full_name
|
||||||
end
|
end
|
||||||
@ -302,6 +306,7 @@ class Reporter
|
|||||||
# This means it is a Cask
|
# This means it is a Cask
|
||||||
if report[:DC].include? full_name
|
if report[:DC].include? full_name
|
||||||
next unless (HOMEBREW_PREFIX/"Caskroom"/new_name).exist?
|
next unless (HOMEBREW_PREFIX/"Caskroom"/new_name).exist?
|
||||||
|
|
||||||
new_tap = Tap.fetch(new_tap_name)
|
new_tap = Tap.fetch(new_tap_name)
|
||||||
new_tap.install unless new_tap.installed?
|
new_tap.install unless new_tap.installed?
|
||||||
ohai "#{name} has been moved to Homebrew.", <<~EOS
|
ohai "#{name} has been moved to Homebrew.", <<~EOS
|
||||||
@ -309,6 +314,7 @@ class Reporter
|
|||||||
brew cask uninstall --force #{name}
|
brew cask uninstall --force #{name}
|
||||||
EOS
|
EOS
|
||||||
next if (HOMEBREW_CELLAR/new_name.split("/").last).directory?
|
next if (HOMEBREW_CELLAR/new_name.split("/").last).directory?
|
||||||
|
|
||||||
ohai "Installing #{new_name}..."
|
ohai "Installing #{new_name}..."
|
||||||
system HOMEBREW_BREW_FILE, "install", new_full_name
|
system HOMEBREW_BREW_FILE, "install", new_full_name
|
||||||
begin
|
begin
|
||||||
@ -322,8 +328,10 @@ class Reporter
|
|||||||
end
|
end
|
||||||
|
|
||||||
next unless (dir = HOMEBREW_CELLAR/name).exist? # skip if formula is not installed.
|
next unless (dir = HOMEBREW_CELLAR/name).exist? # skip if formula is not installed.
|
||||||
|
|
||||||
tabs = dir.subdirs.map { |d| Tab.for_keg(Keg.new(d)) }
|
tabs = dir.subdirs.map { |d| Tab.for_keg(Keg.new(d)) }
|
||||||
next unless tabs.first.tap == tap # skip if installed formula is not from this tap.
|
next unless tabs.first.tap == tap # skip if installed formula is not from this tap.
|
||||||
|
|
||||||
new_tap = Tap.fetch(new_tap_name)
|
new_tap = Tap.fetch(new_tap_name)
|
||||||
# For formulae migrated to cask: Auto-install cask or provide install instructions.
|
# For formulae migrated to cask: Auto-install cask or provide install instructions.
|
||||||
if new_tap_name.start_with?("homebrew/cask")
|
if new_tap_name.start_with?("homebrew/cask")
|
||||||
@ -445,6 +453,7 @@ class ReporterHub
|
|||||||
end.compact
|
end.compact
|
||||||
|
|
||||||
return if formulae.empty?
|
return if formulae.empty?
|
||||||
|
|
||||||
# Dump formula list.
|
# Dump formula list.
|
||||||
ohai title
|
ohai title
|
||||||
puts Formatter.columns(formulae.sort)
|
puts Formatter.columns(formulae.sort)
|
||||||
|
|||||||
@ -109,6 +109,7 @@ module Homebrew
|
|||||||
upgrade_formula(f)
|
upgrade_formula(f)
|
||||||
next if !ARGV.include?("--cleanup") && !ENV["HOMEBREW_UPGRADE_CLEANUP"]
|
next if !ARGV.include?("--cleanup") && !ENV["HOMEBREW_UPGRADE_CLEANUP"]
|
||||||
next unless f.installed?
|
next unless f.installed?
|
||||||
|
|
||||||
Cleanup.new.cleanup_formula(f)
|
Cleanup.new.cleanup_formula(f)
|
||||||
rescue UnsatisfiedRequirements => e
|
rescue UnsatisfiedRequirements => e
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
|
|||||||
@ -76,6 +76,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return if uses.empty?
|
return if uses.empty?
|
||||||
|
|
||||||
puts Formatter.columns(uses.map(&:full_name).sort)
|
puts Formatter.columns(uses.map(&:full_name).sort)
|
||||||
odie "Missing formulae should not have dependents!" if used_formulae_missing
|
odie "Missing formulae should not have dependents!" if used_formulae_missing
|
||||||
end
|
end
|
||||||
|
|||||||
@ -11,6 +11,7 @@ module Cask
|
|||||||
def initialize(*)
|
def initialize(*)
|
||||||
super
|
super
|
||||||
return if args.empty?
|
return if args.empty?
|
||||||
|
|
||||||
raise ArgumentError, "#{self.class.command_name} does not take arguments."
|
raise ArgumentError, "#{self.class.command_name} does not take arguments."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# RuboCop version used for `brew style` and `brew cask style`
|
# RuboCop version used for `brew style` and `brew cask style`
|
||||||
HOMEBREW_RUBOCOP_VERSION = "0.58.2"
|
HOMEBREW_RUBOCOP_VERSION = "0.59.1"
|
||||||
HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.21.0" # has to be updated when RuboCop version changes
|
HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.22.0" # has to be updated when RuboCop version changes
|
||||||
|
|||||||
@ -16,6 +16,7 @@ class CxxStdlib
|
|||||||
if type && ![:libstdcxx, :libcxx].include?(type)
|
if type && ![:libstdcxx, :libcxx].include?(type)
|
||||||
raise ArgumentError, "Invalid C++ stdlib type: #{type}"
|
raise ArgumentError, "Invalid C++ stdlib type: #{type}"
|
||||||
end
|
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)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -35,12 +35,14 @@ module Dependable
|
|||||||
|
|
||||||
def prune_from_option?(build)
|
def prune_from_option?(build)
|
||||||
return if !optional? && !recommended?
|
return if !optional? && !recommended?
|
||||||
|
|
||||||
build.without?(self)
|
build.without?(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
def prune_if_build_and_not_dependent?(dependent, formula = nil)
|
def prune_if_build_and_not_dependent?(dependent, formula = nil)
|
||||||
return false unless build?
|
return false unless build?
|
||||||
return dependent.installed? unless formula
|
return dependent.installed? unless formula
|
||||||
|
|
||||||
dependent != formula
|
dependent != formula
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -41,6 +41,7 @@ class Requirements < DelegateClass(Set)
|
|||||||
if other.is_a?(Comparable)
|
if other.is_a?(Comparable)
|
||||||
grep(other.class) do |req|
|
grep(other.class) do |req|
|
||||||
return self if req > other
|
return self if req > other
|
||||||
|
|
||||||
delete(req)
|
delete(req)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -126,6 +127,7 @@ module Homebrew
|
|||||||
def reject_ignores(dependables, ignores, includes)
|
def reject_ignores(dependables, ignores, includes)
|
||||||
dependables.reject do |dep|
|
dependables.reject do |dep|
|
||||||
next false unless ignores.any? { |ignore| dep.send(ignore) }
|
next false unless ignores.any? { |ignore| dep.send(ignore) }
|
||||||
|
|
||||||
includes.none? { |include| dep.send(include) }
|
includes.none? { |include| dep.send(include) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -93,11 +93,13 @@ class Dependency
|
|||||||
next
|
next
|
||||||
when :skip
|
when :skip
|
||||||
next if @expand_stack.include? dep.name
|
next if @expand_stack.include? dep.name
|
||||||
|
|
||||||
expanded_deps.concat(expand(dep.to_formula, &block))
|
expanded_deps.concat(expand(dep.to_formula, &block))
|
||||||
when :keep_but_prune_recursive_deps
|
when :keep_but_prune_recursive_deps
|
||||||
expanded_deps << dep
|
expanded_deps << dep
|
||||||
else
|
else
|
||||||
next if @expand_stack.include? dep.name
|
next if @expand_stack.include? dep.name
|
||||||
|
|
||||||
expanded_deps.concat(expand(dep.to_formula, &block))
|
expanded_deps.concat(expand(dep.to_formula, &block))
|
||||||
expanded_deps << dep
|
expanded_deps << dep
|
||||||
end
|
end
|
||||||
@ -167,6 +169,7 @@ class Dependency
|
|||||||
def merge_temporality(deps)
|
def merge_temporality(deps)
|
||||||
# Means both build and runtime dependency.
|
# Means both build and runtime dependency.
|
||||||
return [] unless deps.all?(&:build?)
|
return [] unless deps.all?(&:build?)
|
||||||
|
|
||||||
[:build]
|
[:build]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -53,11 +53,13 @@ class DependencyCollector
|
|||||||
|
|
||||||
def git_dep_if_needed(tags)
|
def git_dep_if_needed(tags)
|
||||||
return if Utils.git_available?
|
return if Utils.git_available?
|
||||||
|
|
||||||
Dependency.new("git", tags)
|
Dependency.new("git", tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
def subversion_dep_if_needed(tags)
|
def subversion_dep_if_needed(tags)
|
||||||
return if Utils.svn_available?
|
return if Utils.svn_available?
|
||||||
|
|
||||||
Dependency.new("subversion", tags)
|
Dependency.new("subversion", tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -39,10 +39,12 @@ class Descriptions
|
|||||||
# repos were updated more recently than it was.
|
# repos were updated more recently than it was.
|
||||||
def self.cache_fresh?
|
def self.cache_fresh?
|
||||||
return false unless CACHE_FILE.exist?
|
return false unless CACHE_FILE.exist?
|
||||||
|
|
||||||
cache_mtime = File.mtime(CACHE_FILE)
|
cache_mtime = File.mtime(CACHE_FILE)
|
||||||
|
|
||||||
Tap.each do |tap|
|
Tap.each do |tap|
|
||||||
next unless tap.git?
|
next unless tap.git?
|
||||||
|
|
||||||
repo_mtime = File.mtime(tap.path/".git/refs/heads/master")
|
repo_mtime = File.mtime(tap.path/".git/refs/heads/master")
|
||||||
return false if repo_mtime > cache_mtime
|
return false if repo_mtime > cache_mtime
|
||||||
end
|
end
|
||||||
@ -93,6 +95,7 @@ class Descriptions
|
|||||||
# the cache. Save the updated cache to disk, unless explicitly told not to.
|
# the cache. Save the updated cache to disk, unless explicitly told not to.
|
||||||
def self.uncache_formulae(formula_names, options = { save: true })
|
def self.uncache_formulae(formula_names, options = { save: true })
|
||||||
return unless cache
|
return unless cache
|
||||||
|
|
||||||
formula_names.each { |name| @cache.delete(name) }
|
formula_names.each { |name| @cache.delete(name) }
|
||||||
save_cache if options[:save]
|
save_cache if options[:save]
|
||||||
end
|
end
|
||||||
|
|||||||
@ -126,6 +126,7 @@ module Homebrew
|
|||||||
fa = FormulaAuditor.new(f, options)
|
fa = FormulaAuditor.new(f, options)
|
||||||
fa.audit
|
fa.audit
|
||||||
next if fa.problems.empty? && fa.new_formula_problems.empty?
|
next if fa.problems.empty? && fa.new_formula_problems.empty?
|
||||||
|
|
||||||
fa.problems
|
fa.problems
|
||||||
formula_count += 1
|
formula_count += 1
|
||||||
problem_count += fa.problems.size
|
problem_count += fa.problems.size
|
||||||
@ -240,9 +241,11 @@ module Homebrew
|
|||||||
|
|
||||||
def audit_style
|
def audit_style
|
||||||
return unless @style_offenses
|
return unless @style_offenses
|
||||||
|
|
||||||
@style_offenses.each do |offense|
|
@style_offenses.each do |offense|
|
||||||
if offense.cop_name.start_with?("NewFormulaAudit")
|
if offense.cop_name.start_with?("NewFormulaAudit")
|
||||||
next if formula.versioned_formula?
|
next if formula.versioned_formula?
|
||||||
|
|
||||||
new_formula_problem offense.to_s(display_cop_name: @display_cop_names)
|
new_formula_problem offense.to_s(display_cop_name: @display_cop_names)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
@ -430,6 +433,7 @@ module Homebrew
|
|||||||
|
|
||||||
next unless @new_formula
|
next unless @new_formula
|
||||||
next unless @official_tap
|
next unless @official_tap
|
||||||
|
|
||||||
if dep.tags.include?(:recommended) || dep.tags.include?(:optional)
|
if dep.tags.include?(:recommended) || dep.tags.include?(:optional)
|
||||||
new_formula_problem options_message
|
new_formula_problem options_message
|
||||||
end
|
end
|
||||||
@ -437,6 +441,7 @@ module Homebrew
|
|||||||
|
|
||||||
next unless @new_formula
|
next unless @new_formula
|
||||||
next unless @official_tap
|
next unless @official_tap
|
||||||
|
|
||||||
if spec.requirements.map(&:recommended?).any? || spec.requirements.map(&:optional?).any?
|
if spec.requirements.map(&:recommended?).any? || spec.requirements.map(&:optional?).any?
|
||||||
new_formula_problem options_message
|
new_formula_problem options_message
|
||||||
end
|
end
|
||||||
@ -487,6 +492,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return unless reason.end_with?(".")
|
return unless reason.end_with?(".")
|
||||||
|
|
||||||
problem "keg_only reason should not end with a period."
|
problem "keg_only reason should not end with a period."
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -498,6 +504,7 @@ module Homebrew
|
|||||||
return unless @online
|
return unless @online
|
||||||
|
|
||||||
return unless DevelopmentTools.curl_handles_most_https_certificates?
|
return unless DevelopmentTools.curl_handles_most_https_certificates?
|
||||||
|
|
||||||
if http_content_problem = curl_check_http_content(homepage,
|
if http_content_problem = curl_check_http_content(homepage,
|
||||||
user_agents: [:browser, :default],
|
user_agents: [:browser, :default],
|
||||||
check_content: true,
|
check_content: true,
|
||||||
@ -518,6 +525,7 @@ module Homebrew
|
|||||||
leafnode
|
leafnode
|
||||||
]
|
]
|
||||||
return if bottle_disabled_whitelist.include?(formula.name)
|
return if bottle_disabled_whitelist.include?(formula.name)
|
||||||
|
|
||||||
problem "Formulae should not use `bottle :disabled`" if @official_tap
|
problem "Formulae should not use `bottle :disabled`" if @official_tap
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -549,6 +557,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return if Date.parse(metadata["created_at"]) <= (Date.today - 30)
|
return if Date.parse(metadata["created_at"]) <= (Date.today - 30)
|
||||||
|
|
||||||
new_formula_problem "GitHub repository too new (<30 days old)"
|
new_formula_problem "GitHub repository too new (<30 days old)"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -577,6 +586,7 @@ module Homebrew
|
|||||||
|
|
||||||
next if spec.patches.empty?
|
next if spec.patches.empty?
|
||||||
next unless @new_formula
|
next unless @new_formula
|
||||||
|
|
||||||
new_formula_problem(
|
new_formula_problem(
|
||||||
"Formulae should not require patches to build. " \
|
"Formulae should not require patches to build. " \
|
||||||
"Patches should be submitted and accepted upstream first.",
|
"Patches should be submitted and accepted upstream first.",
|
||||||
@ -585,6 +595,7 @@ module Homebrew
|
|||||||
|
|
||||||
%w[Stable Devel].each do |name|
|
%w[Stable Devel].each do |name|
|
||||||
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/
|
if version.to_s !~ /\d/
|
||||||
problem "#{name}: version (#{version}) is set to a string without a digit"
|
problem "#{name}: version (#{version}) is set to a string without a digit"
|
||||||
@ -627,6 +638,7 @@ module Homebrew
|
|||||||
|
|
||||||
throttled.each_slice(2).to_a.map do |a, b|
|
throttled.each_slice(2).to_a.map do |a, b|
|
||||||
next if formula.stable.nil?
|
next if formula.stable.nil?
|
||||||
|
|
||||||
version = formula.stable.version.to_s.split(".").last.to_i
|
version = formula.stable.version.to_s.split(".").last.to_i
|
||||||
if @strict && a == formula.name && version.modulo(b.to_i).nonzero?
|
if @strict && a == formula.name && version.modulo(b.to_i).nonzero?
|
||||||
problem "should only be updated every #{b} releases on multiples of #{b}"
|
problem "should only be updated every #{b} releases on multiples of #{b}"
|
||||||
@ -675,10 +687,12 @@ module Homebrew
|
|||||||
matched = Regexp.last_match(1)
|
matched = Regexp.last_match(1)
|
||||||
version_prefix = stable.version.to_s.sub(/\d+$/, "")
|
version_prefix = stable.version.to_s.sub(/\d+$/, "")
|
||||||
return if unstable_whitelist.include?([formula.name, version_prefix])
|
return if unstable_whitelist.include?([formula.name, version_prefix])
|
||||||
|
|
||||||
problem "Stable version URLs should not contain #{matched}"
|
problem "Stable version URLs should not contain #{matched}"
|
||||||
when %r{download\.gnome\.org/sources}, %r{ftp\.gnome\.org/pub/GNOME/sources}i
|
when %r{download\.gnome\.org/sources}, %r{ftp\.gnome\.org/pub/GNOME/sources}i
|
||||||
version_prefix = stable.version.to_s.split(".")[0..1].join(".")
|
version_prefix = stable.version.to_s.split(".")[0..1].join(".")
|
||||||
return if gnome_devel_whitelist.include?([formula.name, version_prefix])
|
return if gnome_devel_whitelist.include?([formula.name, version_prefix])
|
||||||
|
|
||||||
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)[1].to_i
|
minor_version = version.to_s.split(".", 3)[1].to_i
|
||||||
@ -701,6 +715,7 @@ module Homebrew
|
|||||||
next unless spec = formula.send(spec_sym)
|
next unless spec = formula.send(spec_sym)
|
||||||
next unless previous_version_and_checksum[spec_sym][:version] == spec.version
|
next unless previous_version_and_checksum[spec_sym][:version] == spec.version
|
||||||
next if previous_version_and_checksum[spec_sym][:checksum] == spec.checksum
|
next if previous_version_and_checksum[spec_sym][:checksum] == spec.checksum
|
||||||
|
|
||||||
problem(
|
problem(
|
||||||
"#{spec_sym}: sha256 changed without the version also changing; " \
|
"#{spec_sym}: sha256 changed without the version also changing; " \
|
||||||
"please create an issue upstream to rule out malicious " \
|
"please create an issue upstream to rule out malicious " \
|
||||||
@ -743,6 +758,7 @@ module Homebrew
|
|||||||
map_includes_version = spec_version_scheme_map.key?(spec_version)
|
map_includes_version = spec_version_scheme_map.key?(spec_version)
|
||||||
next if !current_version_scheme.zero? &&
|
next if !current_version_scheme.zero? &&
|
||||||
(above_max_version_scheme || map_includes_version)
|
(above_max_version_scheme || map_includes_version)
|
||||||
|
|
||||||
problem "#{spec} version should not decrease (from #{max_version} to #{spec_version})"
|
problem "#{spec} version should not decrease (from #{max_version} to #{spec_version})"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -777,6 +793,7 @@ module Homebrew
|
|||||||
bin_names += formula.aliases
|
bin_names += formula.aliases
|
||||||
[formula.bin, formula.sbin].each do |dir|
|
[formula.bin, formula.sbin].each do |dir|
|
||||||
next unless dir.exist?
|
next unless dir.exist?
|
||||||
|
|
||||||
bin_names += dir.children.map(&:basename).map(&:to_s)
|
bin_names += dir.children.map(&:basename).map(&:to_s)
|
||||||
end
|
end
|
||||||
bin_names.each do |name|
|
bin_names.each do |name|
|
||||||
@ -848,6 +865,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return unless line =~ %r{share(\s*[/+]\s*)(['"])#{Regexp.escape(formula.name)}(?:\2|/)}
|
return unless line =~ %r{share(\s*[/+]\s*)(['"])#{Regexp.escape(formula.name)}(?:\2|/)}
|
||||||
|
|
||||||
problem "Use pkgshare instead of (share#{Regexp.last_match(1)}\"#{formula.name}\")"
|
problem "Use pkgshare instead of (share#{Regexp.last_match(1)}\"#{formula.name}\")"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -976,6 +994,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return unless version.to_s =~ /_\d+$/
|
return unless version.to_s =~ /_\d+$/
|
||||||
|
|
||||||
problem "version #{version} should not end with an underline and a number"
|
problem "version #{version} should not end with an underline and a number"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1011,6 +1030,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return unless url_strategy == DownloadStrategyDetector.detect("", using)
|
return unless url_strategy == DownloadStrategyDetector.detect("", using)
|
||||||
|
|
||||||
problem "Redundant :using value in URL"
|
problem "Redundant :using value in URL"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1040,6 +1060,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return unless @online
|
return unless @online
|
||||||
|
|
||||||
urls.each do |url|
|
urls.each do |url|
|
||||||
next if !@strict && mirrors.include?(url)
|
next if !@strict && mirrors.include?(url)
|
||||||
|
|
||||||
@ -1048,6 +1069,7 @@ module Homebrew
|
|||||||
# A `brew mirror`'ed URL is usually not yet reachable at the time of
|
# A `brew mirror`'ed URL is usually not yet reachable at the time of
|
||||||
# pull request.
|
# pull request.
|
||||||
next if url =~ %r{^https://dl.bintray.com/homebrew/mirror/}
|
next if url =~ %r{^https://dl.bintray.com/homebrew/mirror/}
|
||||||
|
|
||||||
if http_content_problem = curl_check_http_content(url, require_http: curl_openssl_or_deps)
|
if http_content_problem = curl_check_http_content(url, require_http: curl_openssl_or_deps)
|
||||||
problem http_content_problem
|
problem http_content_problem
|
||||||
end
|
end
|
||||||
@ -1058,6 +1080,7 @@ module Homebrew
|
|||||||
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
|
unless Utils.svn_remote_exists? url
|
||||||
problem "The URL #{url} is not a valid svn URL"
|
problem "The URL #{url} is not a valid svn URL"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -86,6 +86,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return merge if args.merge?
|
return merge if args.merge?
|
||||||
|
|
||||||
ensure_relocation_formulae_installed!
|
ensure_relocation_formulae_installed!
|
||||||
ARGV.resolved_formulae.each do |f|
|
ARGV.resolved_formulae.each do |f|
|
||||||
bottle_formula f
|
bottle_formula f
|
||||||
@ -95,6 +96,7 @@ module Homebrew
|
|||||||
def ensure_relocation_formulae_installed!
|
def ensure_relocation_formulae_installed!
|
||||||
Keg.relocation_formulae.each do |f|
|
Keg.relocation_formulae.each do |f|
|
||||||
next if Formula[f].installed?
|
next if Formula[f].installed?
|
||||||
|
|
||||||
ohai "Installing #{f}..."
|
ohai "Installing #{f}..."
|
||||||
safe_system HOMEBREW_BREW_FILE, "install", f
|
safe_system HOMEBREW_BREW_FILE, "install", f
|
||||||
end
|
end
|
||||||
@ -140,6 +142,7 @@ module Homebrew
|
|||||||
str = io.readline.chomp
|
str = io.readline.chomp
|
||||||
next if ignores.any? { |i| i =~ str }
|
next if ignores.any? { |i| i =~ str }
|
||||||
next unless str.include? string
|
next unless str.include? string
|
||||||
|
|
||||||
offset, match = str.split(" ", 2)
|
offset, match = str.split(" ", 2)
|
||||||
next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool
|
next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool
|
||||||
|
|
||||||
@ -149,6 +152,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
next unless args.verbose? && !text_matches.empty?
|
next unless args.verbose? && !text_matches.empty?
|
||||||
|
|
||||||
print_filename.call(string, file)
|
print_filename.call(string, file)
|
||||||
text_matches.first(MAXIMUM_STRING_MATCHES).each do |match, offset|
|
text_matches.first(MAXIMUM_STRING_MATCHES).each do |match, offset|
|
||||||
puts " #{Tty.bold}-->#{Tty.reset} match '#{match}' at offset #{Tty.bold}0x#{offset}#{Tty.reset}"
|
puts " #{Tty.bold}-->#{Tty.reset} match '#{match}' at offset #{Tty.bold}0x#{offset}#{Tty.reset}"
|
||||||
@ -166,6 +170,7 @@ module Homebrew
|
|||||||
absolute_symlinks_start_with_string = []
|
absolute_symlinks_start_with_string = []
|
||||||
keg.find do |pn|
|
keg.find do |pn|
|
||||||
next unless pn.symlink? && (link = pn.readlink).absolute?
|
next unless pn.symlink? && (link = pn.readlink).absolute?
|
||||||
|
|
||||||
absolute_symlinks_start_with_string << pn if link.to_s.start_with?(string)
|
absolute_symlinks_start_with_string << pn if link.to_s.start_with?(string)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -376,6 +381,7 @@ module Homebrew
|
|||||||
puts output
|
puts output
|
||||||
|
|
||||||
return unless args.json?
|
return unless args.json?
|
||||||
|
|
||||||
tag = Utils::Bottles.tag.to_s
|
tag = Utils::Bottles.tag.to_s
|
||||||
tag += "_or_later" if args.or_later?
|
tag += "_or_later" if args.or_later?
|
||||||
json = {
|
json = {
|
||||||
@ -444,6 +450,7 @@ module Homebrew
|
|||||||
bottle_block_contents.lines.each do |line|
|
bottle_block_contents.lines.each do |line|
|
||||||
line = line.strip
|
line = line.strip
|
||||||
next if line.empty?
|
next if line.empty?
|
||||||
|
|
||||||
key, old_value_original, _, tag = line.split " ", 4
|
key, old_value_original, _, tag = line.split " ", 4
|
||||||
valid_key = %w[root_url prefix cellar rebuild sha1 sha256].include? key
|
valid_key = %w[root_url prefix cellar rebuild sha1 sha256].include? key
|
||||||
next unless valid_key
|
next unless valid_key
|
||||||
@ -465,6 +472,7 @@ module Homebrew
|
|||||||
value = value_original.to_s
|
value = value_original.to_s
|
||||||
next if key == "cellar" && old_value == "any" && value == "any_skip_relocation"
|
next if key == "cellar" && old_value == "any" && value == "any_skip_relocation"
|
||||||
next unless old_value.empty? || value != old_value
|
next unless old_value.empty? || value != old_value
|
||||||
|
|
||||||
old_value = old_value_original.inspect
|
old_value = old_value_original.inspect
|
||||||
value = value_original.inspect
|
value = value_original.inspect
|
||||||
mismatches << "#{key}: old: #{old_value}, new: #{value}"
|
mismatches << "#{key}: old: #{old_value}, new: #{value}"
|
||||||
|
|||||||
@ -378,11 +378,13 @@ module Homebrew
|
|||||||
unless old
|
unless old
|
||||||
raise "No old value for new value #{new}! Did you pass the wrong arguments?"
|
raise "No old value for new value #{new}! Did you pass the wrong arguments?"
|
||||||
end
|
end
|
||||||
|
|
||||||
contents.gsub!(old, new)
|
contents.gsub!(old, new)
|
||||||
end
|
end
|
||||||
unless contents.errors.empty?
|
unless contents.errors.empty?
|
||||||
raise Utils::InreplaceError, path => contents.errors
|
raise Utils::InreplaceError, path => contents.errors
|
||||||
end
|
end
|
||||||
|
|
||||||
path.atomic_write(contents) if args.write?
|
path.atomic_write(contents) if args.write?
|
||||||
contents
|
contents
|
||||||
else
|
else
|
||||||
@ -394,6 +396,7 @@ module Homebrew
|
|||||||
unless old
|
unless old
|
||||||
raise "No old value for new value #{new}! Did you pass the wrong arguments?"
|
raise "No old value for new value #{new}! Did you pass the wrong arguments?"
|
||||||
end
|
end
|
||||||
|
|
||||||
s.gsub!(old, new)
|
s.gsub!(old, new)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -425,6 +428,7 @@ module Homebrew
|
|||||||
pull_requests = fetch_pull_requests(formula)
|
pull_requests = fetch_pull_requests(formula)
|
||||||
return unless pull_requests
|
return unless pull_requests
|
||||||
return if pull_requests.empty?
|
return if pull_requests.empty?
|
||||||
|
|
||||||
duplicates_message = <<~EOS
|
duplicates_message = <<~EOS
|
||||||
These open pull requests may be duplicates:
|
These open pull requests may be duplicates:
|
||||||
#{pull_requests.map { |pr| "#{pr["title"]} #{pr["html_url"]}" }.join("\n")}
|
#{pull_requests.map { |pr| "#{pr["title"]} #{pr["html_url"]}" }.join("\n")}
|
||||||
|
|||||||
@ -58,6 +58,7 @@ module Homebrew
|
|||||||
fc.version = version
|
fc.version = version
|
||||||
fc.tap = Tap.fetch(tap || "homebrew/core")
|
fc.tap = Tap.fetch(tap || "homebrew/core")
|
||||||
raise TapUnavailableError, tap unless fc.tap.installed?
|
raise TapUnavailableError, tap unless fc.tap.installed?
|
||||||
|
|
||||||
fc.url = url
|
fc.url = url
|
||||||
|
|
||||||
fc.mode = if args.cmake?
|
fc.mode = if args.cmake?
|
||||||
|
|||||||
@ -32,6 +32,7 @@ module Homebrew
|
|||||||
paths ||= ARGV.named.map do |name|
|
paths ||= ARGV.named.map do |name|
|
||||||
path = Formulary.path(name)
|
path = Formulary.path(name)
|
||||||
raise FormulaUnavailableError, name if !path.file? && !args.force?
|
raise FormulaUnavailableError, name if !path.file? && !args.force?
|
||||||
|
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -127,10 +127,12 @@ module Homebrew
|
|||||||
rev = Git.last_revision_commit_of_file(repo, file, before_commit: "#{rev}~1")
|
rev = Git.last_revision_commit_of_file(repo, file, before_commit: "#{rev}~1")
|
||||||
break if rev.empty?
|
break if rev.empty?
|
||||||
break unless Git.last_revision_of_file(repo, file, before_commit: rev).empty?
|
break unless Git.last_revision_of_file(repo, file, before_commit: rev).empty?
|
||||||
|
|
||||||
ohai "Skipping revision #{rev} - file is empty at this revision" if ARGV.debug?
|
ohai "Skipping revision #{rev} - file is empty at this revision" if ARGV.debug?
|
||||||
end
|
end
|
||||||
test_formula = formula_at_revision(repo, name, file, rev)
|
test_formula = formula_at_revision(repo, name, file, rev)
|
||||||
break if test_formula.nil? || test_formula.version == version
|
break if test_formula.nil? || test_formula.version == version
|
||||||
|
|
||||||
ohai "Trying #{test_formula.version} from revision #{rev} against desired #{version}" if ARGV.debug?
|
ohai "Trying #{test_formula.version} from revision #{rev} against desired #{version}" if ARGV.debug?
|
||||||
end
|
end
|
||||||
odie "Could not find #{name}! The formula or version may not have existed." if test_formula.nil?
|
odie "Could not find #{name}! The formula or version may not have existed." if test_formula.nil?
|
||||||
@ -172,6 +174,7 @@ module Homebrew
|
|||||||
# @private
|
# @private
|
||||||
def formula_at_revision(repo, name, file, rev)
|
def formula_at_revision(repo, name, file, rev)
|
||||||
return if rev.empty?
|
return if rev.empty?
|
||||||
|
|
||||||
contents = Git.last_revision_of_file(repo, file, before_commit: rev)
|
contents = Git.last_revision_of_file(repo, file, before_commit: rev)
|
||||||
contents.gsub!("@url=", "url ")
|
contents.gsub!("@url=", "url ")
|
||||||
contents.gsub!("require 'brewkit'", "require 'formula'")
|
contents.gsub!("require 'brewkit'", "require 'formula'")
|
||||||
|
|||||||
@ -14,6 +14,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
raise FormulaUnspecifiedError if ARGV.named.empty?
|
||||||
|
|
||||||
ARGV.resolved_formulae.each { |f| puts f.path }
|
ARGV.resolved_formulae.each { |f| puts f.path }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -64,6 +64,7 @@ module GitHub
|
|||||||
def test_bot_user(user, test_bot)
|
def test_bot_user(user, test_bot)
|
||||||
return test_bot if test_bot
|
return test_bot if test_bot
|
||||||
return "BrewTestBot" if user.casecmp("homebrew").zero?
|
return "BrewTestBot" if user.casecmp("homebrew").zero?
|
||||||
|
|
||||||
"#{user.capitalize}TestBot"
|
"#{user.capitalize}TestBot"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -194,6 +195,7 @@ module Homebrew
|
|||||||
"--diff-filter=AM", orig_revision, "HEAD", "--", tap.formula_dir.to_s
|
"--diff-filter=AM", orig_revision, "HEAD", "--", tap.formula_dir.to_s
|
||||||
).each_line do |line|
|
).each_line do |line|
|
||||||
next unless line.end_with? ".rb\n"
|
next unless line.end_with? ".rb\n"
|
||||||
|
|
||||||
name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}"
|
name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}"
|
||||||
changed_formulae_names << name
|
changed_formulae_names << name
|
||||||
end
|
end
|
||||||
@ -227,6 +229,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
next unless f.bottle_defined?
|
next unless f.bottle_defined?
|
||||||
|
|
||||||
opoo "#{f.full_name} has a bottle: do you need to update it with --bottle?"
|
opoo "#{f.full_name} has a bottle: do you need to update it with --bottle?"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -320,8 +323,10 @@ module Homebrew
|
|||||||
changed_formulae_names.each do |name|
|
changed_formulae_names.each do |name|
|
||||||
f = Formula[name]
|
f = Formula[name]
|
||||||
next if f.bottle_unneeded? || f.bottle_disabled?
|
next if f.bottle_unneeded? || f.bottle_disabled?
|
||||||
|
|
||||||
bintray_org = args.bintray_org || tap.user.downcase
|
bintray_org = args.bintray_org || tap.user.downcase
|
||||||
next unless publish_bottle_file_on_bintray(f, bintray_org, bintray_creds)
|
next unless publish_bottle_file_on_bintray(f, bintray_org, bintray_creds)
|
||||||
|
|
||||||
published << f.full_name
|
published << f.full_name
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -481,6 +486,7 @@ module Homebrew
|
|||||||
if info.nil?
|
if info.nil?
|
||||||
raise "Failed publishing bottle: failed reading formula info for #{f.full_name}"
|
raise "Failed publishing bottle: failed reading formula info for #{f.full_name}"
|
||||||
end
|
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}"
|
||||||
return false
|
return false
|
||||||
@ -495,6 +501,7 @@ module Homebrew
|
|||||||
true
|
true
|
||||||
rescue => e
|
rescue => e
|
||||||
raise unless @args.warn_on_publish_failure?
|
raise unless @args.warn_on_publish_failure?
|
||||||
|
|
||||||
onoe e
|
onoe e
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
@ -521,14 +528,17 @@ module Homebrew
|
|||||||
|
|
||||||
def bottle_tags
|
def bottle_tags
|
||||||
return [] unless info["bottle"]["stable"]
|
return [] unless info["bottle"]["stable"]
|
||||||
|
|
||||||
info["bottle"]["stable"]["files"].keys
|
info["bottle"]["stable"]["files"].keys
|
||||||
end
|
end
|
||||||
|
|
||||||
def bottle_info(my_bottle_tag = Utils::Bottles.tag)
|
def bottle_info(my_bottle_tag = Utils::Bottles.tag)
|
||||||
tag_s = my_bottle_tag.to_s
|
tag_s = my_bottle_tag.to_s
|
||||||
return unless info["bottle"]["stable"]
|
return unless info["bottle"]["stable"]
|
||||||
|
|
||||||
btl_info = info["bottle"]["stable"]["files"][tag_s]
|
btl_info = info["bottle"]["stable"]["files"][tag_s]
|
||||||
return unless btl_info
|
return unless btl_info
|
||||||
|
|
||||||
BottleInfo.new(btl_info["url"], btl_info["sha256"])
|
BottleInfo.new(btl_info["url"], btl_info["sha256"])
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -623,6 +633,7 @@ module Homebrew
|
|||||||
if retry_count >= max_retries
|
if retry_count >= max_retries
|
||||||
raise "Failed to find published #{f} bottle at #{url}!"
|
raise "Failed to find published #{f} bottle at #{url}!"
|
||||||
end
|
end
|
||||||
|
|
||||||
print(wrote_dots ? "." : "Waiting on Bintray.")
|
print(wrote_dots ? "." : "Waiting on Bintray.")
|
||||||
wrote_dots = true
|
wrote_dots = true
|
||||||
sleep poll_retry_delay_seconds
|
sleep poll_retry_delay_seconds
|
||||||
@ -647,6 +658,7 @@ module Homebrew
|
|||||||
if retry_count >= max_curl_retries
|
if retry_count >= max_curl_retries
|
||||||
raise "Failed to download #{f} bottle from #{url}!"
|
raise "Failed to download #{f} bottle from #{url}!"
|
||||||
end
|
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
|
||||||
curl_retry_delay_seconds *= 2
|
curl_retry_delay_seconds *= 2
|
||||||
@ -663,6 +675,7 @@ module Homebrew
|
|||||||
headers, = curl_output("--connect-timeout", "15", "--location", "--head", url)
|
headers, = curl_output("--connect-timeout", "15", "--location", "--head", url)
|
||||||
status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first
|
status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first
|
||||||
return if status_code.start_with?("2")
|
return if status_code.start_with?("2")
|
||||||
|
|
||||||
opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})."
|
opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})."
|
||||||
opoo "Do you need to upload it with `brew mirror #{name}`?"
|
opoo "Do you need to upload it with `brew mirror #{name}`?"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -25,6 +25,7 @@ module Homebrew
|
|||||||
|
|
||||||
[previous_tag, end_ref].each do |ref|
|
[previous_tag, end_ref].each do |ref|
|
||||||
next if quiet_system "git", "-C", HOMEBREW_REPOSITORY, "rev-parse", "--verify", "--quiet", ref
|
next if quiet_system "git", "-C", HOMEBREW_REPOSITORY, "rev-parse", "--verify", "--quiet", ref
|
||||||
|
|
||||||
odie "Ref #{ref} does not exist!"
|
odie "Ref #{ref} does not exist!"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ module Homebrew
|
|||||||
path = tap.path/filename
|
path = tap.path/filename
|
||||||
tap.path.mkpath
|
tap.path.mkpath
|
||||||
raise "#{path} already exists" if path.exist?
|
raise "#{path} already exists" if path.exist?
|
||||||
|
|
||||||
path.write content
|
path.write content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,7 @@ module Homebrew
|
|||||||
missing_test_deps = f.recursive_dependencies do |_, dependency|
|
missing_test_deps = f.recursive_dependencies do |_, dependency|
|
||||||
Dependency.prune if dependency.installed?
|
Dependency.prune if dependency.installed?
|
||||||
next if dependency.test?
|
next if dependency.test?
|
||||||
|
|
||||||
Dependency.prune if dependency.optional?
|
Dependency.prune if dependency.optional?
|
||||||
Dependency.prune if dependency.build?
|
Dependency.prune if dependency.build?
|
||||||
end.map(&:to_s)
|
end.map(&:to_s)
|
||||||
|
|||||||
@ -130,6 +130,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
return if $CHILD_STATUS.success?
|
return if $CHILD_STATUS.success?
|
||||||
|
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,6 +12,7 @@ module Homebrew
|
|||||||
ff.each do |f|
|
ff.each do |f|
|
||||||
missing_dependencies = f.missing_dependencies(hide: hide)
|
missing_dependencies = f.missing_dependencies(hide: hide)
|
||||||
next if missing_dependencies.empty?
|
next if missing_dependencies.empty?
|
||||||
|
|
||||||
yield f.full_name, missing_dependencies if block_given?
|
yield f.full_name, missing_dependencies if block_given?
|
||||||
missing[f.full_name] = missing_dependencies
|
missing[f.full_name] = missing_dependencies
|
||||||
end
|
end
|
||||||
@ -32,6 +33,7 @@ module Homebrew
|
|||||||
vol_index = @volumes.index(vols[0])
|
vol_index = @volumes.index(vols[0])
|
||||||
# volume not found in volume list
|
# volume not found in volume list
|
||||||
return -1 if vol_index.nil?
|
return -1 if vol_index.nil?
|
||||||
|
|
||||||
vol_index
|
vol_index
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -276,6 +278,7 @@ module Homebrew
|
|||||||
|
|
||||||
Keg::PRUNEABLE_DIRECTORIES.each do |d|
|
Keg::PRUNEABLE_DIRECTORIES.each do |d|
|
||||||
next unless d.directory?
|
next unless d.directory?
|
||||||
|
|
||||||
d.find do |path|
|
d.find do |path|
|
||||||
if path.symlink? && !path.resolved_path_exists?
|
if path.symlink? && !path.resolved_path_exists?
|
||||||
broken_symlinks << path
|
broken_symlinks << path
|
||||||
@ -408,6 +411,7 @@ module Homebrew
|
|||||||
|
|
||||||
def check_for_config_scripts
|
def check_for_config_scripts
|
||||||
return unless HOMEBREW_CELLAR.exist?
|
return unless HOMEBREW_CELLAR.exist?
|
||||||
|
|
||||||
real_cellar = HOMEBREW_CELLAR.realpath
|
real_cellar = HOMEBREW_CELLAR.realpath
|
||||||
|
|
||||||
scripts = []
|
scripts = []
|
||||||
@ -604,6 +608,7 @@ module Homebrew
|
|||||||
f.installed_prefixes.each do |prefix|
|
f.installed_prefixes.each do |prefix|
|
||||||
prefix.find do |src|
|
prefix.find do |src|
|
||||||
next if src == prefix
|
next if src == prefix
|
||||||
|
|
||||||
dst = HOMEBREW_PREFIX + src.relative_path_from(prefix)
|
dst = HOMEBREW_PREFIX + src.relative_path_from(prefix)
|
||||||
return true if dst.symlink? && src == dst.resolved_path
|
return true if dst.symlink? && src == dst.resolved_path
|
||||||
end
|
end
|
||||||
@ -642,6 +647,7 @@ module Homebrew
|
|||||||
|
|
||||||
def check_missing_deps
|
def check_missing_deps
|
||||||
return unless HOMEBREW_CELLAR.exist?
|
return unless HOMEBREW_CELLAR.exist?
|
||||||
|
|
||||||
missing = Set.new
|
missing = Set.new
|
||||||
Homebrew::Diagnostic.missing_deps(Formula.installed).each_value do |deps|
|
Homebrew::Diagnostic.missing_deps(Formula.installed).each_value do |deps|
|
||||||
missing.merge(deps)
|
missing.merge(deps)
|
||||||
@ -659,6 +665,7 @@ module Homebrew
|
|||||||
|
|
||||||
def check_git_status
|
def check_git_status
|
||||||
return unless Utils.git_available?
|
return unless Utils.git_available?
|
||||||
|
|
||||||
HOMEBREW_REPOSITORY.cd do
|
HOMEBREW_REPOSITORY.cd do
|
||||||
return if `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.chomp.empty?
|
return if `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.chomp.empty?
|
||||||
end
|
end
|
||||||
@ -674,6 +681,7 @@ module Homebrew
|
|||||||
|
|
||||||
def check_for_bad_python_symlink
|
def check_for_bad_python_symlink
|
||||||
return unless which "python"
|
return unless which "python"
|
||||||
|
|
||||||
`python -V 2>&1` =~ /Python (\d+)\./
|
`python -V 2>&1` =~ /Python (\d+)\./
|
||||||
# This won't be the right warning if we matched nothing at all
|
# This won't be the right warning if we matched nothing at all
|
||||||
return if Regexp.last_match(1).nil?
|
return if Regexp.last_match(1).nil?
|
||||||
@ -764,14 +772,17 @@ module Homebrew
|
|||||||
unused_formula_dirs = tap.potential_formula_dirs - [tap.formula_dir]
|
unused_formula_dirs = tap.potential_formula_dirs - [tap.formula_dir]
|
||||||
unused_formula_dirs.each do |dir|
|
unused_formula_dirs.each do |dir|
|
||||||
next unless dir.exist?
|
next unless dir.exist?
|
||||||
|
|
||||||
dir.children.each do |path|
|
dir.children.each do |path|
|
||||||
next unless path.extname == ".rb"
|
next unless path.extname == ".rb"
|
||||||
|
|
||||||
bad_tap_files[tap] ||= []
|
bad_tap_files[tap] ||= []
|
||||||
bad_tap_files[tap] << path
|
bad_tap_files[tap] << path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return if bad_tap_files.empty?
|
return if bad_tap_files.empty?
|
||||||
|
|
||||||
bad_tap_files.keys.map do |tap|
|
bad_tap_files.keys.map do |tap|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Found Ruby file outside #{tap} tap formula directory
|
Found Ruby file outside #{tap} tap formula directory
|
||||||
|
|||||||
@ -139,6 +139,7 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
|
|||||||
return unless @ref_type == :tag
|
return unless @ref_type == :tag
|
||||||
return unless @revision && current_revision
|
return unless @revision && current_revision
|
||||||
return if current_revision == @revision
|
return if current_revision == @revision
|
||||||
|
|
||||||
raise <<~EOS
|
raise <<~EOS
|
||||||
#{@ref} tag should be #{@revision}
|
#{@ref} tag should be #{@revision}
|
||||||
but is actually #{current_revision}
|
but is actually #{current_revision}
|
||||||
@ -194,6 +195,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
|||||||
|
|
||||||
def symlink_location
|
def symlink_location
|
||||||
return @symlink_location if defined?(@symlink_location)
|
return @symlink_location if defined?(@symlink_location)
|
||||||
|
|
||||||
ext = Pathname(parse_basename(url)).extname
|
ext = Pathname(parse_basename(url)).extname
|
||||||
@symlink_location = @cache/"#{name}--#{version}#{ext}"
|
@symlink_location = @cache/"#{name}--#{version}#{ext}"
|
||||||
end
|
end
|
||||||
@ -230,6 +232,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
|||||||
|
|
||||||
def resolved_url_and_basename
|
def resolved_url_and_basename
|
||||||
return @resolved_url_and_basename if defined?(@resolved_url_and_basename)
|
return @resolved_url_and_basename if defined?(@resolved_url_and_basename)
|
||||||
|
|
||||||
@resolved_url_and_basename = [url, parse_basename(url)]
|
@resolved_url_and_basename = [url, parse_basename(url)]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -301,6 +304,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
FileUtils.ln_s cached_location.relative_path_from(symlink_location.dirname), symlink_location, force: true
|
FileUtils.ln_s cached_location.relative_path_from(symlink_location.dirname), symlink_location, force: true
|
||||||
rescue CurlDownloadStrategyError
|
rescue CurlDownloadStrategyError
|
||||||
raise if urls.empty?
|
raise if urls.empty?
|
||||||
|
|
||||||
puts "Trying a mirror..."
|
puts "Trying a mirror..."
|
||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
@ -315,6 +319,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
|
|
||||||
def resolved_url_and_basename
|
def resolved_url_and_basename
|
||||||
return @resolved_url_and_basename if defined?(@resolved_url_and_basename)
|
return @resolved_url_and_basename if defined?(@resolved_url_and_basename)
|
||||||
|
|
||||||
@resolved_url_and_basename = resolve_url_and_basename(url)
|
@resolved_url_and_basename = resolve_url_and_basename(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -378,6 +383,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
|
|
||||||
def _curl_opts
|
def _curl_opts
|
||||||
return { user_agent: meta.fetch(:user_agent) } if meta.key?(:user_agent)
|
return { user_agent: meta.fetch(:user_agent) } if meta.key?(:user_agent)
|
||||||
|
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -417,6 +423,7 @@ class CurlApacheMirrorDownloadStrategy < CurlDownloadStrategy
|
|||||||
|
|
||||||
def apache_mirrors
|
def apache_mirrors
|
||||||
return @apache_mirrors if defined?(@apache_mirrors)
|
return @apache_mirrors if defined?(@apache_mirrors)
|
||||||
|
|
||||||
json, = curl_output("--silent", "--location", "#{url}&asjson=1")
|
json, = curl_output("--silent", "--location", "#{url}&asjson=1")
|
||||||
@apache_mirrors = JSON.parse(json)
|
@apache_mirrors = JSON.parse(json)
|
||||||
rescue JSON::ParserError
|
rescue JSON::ParserError
|
||||||
@ -472,6 +479,7 @@ class S3DownloadStrategy < CurlDownloadStrategy
|
|||||||
url !~ %r{^s3://([^.].*?)/(.+)$}
|
url !~ %r{^s3://([^.].*?)/(.+)$}
|
||||||
raise "Bad S3 URL: " + url
|
raise "Bad S3 URL: " + url
|
||||||
end
|
end
|
||||||
|
|
||||||
bucket = Regexp.last_match(1)
|
bucket = Regexp.last_match(1)
|
||||||
key = Regexp.last_match(2)
|
key = Regexp.last_match(2)
|
||||||
|
|
||||||
@ -531,6 +539,7 @@ class GitHubPrivateRepositoryDownloadStrategy < CurlDownloadStrategy
|
|||||||
unless @github_token
|
unless @github_token
|
||||||
raise CurlDownloadStrategyError, "Environmental variable HOMEBREW_GITHUB_API_TOKEN is required."
|
raise CurlDownloadStrategyError, "Environmental variable HOMEBREW_GITHUB_API_TOKEN is required."
|
||||||
end
|
end
|
||||||
|
|
||||||
validate_github_repository_access!
|
validate_github_repository_access!
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -933,6 +942,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
|
|||||||
super
|
super
|
||||||
|
|
||||||
return unless %r{^https?://github\.com/(?<user>[^/]+)/(?<repo>[^/]+)\.git$} =~ @url
|
return unless %r{^https?://github\.com/(?<user>[^/]+)/(?<repo>[^/]+)\.git$} =~ @url
|
||||||
|
|
||||||
@user = user
|
@user = user
|
||||||
@repo = repo
|
@repo = repo
|
||||||
end
|
end
|
||||||
@ -972,6 +982,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
|
|||||||
else
|
else
|
||||||
return true unless commit
|
return true unless commit
|
||||||
return true unless @last_commit.start_with?(commit)
|
return true unless @last_commit.start_with?(commit)
|
||||||
|
|
||||||
if multiple_short_commits_exist?(commit)
|
if multiple_short_commits_exist?(commit)
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
@ -1003,6 +1014,7 @@ class CVSDownloadStrategy < VCSDownloadStrategy
|
|||||||
cached_location.find do |f|
|
cached_location.find do |f|
|
||||||
Find.prune if f.directory? && f.basename.to_s == "CVS"
|
Find.prune if f.directory? && f.basename.to_s == "CVS"
|
||||||
next unless f.file?
|
next unless f.file?
|
||||||
|
|
||||||
mtime = f.mtime
|
mtime = f.mtime
|
||||||
max_mtime = mtime if mtime > max_mtime
|
max_mtime = mtime if mtime > max_mtime
|
||||||
end
|
end
|
||||||
@ -1110,6 +1122,7 @@ class BazaarDownloadStrategy < VCSDownloadStrategy
|
|||||||
out, = system_command("bzr", args: ["log", "-l", "1", "--timezone=utc", cached_location])
|
out, = system_command("bzr", args: ["log", "-l", "1", "--timezone=utc", cached_location])
|
||||||
timestamp = out.chomp
|
timestamp = out.chomp
|
||||||
raise "Could not get any timestamps from bzr!" if timestamp.blank?
|
raise "Could not get any timestamps from bzr!" if timestamp.blank?
|
||||||
|
|
||||||
Time.parse(timestamp)
|
Time.parse(timestamp)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -429,6 +429,7 @@ class BuildError < RuntimeError
|
|||||||
checks.build_error_checks.each do |check|
|
checks.build_error_checks.each do |check|
|
||||||
out = checks.send(check)
|
out = checks.send(check)
|
||||||
next if out.nil?
|
next if out.nil?
|
||||||
|
|
||||||
puts
|
puts
|
||||||
ofail out
|
ofail out
|
||||||
end
|
end
|
||||||
|
|||||||
@ -125,6 +125,7 @@ module HomebrewArgvExtension
|
|||||||
# @see value
|
# @see value
|
||||||
def values(name)
|
def values(name)
|
||||||
return unless val = value(name)
|
return unless val = value(name)
|
||||||
|
|
||||||
val.split(",")
|
val.split(",")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -226,6 +227,7 @@ module HomebrewArgvExtension
|
|||||||
def build_formula_from_source?(f)
|
def build_formula_from_source?(f)
|
||||||
return true if build_all_from_source?
|
return true if build_all_from_source?
|
||||||
return false unless build_from_source? || build_bottle?
|
return false unless build_from_source? || build_bottle?
|
||||||
|
|
||||||
formulae.any? { |argv_f| argv_f.full_name == f.full_name }
|
formulae.any? { |argv_f| argv_f.full_name == f.full_name }
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -244,6 +246,7 @@ module HomebrewArgvExtension
|
|||||||
# eg. `foo -ns -i --bar` has three switches, n, s and i
|
# eg. `foo -ns -i --bar` has three switches, n, s and i
|
||||||
def switch?(char)
|
def switch?(char)
|
||||||
return false if char.length > 1
|
return false if char.length > 1
|
||||||
|
|
||||||
options_only.any? { |arg| arg.scan("-").size == 1 && arg.include?(char) }
|
options_only.any? { |arg| arg.scan("-").size == 1 && arg.include?(char) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ module EnvActivation
|
|||||||
def clear_sensitive_environment!
|
def clear_sensitive_environment!
|
||||||
each_key do |key|
|
each_key do |key|
|
||||||
next unless /(cookie|key|token|password)/i =~ key
|
next unless /(cookie|key|token|password)/i =~ key
|
||||||
|
|
||||||
delete key
|
delete key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -95,6 +95,7 @@ module SharedEnvExtension
|
|||||||
# (e.g. <pre>ENV.prepend_path "PATH", which("emacs").dirname</pre>)
|
# (e.g. <pre>ENV.prepend_path "PATH", which("emacs").dirname</pre>)
|
||||||
def prepend_path(key, path)
|
def prepend_path(key, path)
|
||||||
return if %w[/usr/bin /bin /usr/sbin /sbin].include? path.to_s
|
return if %w[/usr/bin /bin /usr/sbin /sbin].include? path.to_s
|
||||||
|
|
||||||
self[key] = PATH.new(self[key]).prepend(path)
|
self[key] = PATH.new(self[key]).prepend(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -106,8 +107,10 @@ module SharedEnvExtension
|
|||||||
|
|
||||||
def remove(keys, value)
|
def remove(keys, value)
|
||||||
return if value.nil?
|
return if value.nil?
|
||||||
|
|
||||||
Array(keys).each do |key|
|
Array(keys).each do |key|
|
||||||
next unless self[key]
|
next unless self[key]
|
||||||
|
|
||||||
self[key] = self[key].sub(value, "")
|
self[key] = self[key].sub(value, "")
|
||||||
delete(key) if self[key].empty?
|
delete(key) if self[key].empty?
|
||||||
end
|
end
|
||||||
@ -223,6 +226,7 @@ module SharedEnvExtension
|
|||||||
# building with an alternative Fortran compiler without optimization flags,
|
# building with an alternative Fortran compiler without optimization flags,
|
||||||
# despite it often being the Homebrew-provided one set up in the first call.
|
# despite it often being the Homebrew-provided one set up in the first call.
|
||||||
return if @fortran_setup_done
|
return if @fortran_setup_done
|
||||||
|
|
||||||
@fortran_setup_done = true
|
@fortran_setup_done = true
|
||||||
|
|
||||||
flags = []
|
flags = []
|
||||||
@ -294,6 +298,7 @@ module SharedEnvExtension
|
|||||||
end
|
end
|
||||||
|
|
||||||
return if gcc_formula.opt_prefix.exist?
|
return if gcc_formula.opt_prefix.exist?
|
||||||
|
|
||||||
raise <<~EOS
|
raise <<~EOS
|
||||||
The requested Homebrew GCC was not installed. You must:
|
The requested Homebrew GCC was not installed. You must:
|
||||||
brew install #{gcc_formula.full_name}
|
brew install #{gcc_formula.full_name}
|
||||||
@ -313,6 +318,7 @@ module SharedEnvExtension
|
|||||||
# @private
|
# @private
|
||||||
def compiler_with_cxx11_support?(cc)
|
def compiler_with_cxx11_support?(cc)
|
||||||
return if compiler_any_clang?(cc)
|
return if compiler_any_clang?(cc)
|
||||||
|
|
||||||
version = cc[/^gcc-(\d+(?:\.\d+)?)$/, 1]
|
version = cc[/^gcc-(\d+(?:\.\d+)?)$/, 1]
|
||||||
version && Version.create(version) >= Version.create("4.8")
|
version && Version.create(version) >= Version.create("4.8")
|
||||||
end
|
end
|
||||||
@ -344,6 +350,7 @@ module SharedEnvExtension
|
|||||||
|
|
||||||
def check_for_compiler_universal_support
|
def check_for_compiler_universal_support
|
||||||
return unless homebrew_cc =~ GNU_GCC_REGEXP
|
return unless homebrew_cc =~ GNU_GCC_REGEXP
|
||||||
|
|
||||||
raise "Non-Apple GCC can't build universal binaries"
|
raise "Non-Apple GCC can't build universal binaries"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -46,6 +46,7 @@ module Stdenv
|
|||||||
send(compiler)
|
send(compiler)
|
||||||
|
|
||||||
return unless cc =~ GNU_GCC_REGEXP
|
return unless cc =~ GNU_GCC_REGEXP
|
||||||
|
|
||||||
gcc_formula = gcc_version_formula($&)
|
gcc_formula = gcc_version_formula($&)
|
||||||
append_path "PATH", gcc_formula.opt_bin.to_s
|
append_path "PATH", gcc_formula.opt_bin.to_s
|
||||||
end
|
end
|
||||||
@ -159,6 +160,7 @@ module Stdenv
|
|||||||
|
|
||||||
return if compiler_any_clang?
|
return if compiler_any_clang?
|
||||||
return unless Hardware.is_32_bit?
|
return unless Hardware.is_32_bit?
|
||||||
|
|
||||||
# Can't mix "-march" for a 32-bit CPU with "-arch x86_64"
|
# Can't mix "-march" for a 32-bit CPU with "-arch x86_64"
|
||||||
replace_in_cflags(/-march=\S*/, "-Xarch_#{Hardware::CPU.arch_32_bit} \\0")
|
replace_in_cflags(/-march=\S*/, "-Xarch_#{Hardware::CPU.arch_32_bit} \\0")
|
||||||
end
|
end
|
||||||
|
|||||||
@ -278,6 +278,7 @@ module Superenv
|
|||||||
# GCC doesn't accept "-march" for a 32-bit CPU with "-arch x86_64"
|
# GCC doesn't accept "-march" for a 32-bit CPU with "-arch x86_64"
|
||||||
return if compiler_any_clang?
|
return if compiler_any_clang?
|
||||||
return unless Hardware::CPU.is_32_bit?
|
return unless Hardware::CPU.is_32_bit?
|
||||||
|
|
||||||
self["HOMEBREW_OPTFLAGS"] = self["HOMEBREW_OPTFLAGS"].sub(
|
self["HOMEBREW_OPTFLAGS"] = self["HOMEBREW_OPTFLAGS"].sub(
|
||||||
/-march=\S*/,
|
/-march=\S*/,
|
||||||
"-Xarch_#{Hardware::CPU.arch_32_bit} \\0",
|
"-Xarch_#{Hardware::CPU.arch_32_bit} \\0",
|
||||||
|
|||||||
@ -8,36 +8,43 @@ module GitRepositoryExtension
|
|||||||
|
|
||||||
def git_origin
|
def git_origin
|
||||||
return unless git? && Utils.git_available?
|
return unless git? && Utils.git_available?
|
||||||
|
|
||||||
Utils.popen_read("git", "config", "--get", "remote.origin.url", chdir: self).chuzzle
|
Utils.popen_read("git", "config", "--get", "remote.origin.url", chdir: self).chuzzle
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_origin=(origin)
|
def git_origin=(origin)
|
||||||
return unless git? && Utils.git_available?
|
return unless git? && Utils.git_available?
|
||||||
|
|
||||||
safe_system "git", "remote", "set-url", "origin", origin, chdir: self
|
safe_system "git", "remote", "set-url", "origin", origin, chdir: self
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_head
|
def git_head
|
||||||
return unless git? && Utils.git_available?
|
return unless git? && Utils.git_available?
|
||||||
|
|
||||||
Utils.popen_read("git", "rev-parse", "--verify", "-q", "HEAD", chdir: self).chuzzle
|
Utils.popen_read("git", "rev-parse", "--verify", "-q", "HEAD", chdir: self).chuzzle
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_short_head
|
def git_short_head
|
||||||
return unless git? && Utils.git_available?
|
return unless git? && Utils.git_available?
|
||||||
|
|
||||||
Utils.popen_read("git", "rev-parse", "--short=4", "--verify", "-q", "HEAD", chdir: self).chuzzle
|
Utils.popen_read("git", "rev-parse", "--short=4", "--verify", "-q", "HEAD", chdir: self).chuzzle
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_last_commit
|
def git_last_commit
|
||||||
return unless git? && Utils.git_available?
|
return unless git? && Utils.git_available?
|
||||||
|
|
||||||
Utils.popen_read("git", "show", "-s", "--format=%cr", "HEAD", chdir: self).chuzzle
|
Utils.popen_read("git", "show", "-s", "--format=%cr", "HEAD", chdir: self).chuzzle
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_branch
|
def git_branch
|
||||||
return unless git? && Utils.git_available?
|
return unless git? && Utils.git_available?
|
||||||
|
|
||||||
Utils.popen_read("git", "rev-parse", "--abbrev-ref", "HEAD", chdir: self).chuzzle
|
Utils.popen_read("git", "rev-parse", "--abbrev-ref", "HEAD", chdir: self).chuzzle
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_last_commit_date
|
def git_last_commit_date
|
||||||
return unless git? && Utils.git_available?
|
return unless git? && Utils.git_available?
|
||||||
|
|
||||||
Utils.popen_read("git", "show", "-s", "--format=%cd", "--date=short", "HEAD", chdir: self).chuzzle
|
Utils.popen_read("git", "show", "-s", "--format=%cd", "--date=short", "HEAD", chdir: self).chuzzle
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,6 +3,7 @@ module HashValidator
|
|||||||
def assert_valid_keys!(*valid_keys)
|
def assert_valid_keys!(*valid_keys)
|
||||||
unknown_keys = keys - valid_keys
|
unknown_keys = keys - valid_keys
|
||||||
return if unknown_keys.empty?
|
return if unknown_keys.empty?
|
||||||
|
|
||||||
raise ArgumentError, "invalid keys: #{unknown_keys.map(&:inspect).join(", ")}"
|
raise ArgumentError, "invalid keys: #{unknown_keys.map(&:inspect).join(", ")}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -5,6 +5,7 @@ class IO
|
|||||||
|
|
||||||
loop do
|
loop do
|
||||||
break if buffer == sep
|
break if buffer == sep
|
||||||
|
|
||||||
read_nonblock(1, buffer)
|
read_nonblock(1, buffer)
|
||||||
line.concat(buffer)
|
line.concat(buffer)
|
||||||
end
|
end
|
||||||
@ -12,6 +13,7 @@ class IO
|
|||||||
line
|
line
|
||||||
rescue IO::WaitReadable, EOFError => e
|
rescue IO::WaitReadable, EOFError => e
|
||||||
raise e if line.empty?
|
raise e if line.empty?
|
||||||
|
|
||||||
line
|
line
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -8,6 +8,7 @@ module Homebrew
|
|||||||
def check_tmpdir_sticky_bit
|
def check_tmpdir_sticky_bit
|
||||||
message = generic_check_tmpdir_sticky_bit
|
message = generic_check_tmpdir_sticky_bit
|
||||||
return if message.nil?
|
return if message.nil?
|
||||||
|
|
||||||
message + <<~EOS
|
message + <<~EOS
|
||||||
If you don't have administrative privileges on this machine,
|
If you don't have administrative privileges on this machine,
|
||||||
create a directory and set the HOMEBREW_TEMP environment variable,
|
create a directory and set the HOMEBREW_TEMP environment variable,
|
||||||
@ -23,6 +24,7 @@ module Homebrew
|
|||||||
f.chmod 0700
|
f.chmod 0700
|
||||||
f.close
|
f.close
|
||||||
return if system f.path
|
return if system f.path
|
||||||
|
|
||||||
<<~EOS.undent
|
<<~EOS.undent
|
||||||
The directory #{HOMEBREW_TEMP} does not permit executing
|
The directory #{HOMEBREW_TEMP} does not permit executing
|
||||||
programs. It is likely mounted as "noexec". Please set HOMEBREW_TEMP
|
programs. It is likely mounted as "noexec". Please set HOMEBREW_TEMP
|
||||||
@ -37,6 +39,7 @@ module Homebrew
|
|||||||
def check_xdg_data_dirs
|
def check_xdg_data_dirs
|
||||||
return if ENV["XDG_DATA_DIRS"].blank?
|
return if ENV["XDG_DATA_DIRS"].blank?
|
||||||
return if ENV["XDG_DATA_DIRS"].split("/").include?(HOMEBREW_PREFIX/"share")
|
return if ENV["XDG_DATA_DIRS"].split("/").include?(HOMEBREW_PREFIX/"share")
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Homebrew's share was not found in your XDG_DATA_DIRS but you have
|
Homebrew's share was not found in your XDG_DATA_DIRS but you have
|
||||||
this variable set to include other locations.
|
this variable set to include other locations.
|
||||||
|
|||||||
@ -36,6 +36,7 @@ module Superenv
|
|||||||
def determine_dynamic_linker_path
|
def determine_dynamic_linker_path
|
||||||
path = "#{HOMEBREW_PREFIX}/lib/ld.so"
|
path = "#{HOMEBREW_PREFIX}/lib/ld.so"
|
||||||
return unless File.readable? path
|
return unless File.readable? path
|
||||||
|
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -9,6 +9,7 @@ module Hardware
|
|||||||
return :arm if arm?
|
return :arm if arm?
|
||||||
return :ppc if ppc?
|
return :ppc if ppc?
|
||||||
return :dunno unless intel?
|
return :dunno unless intel?
|
||||||
|
|
||||||
# See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers
|
# See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers
|
||||||
cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i
|
cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i
|
||||||
cpu_model = cpuinfo[/^model\s*: ([0-9]+)/, 1].to_i
|
cpu_model = cpuinfo[/^model\s*: ([0-9]+)/, 1].to_i
|
||||||
|
|||||||
@ -45,6 +45,7 @@ class Keg
|
|||||||
end
|
end
|
||||||
|
|
||||||
return if old_rpath == new_rpath && old_interpreter == new_interpreter
|
return if old_rpath == new_rpath && old_interpreter == new_interpreter
|
||||||
|
|
||||||
safe_system(*cmd, file)
|
safe_system(*cmd, file)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ class Keg
|
|||||||
elf_files.each do |file|
|
elf_files.each do |file|
|
||||||
next unless file.dynamic_elf?
|
next unless file.dynamic_elf?
|
||||||
next if file.binary_executable? && skip_executables
|
next if file.binary_executable? && skip_executables
|
||||||
|
|
||||||
dylibs = file.dynamically_linked_libraries
|
dylibs = file.dynamically_linked_libraries
|
||||||
results << :libcxx if dylibs.any? { |s| s.include? "libc++.so" }
|
results << :libcxx if dylibs.any? { |s| s.include? "libc++.so" }
|
||||||
results << :libstdcxx if dylibs.any? { |s| s.include? "libstdc++.so" }
|
results << :libstdcxx if dylibs.any? { |s| s.include? "libstdc++.so" }
|
||||||
@ -72,6 +74,7 @@ class Keg
|
|||||||
# same dev ID and inode). This prevents relocations from being performed
|
# same dev ID and inode). This prevents relocations from being performed
|
||||||
# on a binary more than once.
|
# on a binary more than once.
|
||||||
next unless hardlinks.add? [pn.stat.dev, pn.stat.ino]
|
next unless hardlinks.add? [pn.stat.dev, pn.stat.ino]
|
||||||
|
|
||||||
elf_files << pn
|
elf_files << pn
|
||||||
end
|
end
|
||||||
elf_files
|
elf_files
|
||||||
|
|||||||
@ -5,6 +5,7 @@ class OsxfuseRequirement < Requirement
|
|||||||
|
|
||||||
satisfy(build_env: false) do
|
satisfy(build_env: false) do
|
||||||
next true if libfuse_formula_exists? && Formula["libfuse"].installed?
|
next true if libfuse_formula_exists? && Formula["libfuse"].installed?
|
||||||
|
|
||||||
includedirs = %w[
|
includedirs = %w[
|
||||||
/usr/include
|
/usr/include
|
||||||
/usr/local/include
|
/usr/local/include
|
||||||
@ -12,6 +13,7 @@ class OsxfuseRequirement < Requirement
|
|||||||
next true if (includedirs.map do |dir|
|
next true if (includedirs.map do |dir|
|
||||||
File.exist? "#{dir}/fuse.h"
|
File.exist? "#{dir}/fuse.h"
|
||||||
end).any?
|
end).any?
|
||||||
|
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -18,17 +18,20 @@ class SystemConfig
|
|||||||
def host_glibc_version
|
def host_glibc_version
|
||||||
version = OS::Linux::Glibc.system_version
|
version = OS::Linux::Glibc.system_version
|
||||||
return "N/A" if version.null?
|
return "N/A" if version.null?
|
||||||
|
|
||||||
version
|
version
|
||||||
end
|
end
|
||||||
|
|
||||||
def host_gcc_version
|
def host_gcc_version
|
||||||
gcc = Pathname.new "/usr/bin/gcc"
|
gcc = Pathname.new "/usr/bin/gcc"
|
||||||
return "N/A" unless gcc.executable?
|
return "N/A" unless gcc.executable?
|
||||||
|
|
||||||
`#{gcc} --version 2>/dev/null`[/ (\d+\.\d+\.\d+)/, 1]
|
`#{gcc} --version 2>/dev/null`[/ (\d+\.\d+\.\d+)/, 1]
|
||||||
end
|
end
|
||||||
|
|
||||||
def formula_linked_version(formula)
|
def formula_linked_version(formula)
|
||||||
return "N/A" unless CoreTap.instance.installed?
|
return "N/A" unless CoreTap.instance.installed?
|
||||||
|
|
||||||
Formulary.factory(formula).linked_version || "N/A"
|
Formulary.factory(formula).linked_version || "N/A"
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
"N/A"
|
"N/A"
|
||||||
|
|||||||
@ -7,6 +7,7 @@ class DependencyCollector
|
|||||||
|
|
||||||
def git_dep_if_needed(tags)
|
def git_dep_if_needed(tags)
|
||||||
return if MacOS.version >= :lion
|
return if MacOS.version >= :lion
|
||||||
|
|
||||||
Dependency.new("git", tags)
|
Dependency.new("git", tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -14,11 +15,13 @@ class DependencyCollector
|
|||||||
|
|
||||||
def cvs_dep_if_needed(tags)
|
def cvs_dep_if_needed(tags)
|
||||||
return if MacOS.version < :lion
|
return if MacOS.version < :lion
|
||||||
|
|
||||||
Dependency.new("cvs", tags)
|
Dependency.new("cvs", tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
def xz_dep_if_needed(tags)
|
def xz_dep_if_needed(tags)
|
||||||
return if MacOS.version >= :mavericks
|
return if MacOS.version >= :mavericks
|
||||||
|
|
||||||
Dependency.new("xz", tags)
|
Dependency.new("xz", tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -29,6 +32,7 @@ class DependencyCollector
|
|||||||
def ld64_dep_if_needed(*)
|
def ld64_dep_if_needed(*)
|
||||||
# Tiger's ld is too old to properly link some software
|
# Tiger's ld is too old to properly link some software
|
||||||
return if MacOS.version > :tiger
|
return if MacOS.version > :tiger
|
||||||
|
|
||||||
LD64Dependency.new
|
LD64Dependency.new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -352,6 +352,7 @@ module Homebrew
|
|||||||
|
|
||||||
def check_for_multiple_volumes
|
def check_for_multiple_volumes
|
||||||
return unless HOMEBREW_CELLAR.exist?
|
return unless HOMEBREW_CELLAR.exist?
|
||||||
|
|
||||||
volumes = Volumes.new
|
volumes = Volumes.new
|
||||||
|
|
||||||
# Find the volumes for the TMP folder & HOMEBREW_CELLAR
|
# Find the volumes for the TMP folder & HOMEBREW_CELLAR
|
||||||
|
|||||||
@ -55,6 +55,7 @@ module Stdenv
|
|||||||
# Leopard's ld needs some convincing that it's building 64-bit
|
# Leopard's ld needs some convincing that it's building 64-bit
|
||||||
# See: https://github.com/mistydemeo/tigerbrew/issues/59
|
# See: https://github.com/mistydemeo/tigerbrew/issues/59
|
||||||
return unless MacOS.version == :leopard && MacOS.prefer_64_bit?
|
return unless MacOS.version == :leopard && MacOS.prefer_64_bit?
|
||||||
|
|
||||||
append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}"
|
append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}"
|
||||||
|
|
||||||
# Many, many builds are broken thanks to Leopard's buggy ld.
|
# Many, many builds are broken thanks to Leopard's buggy ld.
|
||||||
@ -94,6 +95,7 @@ module Stdenv
|
|||||||
remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
|
remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
|
||||||
|
|
||||||
return unless (sdk = MacOS.sdk_path_if_needed(version))
|
return unless (sdk = MacOS.sdk_path_if_needed(version))
|
||||||
|
|
||||||
delete("SDKROOT")
|
delete("SDKROOT")
|
||||||
remove_from_cflags "-isysroot #{sdk}"
|
remove_from_cflags "-isysroot #{sdk}"
|
||||||
remove "CPPFLAGS", "-isysroot #{sdk}"
|
remove "CPPFLAGS", "-isysroot #{sdk}"
|
||||||
@ -116,6 +118,7 @@ module Stdenv
|
|||||||
prepend "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
|
prepend "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
|
||||||
|
|
||||||
return unless (sdk = MacOS.sdk_path_if_needed(version))
|
return unless (sdk = MacOS.sdk_path_if_needed(version))
|
||||||
|
|
||||||
# Extra setup to support Xcode 4.3+ without CLT.
|
# Extra setup to support Xcode 4.3+ without CLT.
|
||||||
self["SDKROOT"] = sdk
|
self["SDKROOT"] = sdk
|
||||||
# Tell clang/gcc where system include's are:
|
# Tell clang/gcc where system include's are:
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user