Merge branch 'master' into undeclared_runtime_dependencies
This commit is contained in:
commit
598bbd4c72
@ -88,3 +88,7 @@ Style/HashSyntax:
|
||||
# so many of these in formulae but none in here
|
||||
Style/TrailingBodyOnMethodDefinition:
|
||||
Enabled: true
|
||||
|
||||
Rspec/ExpectActual:
|
||||
Exclude:
|
||||
- 'test/missing_formula_spec.rb'
|
||||
|
||||
@ -32,7 +32,7 @@ class PATH
|
||||
end
|
||||
|
||||
def to_ary
|
||||
@paths
|
||||
@paths.dup.to_ary
|
||||
end
|
||||
alias to_a to_ary
|
||||
|
||||
|
||||
@ -14,12 +14,13 @@ end
|
||||
|
||||
require "pathname"
|
||||
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent
|
||||
|
||||
require "English"
|
||||
unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
|
||||
$LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s)
|
||||
end
|
||||
|
||||
require "global"
|
||||
require "tap"
|
||||
|
||||
if ARGV == %w[--version] || ARGV == %w[-v]
|
||||
puts "Homebrew #{HOMEBREW_VERSION}"
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "set"
|
||||
|
||||
class BuildEnvironment
|
||||
def initialize(*settings)
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
require "hardware"
|
||||
require "utils"
|
||||
|
||||
require "hbc/artifact"
|
||||
require "hbc/audit"
|
||||
@ -20,8 +19,6 @@ require "hbc/locations"
|
||||
require "hbc/config"
|
||||
require "hbc/macos"
|
||||
require "hbc/pkg"
|
||||
require "hbc/qualified_token"
|
||||
require "hbc/scopes"
|
||||
require "hbc/staged"
|
||||
require "hbc/system_command"
|
||||
require "hbc/topological_hash"
|
||||
@ -32,7 +29,6 @@ require "hbc/version"
|
||||
|
||||
module Hbc
|
||||
include Locations
|
||||
include Scopes
|
||||
include Utils
|
||||
|
||||
def self.init
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "pathname"
|
||||
require "timeout"
|
||||
|
||||
require "hbc/artifact/abstract_artifact"
|
||||
|
||||
@ -3,11 +3,20 @@ require "hbc/metadata"
|
||||
|
||||
module Hbc
|
||||
class Cask
|
||||
extend Enumerable
|
||||
extend Forwardable
|
||||
include Metadata
|
||||
|
||||
attr_reader :token, :sourcefile_path, :config
|
||||
|
||||
def self.each
|
||||
return to_enum unless block_given?
|
||||
|
||||
Tap.flat_map(&:cask_files).each do |f|
|
||||
yield CaskLoader::FromTapPathLoader.new(f).load
|
||||
end
|
||||
end
|
||||
|
||||
def tap
|
||||
return super if block_given? # Object#tap
|
||||
@tap
|
||||
@ -43,11 +52,13 @@ module Hbc
|
||||
end
|
||||
|
||||
def full_name
|
||||
if @tap.nil? || @tap == Hbc.default_tap
|
||||
token
|
||||
else
|
||||
"#{@tap}/#{token}"
|
||||
end
|
||||
return token if tap == Hbc.default_tap
|
||||
qualified_token
|
||||
end
|
||||
|
||||
def qualified_token
|
||||
return token if tap.nil?
|
||||
"#{tap.name}/#{token}"
|
||||
end
|
||||
|
||||
def installed?
|
||||
|
||||
@ -15,5 +15,17 @@ module Hbc
|
||||
SystemCommand.run("/usr/sbin/chown", args: [Utils.current_user, Hbc.caskroom], sudo: sudo)
|
||||
SystemCommand.run("/usr/bin/chgrp", args: ["admin", Hbc.caskroom], sudo: sudo)
|
||||
end
|
||||
|
||||
def casks
|
||||
Pathname.glob(Hbc.caskroom.join("*")).sort.select(&:directory?).map do |path|
|
||||
token = path.basename.to_s
|
||||
|
||||
if tap_path = CaskLoader.tap_paths(token).first
|
||||
next CaskLoader::FromTapPathLoader.new(tap_path).load
|
||||
end
|
||||
|
||||
CaskLoader::FromPathLoader.new(Pathname.glob(path.join(".metadata/*/*/*/*.rb")).first).load
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -9,7 +9,7 @@ module Hbc
|
||||
end
|
||||
|
||||
def run
|
||||
failed_casks = casks(alternative: -> { Hbc.all })
|
||||
failed_casks = casks(alternative: -> { Cask.to_a })
|
||||
.reject { |cask| audit(cask) }
|
||||
|
||||
return if failed_casks.empty?
|
||||
|
||||
@ -60,16 +60,12 @@ module Hbc
|
||||
end
|
||||
|
||||
def self.repo_info(cask)
|
||||
user, repo, token = QualifiedToken.parse(Hbc.all_tokens.detect { |t| t.split("/").last == cask.token })
|
||||
return if cask.tap.nil?
|
||||
|
||||
return if user.nil? || repo.nil?
|
||||
|
||||
remote_tap = Tap.fetch(user, repo)
|
||||
|
||||
url = if remote_tap.custom_remote? && !remote_tap.remote.nil?
|
||||
remote_tap.remote
|
||||
url = if cask.tap.custom_remote? && !cask.tap.remote.nil?
|
||||
cask.tap.remote
|
||||
else
|
||||
"#{remote_tap.default_remote}/blob/master/Casks/#{token}.rb"
|
||||
"#{cask.tap.default_remote}/blob/master/Casks/#{cask.token}.rb"
|
||||
end
|
||||
|
||||
puts "From: #{Formatter.url(url)}"
|
||||
|
||||
@ -58,7 +58,7 @@ module Hbc
|
||||
@stanza = :artifacts
|
||||
end
|
||||
|
||||
casks(alternative: -> { Hbc.all }).each do |cask|
|
||||
casks(alternative: -> { Cask.to_a }).each do |cask|
|
||||
print "#{cask}\t" if table?
|
||||
|
||||
begin
|
||||
|
||||
@ -37,7 +37,7 @@ module Hbc
|
||||
end
|
||||
|
||||
def list_installed
|
||||
installed_casks = Hbc.installed
|
||||
installed_casks = Caskroom.casks
|
||||
|
||||
if one?
|
||||
puts installed_casks.map(&:to_s)
|
||||
|
||||
@ -10,7 +10,7 @@ module Hbc
|
||||
end
|
||||
|
||||
def run
|
||||
casks(alternative: -> { Hbc.installed }).each do |cask|
|
||||
casks(alternative: -> { Caskroom.casks }).each do |cask|
|
||||
odebug "Checking update info of Cask #{cask}"
|
||||
self.class.list_if_outdated(cask, greedy?, verbose?)
|
||||
end
|
||||
|
||||
@ -3,7 +3,7 @@ module Hbc
|
||||
class Search < AbstractCommand
|
||||
def run
|
||||
if args.empty?
|
||||
puts Formatter.columns(CLI.nice_listing(Hbc.all_tokens))
|
||||
puts Formatter.columns(CLI.nice_listing(Cask.map(&:qualified_token)))
|
||||
else
|
||||
results = self.class.search(*args)
|
||||
self.class.render_results(*results)
|
||||
@ -30,6 +30,7 @@ module Hbc
|
||||
opoo "Error searching on GitHub: #{error}\n"
|
||||
[]
|
||||
end
|
||||
|
||||
matches.map do |match|
|
||||
tap = Tap.fetch(match["repository"]["full_name"])
|
||||
next if tap.installed?
|
||||
@ -42,7 +43,7 @@ module Hbc
|
||||
partial_matches = []
|
||||
search_term = arguments.join(" ")
|
||||
search_regexp = extract_regexp arguments.first
|
||||
all_tokens = CLI.nice_listing(Hbc.all_tokens)
|
||||
all_tokens = CLI.nice_listing(Cask.map(&:qualified_token))
|
||||
if search_regexp
|
||||
search_term = arguments.first
|
||||
partial_matches = all_tokens.grep(/#{search_regexp}/i)
|
||||
@ -65,7 +66,7 @@ module Hbc
|
||||
return
|
||||
end
|
||||
|
||||
if !exact_match && partial_matches.empty?
|
||||
if !exact_match && partial_matches.empty? && remote_matches.empty?
|
||||
puts "No Cask found for \"#{search_term}\"."
|
||||
return
|
||||
end
|
||||
|
||||
@ -27,7 +27,7 @@ module Hbc
|
||||
|
||||
def cask_paths
|
||||
@cask_paths ||= if args.empty?
|
||||
Hbc.all_tapped_cask_dirs
|
||||
Tap.map(&:cask_dir).select(&:directory?)
|
||||
elsif args.any? { |file| File.exist?(file) }
|
||||
args
|
||||
else
|
||||
|
||||
@ -13,7 +13,7 @@ module Hbc
|
||||
|
||||
def run
|
||||
outdated_casks = casks(alternative: lambda {
|
||||
Hbc.installed.select do |cask|
|
||||
Caskroom.casks.select do |cask|
|
||||
cask.outdated?(greedy?)
|
||||
end
|
||||
}).select { |cask| cask.outdated?(true) }
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
require "tmpdir"
|
||||
|
||||
require "hbc/container/base"
|
||||
|
||||
module Hbc
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "tmpdir"
|
||||
|
||||
require "hbc/container/base"
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "set"
|
||||
require "tempfile"
|
||||
|
||||
require "hbc/container/base"
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "tmpdir"
|
||||
|
||||
require "hbc/container/base"
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "tmpdir"
|
||||
|
||||
require "hbc/container/base"
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "tmpdir"
|
||||
|
||||
require "hbc/container/base"
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "tmpdir"
|
||||
|
||||
require "hbc/container/base"
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "tmpdir"
|
||||
|
||||
require "hbc/container/base"
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "tmpdir"
|
||||
|
||||
require "hbc/container/base"
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "tmpdir"
|
||||
|
||||
require "hbc/container/base"
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "set"
|
||||
require "locale"
|
||||
|
||||
require "hbc/artifact"
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "tap"
|
||||
|
||||
module Hbc
|
||||
module Locations
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "set"
|
||||
|
||||
require "os/mac/version"
|
||||
|
||||
@ -239,26 +238,35 @@ module OS
|
||||
|
||||
# TODO: There should be a way to specify a containing
|
||||
# directory under which nothing can be deleted.
|
||||
UNDELETABLE_DIRS = [
|
||||
UNDELETABLE_PATHS = [
|
||||
"~/",
|
||||
"~/Applications",
|
||||
"~/Applications/.localized",
|
||||
"~/Desktop",
|
||||
"~/Desktop/.localized",
|
||||
"~/Documents",
|
||||
"~/Documents/.localized",
|
||||
"~/Downloads",
|
||||
"~/Downloads/.localized",
|
||||
"~/Mail",
|
||||
"~/Movies",
|
||||
"~/Movies/.localized",
|
||||
"~/Music",
|
||||
"~/Music/.localized",
|
||||
"~/Music/iTunes",
|
||||
"~/Music/iTunes/iTunes Music",
|
||||
"~/Music/iTunes/Album Artwork",
|
||||
"~/News",
|
||||
"~/Pictures",
|
||||
"~/Pictures/.localized",
|
||||
"~/Pictures/Desktops",
|
||||
"~/Pictures/Photo Booth",
|
||||
"~/Pictures/iChat Icons",
|
||||
"~/Pictures/iPhoto Library",
|
||||
"~/Public",
|
||||
"~/Public/.localized",
|
||||
"~/Sites",
|
||||
"~/Sites/.localized",
|
||||
"~/Library",
|
||||
"~/Library/.localized",
|
||||
"~/Library/Accessibility",
|
||||
@ -365,17 +373,17 @@ module OS
|
||||
"~/Library/Widgets",
|
||||
"~/Library/Workflows",
|
||||
]
|
||||
.map { |x| Pathname(x.sub(%r{^~(?=(/|$))}, Dir.home)).expand_path }
|
||||
.to_set
|
||||
.union(SYSTEM_DIRS)
|
||||
.freeze
|
||||
.map { |path| Pathname(path.sub(%r{^~(?=(/|$))}, Dir.home)).expand_path }
|
||||
.to_set
|
||||
.union(SYSTEM_DIRS)
|
||||
.freeze
|
||||
|
||||
def system_dir?(dir)
|
||||
SYSTEM_DIRS.include?(Pathname.new(dir).expand_path)
|
||||
end
|
||||
|
||||
def undeletable?(dir)
|
||||
UNDELETABLE_DIRS.include?(Pathname.new(dir).expand_path)
|
||||
def undeletable?(path)
|
||||
UNDELETABLE_PATHS.include?(Pathname.new(path).expand_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -22,7 +22,7 @@ module Hbc
|
||||
end
|
||||
|
||||
path = if timestamp == :latest
|
||||
Pathname.glob(metadata_versioned_path(version: version).join("*")).sort.last
|
||||
Pathname.glob(metadata_versioned_path(version: version).join("*")).max
|
||||
else
|
||||
timestamp = new_timestamp if timestamp == :now
|
||||
metadata_versioned_path(version: version).join(timestamp)
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
module Hbc
|
||||
module QualifiedToken
|
||||
def self.parse(arg)
|
||||
return nil unless arg.is_a?(String)
|
||||
return nil unless match = arg.downcase.match(HOMEBREW_TAP_CASK_REGEX)
|
||||
user, repo, token = match.captures
|
||||
odebug "[user, repo, token] might be [#{user}, #{repo}, #{token}]"
|
||||
[user, repo, token]
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,47 +0,0 @@
|
||||
module Hbc
|
||||
module Scopes
|
||||
def self.included(base)
|
||||
base.extend(ClassMethods)
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def all
|
||||
all_tokens.map(&CaskLoader.public_method(:load))
|
||||
end
|
||||
|
||||
def all_tapped_cask_dirs
|
||||
Tap.map(&:cask_dir).select(&:directory?)
|
||||
end
|
||||
|
||||
def all_tokens
|
||||
Tap.flat_map do |t|
|
||||
t.cask_files.map do |p|
|
||||
"#{t.name}/#{File.basename(p, ".rb")}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def installed
|
||||
# CaskLoader.load has some DWIM which is slow. Optimize here
|
||||
# by spoon-feeding CaskLoader.load fully-qualified paths.
|
||||
# TODO: speed up Hbc::Source::Tapped (main perf drag is calling Hbc.all_tokens repeatedly)
|
||||
# TODO: ability to specify expected source when calling CaskLoader.load (minor perf benefit)
|
||||
Pathname.glob(caskroom.join("*"))
|
||||
.sort
|
||||
.map do |caskroom_path|
|
||||
token = caskroom_path.basename.to_s
|
||||
|
||||
path_to_cask = all_tapped_cask_dirs.find do |tap_dir|
|
||||
tap_dir.join("#{token}.rb").exist?
|
||||
end
|
||||
|
||||
if path_to_cask
|
||||
CaskLoader.load(path_to_cask.join("#{token}.rb"))
|
||||
else
|
||||
CaskLoader.load(token)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -33,6 +33,7 @@ module Hbc
|
||||
def set_ownership(paths, user: current_user, group: "staff")
|
||||
full_paths = remove_nonexistent(paths)
|
||||
return if full_paths.empty?
|
||||
ohai "Changing ownership of paths required by #{@cask}; your password may be necessary"
|
||||
@command.run!("/usr/sbin/chown", args: ["-R", "--", "#{user}:#{group}"] + full_paths,
|
||||
sudo: true)
|
||||
end
|
||||
|
||||
@ -4,17 +4,6 @@ require "stringio"
|
||||
|
||||
BUG_REPORTS_URL = "https://github.com/caskroom/homebrew-cask#reporting-bugs".freeze
|
||||
|
||||
class Buffer < StringIO
|
||||
extend Predicable
|
||||
|
||||
attr_predicate :tty?
|
||||
|
||||
def initialize(tty = false)
|
||||
super()
|
||||
@tty = tty
|
||||
end
|
||||
end
|
||||
|
||||
# global methods
|
||||
|
||||
def odebug(title, *sput)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "forwardable"
|
||||
require "language/python"
|
||||
|
||||
class Caveats
|
||||
|
||||
@ -11,16 +11,20 @@ module Homebrew
|
||||
def initialize(&block)
|
||||
@parser = OptionParser.new
|
||||
@parsed_args = OpenStruct.new
|
||||
# undefine tap to allow --tap argument
|
||||
@parsed_args.instance_eval { undef tap }
|
||||
instance_eval(&block)
|
||||
end
|
||||
|
||||
def switch(*names, description: nil, env: nil)
|
||||
description = option_to_description(*names) if description.nil?
|
||||
names, env = common_switch(*names) if names.first.is_a?(Symbol)
|
||||
global_switch = names.first.is_a?(Symbol)
|
||||
names, env = common_switch(*names) if global_switch
|
||||
@parser.on(*names, description) do
|
||||
enable_switch(*names)
|
||||
enable_switch(*names, global_switch)
|
||||
end
|
||||
enable_switch(*names) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil?
|
||||
enable_switch(*names, global_switch) if !env.nil? &&
|
||||
!ENV["HOMEBREW_#{env.to_s.upcase}"].nil?
|
||||
end
|
||||
|
||||
def comma_array(name, description: nil)
|
||||
@ -30,14 +34,15 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
def flag(name, description: nil, required: false)
|
||||
if required
|
||||
option_required = OptionParser::REQUIRED_ARGUMENT
|
||||
def flag(name, description: nil)
|
||||
if name.end_with? "="
|
||||
required = OptionParser::REQUIRED_ARGUMENT
|
||||
name.chomp! "="
|
||||
else
|
||||
option_required = OptionParser::OPTIONAL_ARGUMENT
|
||||
required = OptionParser::OPTIONAL_ARGUMENT
|
||||
end
|
||||
description = option_to_description(name) if description.nil?
|
||||
@parser.on(name, description, option_required) do |option_value|
|
||||
@parser.on(name, description, required) do |option_value|
|
||||
@parsed_args[option_to_name(name)] = option_value
|
||||
end
|
||||
end
|
||||
@ -47,27 +52,33 @@ module Homebrew
|
||||
end
|
||||
|
||||
def option_to_description(*names)
|
||||
names.map { |name| name.to_s.sub(/\A--?/, "").tr("-", " ") }.sort.last
|
||||
names.map { |name| name.to_s.sub(/\A--?/, "").tr("-", " ") }.max
|
||||
end
|
||||
|
||||
def parse(cmdline_args = ARGV)
|
||||
@parser.parse!(cmdline_args)
|
||||
@parser.parse(cmdline_args)
|
||||
@parsed_args
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def enable_switch(*names)
|
||||
def enable_switch(*names, global_switch)
|
||||
names.each do |name|
|
||||
if global_switch
|
||||
Homebrew.args["#{option_to_name(name)}?"] = true
|
||||
next
|
||||
end
|
||||
@parsed_args["#{option_to_name(name)}?"] = true
|
||||
end
|
||||
end
|
||||
|
||||
# These are common/global switches accessible throughout Homebrew
|
||||
def common_switch(name)
|
||||
case name
|
||||
when :quiet then [["-q", "--quiet"], :quiet]
|
||||
when :verbose then [["-v", "--verbose"], :verbose]
|
||||
when :debug then [["-d", "--debug"], :debug]
|
||||
when :force then [["-f", "--force"], :force]
|
||||
else name
|
||||
end
|
||||
end
|
||||
|
||||
@ -4,8 +4,6 @@
|
||||
#: * `--repository` <user>`/`<repo>:
|
||||
#: Display where tap <user>`/`<repo>'s directory is located.
|
||||
|
||||
require "tap"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
#: deleted. If you want to delete those too: `rm -rf $(brew --cache)`
|
||||
|
||||
require "cleanup"
|
||||
require "utils"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
@ -28,7 +28,6 @@ module Homebrew
|
||||
slow_checks = %w[
|
||||
check_for_broken_symlinks
|
||||
check_missing_deps
|
||||
check_for_linked_keg_only_brews
|
||||
]
|
||||
methods = (checks.all.sort - slow_checks) + slow_checks
|
||||
else
|
||||
|
||||
@ -119,7 +119,7 @@ module Homebrew
|
||||
def create_issue(repo, title, body)
|
||||
url = "https://api.github.com/repos/#{repo}/issues"
|
||||
data = { "title" => title, "body" => body }
|
||||
scopes = GitHub::CREATE_ISSUE_SCOPES
|
||||
scopes = GitHub::CREATE_ISSUE_FORK_OR_PR_SCOPES
|
||||
GitHub.open_api(url, data: data, scopes: scopes)["html_url"]
|
||||
end
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
HOMEBREW_HELP = <<~EOS.freeze
|
||||
Example usage:
|
||||
brew search [TEXT|/REGEX/]
|
||||
brew (info|home|options) [FORMULA...]
|
||||
brew info [FORMULA...]
|
||||
brew install FORMULA...
|
||||
brew update
|
||||
brew upgrade [FORMULA...]
|
||||
@ -11,17 +11,17 @@ HOMEBREW_HELP = <<~EOS.freeze
|
||||
Troubleshooting:
|
||||
brew config
|
||||
brew doctor
|
||||
brew install -vd FORMULA
|
||||
brew install --verbose --debug FORMULA
|
||||
|
||||
Developers:
|
||||
Contributing:
|
||||
brew create [URL [--no-fetch]]
|
||||
brew edit [FORMULA...]
|
||||
https://docs.brew.sh/Formula-Cookbook
|
||||
|
||||
Further help:
|
||||
man brew
|
||||
brew commands
|
||||
brew help [COMMAND]
|
||||
brew home
|
||||
man brew
|
||||
https://docs.brew.sh
|
||||
EOS
|
||||
|
||||
# NOTE Keep the lenth of vanilla --help less than 25 lines!
|
||||
|
||||
@ -60,7 +60,7 @@ module Homebrew
|
||||
rescue FormulaUnavailableError => e
|
||||
ofail e.message
|
||||
# No formula with this name, try a missing formula lookup
|
||||
if (reason = Homebrew::MissingFormula.reason(f))
|
||||
if (reason = MissingFormula.reason(f))
|
||||
$stderr.puts reason
|
||||
end
|
||||
end
|
||||
|
||||
@ -71,7 +71,6 @@ require "missing_formula"
|
||||
require "diagnostic"
|
||||
require "cmd/search"
|
||||
require "formula_installer"
|
||||
require "tap"
|
||||
require "hardware"
|
||||
require "development_tools"
|
||||
|
||||
@ -166,7 +165,8 @@ module Homebrew
|
||||
formulae << f
|
||||
else
|
||||
opoo <<~EOS
|
||||
#{f.full_name} #{f.pkg_version} is already installed
|
||||
#{f.full_name} #{f.pkg_version} is already installed and up-to-date
|
||||
To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}`
|
||||
EOS
|
||||
end
|
||||
elsif (ARGV.build_head? && new_head_installed) || prefix_installed
|
||||
@ -190,12 +190,17 @@ module Homebrew
|
||||
EOS
|
||||
elsif !f.linked? || f.keg_only?
|
||||
msg = <<~EOS
|
||||
#{msg}, it's just not linked.
|
||||
#{msg}, it's just not linked
|
||||
You can use `brew link #{f}` to link this version.
|
||||
EOS
|
||||
elsif ARGV.only_deps?
|
||||
msg = nil
|
||||
formulae << f
|
||||
else
|
||||
msg = <<~EOS
|
||||
#{msg} and up-to-date
|
||||
To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}`
|
||||
EOS
|
||||
end
|
||||
opoo msg if msg
|
||||
elsif !f.any_version_installed? && old_formula = f.old_installed_formulae.first
|
||||
@ -252,7 +257,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
ofail e.message
|
||||
if (reason = Homebrew::MissingFormula.reason(e.name))
|
||||
if (reason = MissingFormula.reason(e.name))
|
||||
$stderr.puts reason
|
||||
return
|
||||
end
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
|
||||
require "formula"
|
||||
require "tab"
|
||||
require "set"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
#: @hide_from_man_page
|
||||
#: * `linkapps` [`--local`] [<formulae>]:
|
||||
#: Find installed formulae that provide `.app`-style macOS apps and symlink them
|
||||
#: into `/Applications`, allowing for easier access (deprecated).
|
||||
#:
|
||||
#: Unfortunately `brew linkapps` cannot behave nicely with e.g. Spotlight using
|
||||
#: either aliases or symlinks and Homebrew formulae do not build "proper" `.app`
|
||||
#: bundles that can be relocated. Instead, please consider using `brew cask` and
|
||||
#: migrate formulae using `.app`s to casks.
|
||||
|
||||
require "keg"
|
||||
require "formula"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
def linkapps
|
||||
odeprecated "'brew linkapps'"
|
||||
|
||||
target_dir = linkapps_target(local: ARGV.include?("--local"))
|
||||
|
||||
unless target_dir.directory?
|
||||
opoo "#{target_dir} does not exist, stopping."
|
||||
puts "Run `mkdir #{target_dir}` first."
|
||||
exit 1
|
||||
end
|
||||
|
||||
if ARGV.named.empty?
|
||||
kegs = Formula.racks.map do |rack|
|
||||
keg = rack.subdirs.map { |d| Keg.new(d) }
|
||||
next if keg.empty?
|
||||
keg.detect(&:linked?) || keg.max_by(&:version)
|
||||
end
|
||||
else
|
||||
kegs = ARGV.kegs
|
||||
end
|
||||
|
||||
link_count = 0
|
||||
kegs.each do |keg|
|
||||
keg.apps.each do |app|
|
||||
puts "Linking: #{app}"
|
||||
target_app = target_dir/app.basename
|
||||
|
||||
if target_app.exist? && !target_app.symlink?
|
||||
onoe "#{target_app} already exists, skipping."
|
||||
next
|
||||
end
|
||||
|
||||
# We prefer system `ln` over `FileUtils.ln_sf` because the latter seems
|
||||
# to have weird failure conditions (that were observed in the past).
|
||||
system "ln", "-sf", app, target_dir
|
||||
link_count += 1
|
||||
end
|
||||
end
|
||||
|
||||
if link_count.zero?
|
||||
puts "No apps linked to #{target_dir}" if ARGV.verbose?
|
||||
else
|
||||
puts "Linked #{Formatter.pluralize(link_count, "app")} to #{target_dir}"
|
||||
end
|
||||
end
|
||||
|
||||
def linkapps_target(opts = {})
|
||||
local = opts.fetch(:local, false)
|
||||
Pathname.new(local ? "~/Applications" : "/Applications").expand_path
|
||||
end
|
||||
end
|
||||
@ -4,6 +4,8 @@
|
||||
#:
|
||||
#: If `--hide=`<hidden> is passed, act as if none of <hidden> are installed.
|
||||
#: <hidden> should be a comma-separated list of formulae.
|
||||
#:
|
||||
#: `missing` exits with a non-zero status if any formulae are missing dependencies.
|
||||
|
||||
require "formula"
|
||||
require "tab"
|
||||
@ -25,6 +27,7 @@ module Homebrew
|
||||
missing = f.missing_dependencies(hide: ARGV.values("hide"))
|
||||
next if missing.empty?
|
||||
|
||||
Homebrew.failed = true
|
||||
print "#{f}: " if ff.size > 1
|
||||
puts missing.join(" ")
|
||||
end
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
#: * `prune` [`--dry-run`]:
|
||||
#: Remove dead symlinks from the Homebrew prefix. This is generally not
|
||||
#: needed, but can be useful when doing DIY installations. Also remove broken
|
||||
#: app symlinks from `/Applications` and `~/Applications` that were previously
|
||||
#: created by `brew linkapps`.
|
||||
#: needed, but can be useful when doing DIY installations.
|
||||
#:
|
||||
#: If `--dry-run` or `-n` is passed, show what would be removed, but do not
|
||||
#: actually remove anything.
|
||||
|
||||
require "keg"
|
||||
require "cmd/tap"
|
||||
require "cmd/unlinkapps"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
@ -49,17 +46,15 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
unless ARGV.dry_run?
|
||||
if ObserverPathnameExtension.total.zero?
|
||||
puts "Nothing pruned" if ARGV.verbose?
|
||||
else
|
||||
n, d = ObserverPathnameExtension.counts
|
||||
print "Pruned #{n} symbolic links "
|
||||
print "and #{d} directories " if d.positive?
|
||||
puts "from #{HOMEBREW_PREFIX}"
|
||||
end
|
||||
end
|
||||
return if ARGV.dry_run?
|
||||
|
||||
unlinkapps_prune(dry_run: ARGV.dry_run?, quiet: true)
|
||||
if ObserverPathnameExtension.total.zero?
|
||||
puts "Nothing pruned" if ARGV.verbose?
|
||||
else
|
||||
n, d = ObserverPathnameExtension.counts
|
||||
print "Pruned #{n} symbolic links "
|
||||
print "and #{d} directories " if d.positive?
|
||||
puts "from #{HOMEBREW_PREFIX}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -15,8 +15,6 @@
|
||||
|
||||
require "formula"
|
||||
require "missing_formula"
|
||||
require "utils"
|
||||
require "official_taps"
|
||||
require "descriptions"
|
||||
|
||||
module Homebrew
|
||||
@ -66,7 +64,7 @@ module Homebrew
|
||||
count = local_results.length + tap_results.length
|
||||
|
||||
ohai "Searching blacklisted, migrated and deleted formulae..."
|
||||
if reason = Homebrew::MissingFormula.reason(query, silent: true)
|
||||
if reason = MissingFormula.reason(query, silent: true)
|
||||
if count.positive?
|
||||
puts
|
||||
puts "If you meant #{query.inspect} specifically:"
|
||||
@ -110,15 +108,22 @@ module Homebrew
|
||||
$stderr.puts Formatter.headline("Searching taps on GitHub...", color: :blue)
|
||||
end
|
||||
|
||||
valid_dirnames = ["Formula", "HomebrewFormula", "Casks", "."].freeze
|
||||
matches = GitHub.search_code(user: ["Homebrew", "caskroom"], filename: query, extension: "rb")
|
||||
|
||||
matches = begin
|
||||
GitHub.search_code(
|
||||
user: ["Homebrew", "caskroom"],
|
||||
path: ["Formula", "HomebrewFormula", "Casks", "."],
|
||||
filename: query,
|
||||
extension: "rb",
|
||||
)
|
||||
rescue GitHub::Error => error
|
||||
opoo "Error searching on GitHub: #{error}\n"
|
||||
[]
|
||||
end
|
||||
matches.map do |match|
|
||||
dirname, filename = File.split(match["path"])
|
||||
next unless valid_dirnames.include?(dirname)
|
||||
filename = File.basename(match["path"], ".rb")
|
||||
tap = Tap.fetch(match["repository"]["full_name"])
|
||||
next if tap.installed? && match["repository"]["owner"]["login"] != "caskroom"
|
||||
"#{tap.name}/#{File.basename(filename, ".rb")}"
|
||||
"#{tap.name}/#{filename}"
|
||||
end.compact
|
||||
end
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
#:
|
||||
#: Exits with a non-zero status if any style violations are found.
|
||||
|
||||
require "utils"
|
||||
require "json"
|
||||
require "open3"
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#: * `switch` <name> <version>:
|
||||
#: Symlink all of the specific <version> of <name>'s install to Homebrew prefix.
|
||||
#: * `switch` <formula> <version>:
|
||||
#: Symlink all of the specific <version> of <formula>'s install to Homebrew prefix.
|
||||
|
||||
require "formula"
|
||||
require "keg"
|
||||
@ -9,14 +9,15 @@ module Homebrew
|
||||
module_function
|
||||
|
||||
def switch
|
||||
if ARGV.named.length != 2
|
||||
onoe "Usage: brew switch <name> <version>"
|
||||
name = ARGV.first
|
||||
|
||||
usage = "Usage: brew switch <formula> <version>"
|
||||
|
||||
unless name
|
||||
onoe usage
|
||||
exit 1
|
||||
end
|
||||
|
||||
name = ARGV.shift
|
||||
version = ARGV.shift
|
||||
|
||||
rack = Formulary.to_rack(name)
|
||||
|
||||
unless rack.directory?
|
||||
@ -24,13 +25,21 @@ module Homebrew
|
||||
exit 2
|
||||
end
|
||||
|
||||
# Does the target version exist?
|
||||
versions = rack.subdirs
|
||||
.map { |d| Keg.new(d).version }
|
||||
.sort
|
||||
.join(", ")
|
||||
version = ARGV[1]
|
||||
|
||||
if !version || ARGV.named.length > 2
|
||||
onoe usage
|
||||
puts "#{name} installed versions: #{versions}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
unless (rack/version).directory?
|
||||
onoe "#{name} does not have a version \"#{version}\" in the Cellar."
|
||||
|
||||
versions = rack.subdirs.map { |d| Keg.new(d).version }.sort
|
||||
puts "Versions available: #{versions.join(", ")}"
|
||||
|
||||
puts "#{name} installed versions: #{versions}"
|
||||
exit 3
|
||||
end
|
||||
|
||||
|
||||
@ -15,8 +15,6 @@
|
||||
#: See the docs for examples of using the JSON output:
|
||||
#: <https://docs.brew.sh/Querying-Brew>
|
||||
|
||||
require "tap"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
#: Pin <tap>, prioritizing its formulae over core when formula names are supplied
|
||||
#: by the user. See also `tap-unpin`.
|
||||
|
||||
require "tap"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
#: * `tap-unpin` <tap>:
|
||||
#: Unpin <tap> so its formulae are no longer prioritized. See also `tap-pin`.
|
||||
|
||||
require "tap"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#: * `tap`:
|
||||
#: List all installed taps.
|
||||
#:
|
||||
#: * `tap` [`--full`] <user>`/`<repo> [<URL>]:
|
||||
#: * `tap` [`--full`] [`--force-auto-update`] <user>`/`<repo> [<URL>]:
|
||||
#: Tap a formula repository.
|
||||
#:
|
||||
#: With <URL> unspecified, taps a formula repository from GitHub using HTTPS.
|
||||
@ -18,6 +18,10 @@
|
||||
#: if `--full` is passed, a full clone will be used. To convert a shallow copy
|
||||
#: to a full copy, you can retap passing `--full` without first untapping.
|
||||
#:
|
||||
#: By default, only taps hosted on GitHub are auto-updated (for performance
|
||||
#: reasons). If `--force-auto-update` is passed, this tap will be auto-updated
|
||||
#: even if it is not hosted on GitHub.
|
||||
#:
|
||||
#: `tap` is re-runnable and exits successfully if there's nothing to do.
|
||||
#: However, retapping with a different <URL> will cause an exception, so first
|
||||
#: `untap` if you need to modify the <URL>.
|
||||
@ -25,14 +29,9 @@
|
||||
#: * `tap` `--repair`:
|
||||
#: Migrate tapped formulae from symlink-based to directory-based structure.
|
||||
#:
|
||||
#: * `tap` `--list-official`:
|
||||
#: List all official taps.
|
||||
#:
|
||||
#: * `tap` `--list-pinned`:
|
||||
#: List all pinned taps.
|
||||
|
||||
require "tap"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
@ -40,8 +39,7 @@ module Homebrew
|
||||
if ARGV.include? "--repair"
|
||||
Tap.each(&:link_completions_and_manpages)
|
||||
elsif ARGV.include? "--list-official"
|
||||
require "official_taps"
|
||||
puts OFFICIAL_TAPS.map { |t| "homebrew/#{t}" }
|
||||
odeprecated("brew tap --list-official")
|
||||
elsif ARGV.include? "--list-pinned"
|
||||
puts Tap.select(&:pinned?).map(&:name)
|
||||
elsif ARGV.named.empty?
|
||||
@ -50,6 +48,7 @@ module Homebrew
|
||||
tap = Tap.fetch(ARGV.named[0])
|
||||
begin
|
||||
tap.install clone_target: ARGV.named[1],
|
||||
force_auto_update: force_auto_update?,
|
||||
full_clone: full_clone?,
|
||||
quiet: ARGV.quieter?
|
||||
rescue TapRemoteMismatchError => e
|
||||
@ -62,4 +61,9 @@ module Homebrew
|
||||
def full_clone?
|
||||
ARGV.include?("--full") || ARGV.homebrew_developer?
|
||||
end
|
||||
|
||||
def force_auto_update?
|
||||
# if no relevant flag is present, return nil, meaning "no change"
|
||||
true if ARGV.include?("--force-auto-update")
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,79 +0,0 @@
|
||||
#: @hide_from_man_page
|
||||
#: * `unlinkapps` [`--local`] [`--dry-run`] [<formulae>]:
|
||||
#: Remove symlinks created by `brew linkapps` from `/Applications` (deprecated).
|
||||
#:
|
||||
#: Unfortunately `brew linkapps` cannot behave nicely with e.g. Spotlight using
|
||||
#: either aliases or symlinks and Homebrew formulae do not build "proper" `.app`
|
||||
#: bundles that can be relocated. Instead, please consider using `brew cask` and
|
||||
#: migrate formulae using `.app`s to casks.
|
||||
|
||||
require "cmd/linkapps"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
def unlinkapps
|
||||
odeprecated "'brew unlinkapps'"
|
||||
|
||||
target_dir = linkapps_target(local: ARGV.include?("--local"))
|
||||
|
||||
unlinkapps_from_dir(target_dir, dry_run: ARGV.dry_run?)
|
||||
end
|
||||
|
||||
def unlinkapps_prune(opts = {})
|
||||
opts = opts.merge(prune: true)
|
||||
unlinkapps_from_dir(linkapps_target(local: false), opts)
|
||||
unlinkapps_from_dir(linkapps_target(local: true), opts)
|
||||
end
|
||||
|
||||
def unlinkapps_from_dir(target_dir, opts = {})
|
||||
return unless target_dir.directory?
|
||||
dry_run = opts.fetch(:dry_run, false)
|
||||
quiet = opts.fetch(:quiet, false)
|
||||
|
||||
apps = Pathname.glob("#{target_dir}/*.app").select do |app|
|
||||
unlinkapps_unlink?(app, opts)
|
||||
end
|
||||
|
||||
ObserverPathnameExtension.reset_counts!
|
||||
|
||||
app_kind = opts.fetch(:prune, false) ? " (broken link)" : ""
|
||||
apps.each do |app|
|
||||
app.extend(ObserverPathnameExtension)
|
||||
if dry_run
|
||||
puts "Would unlink#{app_kind}: #{app}"
|
||||
else
|
||||
puts "Unlinking#{app_kind}: #{app}" unless quiet
|
||||
app.unlink
|
||||
end
|
||||
end
|
||||
|
||||
return if dry_run
|
||||
|
||||
if ObserverPathnameExtension.total.zero?
|
||||
puts "No apps unlinked from #{target_dir}" if ARGV.verbose?
|
||||
else
|
||||
n = ObserverPathnameExtension.total
|
||||
puts "Unlinked #{Formatter.pluralize(n, "app")} from #{target_dir}"
|
||||
end
|
||||
end
|
||||
|
||||
UNLINKAPPS_PREFIXES = %W[
|
||||
#{HOMEBREW_CELLAR}/
|
||||
#{HOMEBREW_PREFIX}/opt/
|
||||
].freeze
|
||||
|
||||
def unlinkapps_unlink?(target_app, opts = {})
|
||||
# Skip non-symlinks and symlinks that don't point into the Homebrew prefix.
|
||||
app = target_app.readlink.to_s if target_app.symlink?
|
||||
return false unless app&.start_with?(*UNLINKAPPS_PREFIXES)
|
||||
|
||||
if opts.fetch(:prune, false)
|
||||
!File.exist?(app) # Remove only broken symlinks in prune mode.
|
||||
elsif ARGV.named.empty?
|
||||
true
|
||||
else
|
||||
ARGV.kegs.any? { |keg| app.start_with?("#{keg}/", "#{keg.opt_record}/") }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,8 +1,6 @@
|
||||
#: * `untap` <tap>:
|
||||
#: Remove a tapped repository.
|
||||
|
||||
require "tap"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
|
||||
@ -7,7 +7,6 @@ require "migrator"
|
||||
require "formulary"
|
||||
require "descriptions"
|
||||
require "cleanup"
|
||||
require "utils"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
@ -493,8 +493,12 @@ EOS
|
||||
[[ -z "$HOMEBREW_UPDATE_FORCE" ]] && [[ "$UPSTREAM_SHA_HTTP_CODE" = "304" ]] && exit
|
||||
elif [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
|
||||
then
|
||||
# Don't try to do a `git fetch` that may take longer than expected.
|
||||
exit
|
||||
FORCE_AUTO_UPDATE="$(git config homebrew.forceautoupdate 2>/dev/null || echo "false")"
|
||||
if [[ "$FORCE_AUTO_UPDATE" != "true" ]]
|
||||
then
|
||||
# Don't try to do a `git fetch` that may take longer than expected.
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "$HOMEBREW_VERBOSE" ]]
|
||||
|
||||
@ -29,7 +29,7 @@ module Homebrew
|
||||
|
||||
Homebrew.perform_preinstall_checks
|
||||
|
||||
odeprecated "'brew upgrade --all'", "'brew upgrade'" if ARGV.include?("--all")
|
||||
odisabled "'brew upgrade --all'", "'brew upgrade'" if ARGV.include?("--all")
|
||||
|
||||
if ARGV.named.empty?
|
||||
outdated = Formula.installed.select do |f|
|
||||
@ -67,7 +67,14 @@ module Homebrew
|
||||
oh1 "No packages to upgrade"
|
||||
else
|
||||
oh1 "Upgrading #{Formatter.pluralize(formulae_to_install.length, "outdated package")}, with result:"
|
||||
puts formulae_to_install.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", "
|
||||
formulae_upgrades = formulae_to_install.map do |f|
|
||||
if f.optlinked?
|
||||
"#{f.full_specified_name} #{Keg.new(f.opt_prefix).version} -> #{f.pkg_version}"
|
||||
else
|
||||
"#{f.full_specified_name} #{f.pkg_version}"
|
||||
end
|
||||
end
|
||||
puts formulae_upgrades.join(", ")
|
||||
end
|
||||
|
||||
# Sort keg_only before non-keg_only formulae to avoid any needless conflicts
|
||||
|
||||
@ -54,48 +54,19 @@ module Homebrew
|
||||
used_formulae.all? do |ff|
|
||||
begin
|
||||
deps = f.runtime_dependencies if only_installed_arg
|
||||
if recursive
|
||||
deps ||= recursive_includes(Dependency, f, includes, ignores)
|
||||
|
||||
dep_formulae = deps.flat_map do |dep|
|
||||
begin
|
||||
dep.to_formula
|
||||
rescue
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
reqs_by_formula = ([f] + dep_formulae).flat_map do |formula|
|
||||
formula.requirements.map { |req| [formula, req] }
|
||||
end
|
||||
|
||||
reqs_by_formula.reject! do |dependent, req|
|
||||
if req.recommended?
|
||||
ignores.include?("recommended?") || dependent.build.without?(req)
|
||||
elsif req.test?
|
||||
!includes.include?("test?")
|
||||
elsif req.optional?
|
||||
!includes.include?("optional?") && !dependent.build.with?(req)
|
||||
elsif req.build?
|
||||
!includes.include?("build?")
|
||||
end
|
||||
end
|
||||
|
||||
reqs = reqs_by_formula.map(&:last)
|
||||
deps ||= if recursive
|
||||
recursive_includes(Dependency, f, includes, ignores)
|
||||
else
|
||||
deps ||= reject_ignores(f.deps, ignores, includes)
|
||||
reqs = reject_ignores(f.requirements, ignores, includes)
|
||||
reject_ignores(f.deps, ignores, includes)
|
||||
end
|
||||
|
||||
next true if deps.any? do |dep|
|
||||
deps.any? do |dep|
|
||||
begin
|
||||
dep.to_formula.full_name == ff.full_name
|
||||
rescue
|
||||
dep.name == ff.name
|
||||
end
|
||||
end
|
||||
|
||||
reqs.any? { |req| req.name == ff.name }
|
||||
rescue FormulaUnavailableError
|
||||
# Silently ignore this case as we don't care about things used in
|
||||
# taps that aren't currently tapped.
|
||||
|
||||
@ -47,7 +47,15 @@ fetch() {
|
||||
local sha
|
||||
local temporary_path
|
||||
|
||||
curl_args=(
|
||||
curl_args=()
|
||||
|
||||
# do not load .curlrc unless requested (must be the first argument)
|
||||
if [[ -z "$HOMEBREW_CURLRC" ]]
|
||||
then
|
||||
curl_args[${#curl_args[*]}]="-q"
|
||||
fi
|
||||
|
||||
curl_args+=(
|
||||
--fail
|
||||
--remote-time
|
||||
--location
|
||||
|
||||
@ -1,32 +1,11 @@
|
||||
require "compat/fails_with_llvm"
|
||||
require "compat/tap"
|
||||
require "compat/hbc"
|
||||
require "compat/formula"
|
||||
require "compat/formula_specialties"
|
||||
require "compat/formula_support"
|
||||
require "compat/global"
|
||||
require "compat/hardware"
|
||||
require "compat/macos"
|
||||
require "compat/md5"
|
||||
require "compat/sha1"
|
||||
require "compat/requirements"
|
||||
require "compat/version"
|
||||
require "compat/download_strategy"
|
||||
require "compat/keg"
|
||||
require "compat/pathname"
|
||||
require "compat/dependency_collector"
|
||||
require "compat/language/haskell"
|
||||
require "compat/xcode"
|
||||
require "compat/software_spec"
|
||||
require "compat/utils"
|
||||
require "compat/json"
|
||||
require "compat/ARGV"
|
||||
require "compat/build_options"
|
||||
require "compat/tab"
|
||||
require "compat/ENV/shared"
|
||||
require "compat/ENV/std"
|
||||
require "compat/ENV/super"
|
||||
require "compat/utils/shell"
|
||||
require "compat/extend/string"
|
||||
require "compat/gpg"
|
||||
require "compat/dependable"
|
||||
require "compat/os/mac"
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
module HomebrewArgvExtension
|
||||
def build_32_bit?
|
||||
odisabled "ARGV.build_32_bit?"
|
||||
end
|
||||
end
|
||||
@ -1,10 +1,9 @@
|
||||
module SharedEnvExtension
|
||||
def j1
|
||||
odeprecated "ENV.j1", "ENV.deparallelize"
|
||||
deparallelize
|
||||
odisabled "ENV.j1", "ENV.deparallelize"
|
||||
end
|
||||
|
||||
def java_cache
|
||||
odeprecated "ENV.java_cache"
|
||||
odisabled "ENV.java_cache"
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
module Stdenv
|
||||
def fast
|
||||
odisabled "ENV.fast"
|
||||
end
|
||||
|
||||
def O4
|
||||
odisabled "ENV.O4"
|
||||
end
|
||||
|
||||
def Og
|
||||
odisabled "ENV.Og"
|
||||
end
|
||||
|
||||
def gcc_4_0_1
|
||||
odisabled "ENV.gcc_4_0_1", "ENV.gcc_4_0"
|
||||
end
|
||||
|
||||
def gcc
|
||||
odisabled "ENV.gcc", "ENV.gcc_4_2"
|
||||
end
|
||||
|
||||
def libpng
|
||||
odisabled "ENV.libpng", "ENV.x11"
|
||||
end
|
||||
end
|
||||
@ -1,45 +0,0 @@
|
||||
module Superenv
|
||||
def fast
|
||||
odisabled "ENV.fast"
|
||||
end
|
||||
|
||||
def O4
|
||||
odisabled "ENV.O4"
|
||||
end
|
||||
|
||||
def Og
|
||||
odisabled "ENV.Og"
|
||||
end
|
||||
|
||||
def gcc_4_0_1
|
||||
odisabled "ENV.gcc_4_0_1", "ENV.gcc_4_0"
|
||||
end
|
||||
|
||||
def gcc
|
||||
odisabled "ENV.gcc", "ENV.gcc_4_2"
|
||||
end
|
||||
|
||||
def libxml2
|
||||
odisabled "ENV.libxml2"
|
||||
end
|
||||
|
||||
def minimal_optimization
|
||||
odisabled "ENV.minimal_optimization"
|
||||
end
|
||||
|
||||
def no_optimization
|
||||
odisabled "ENV.no_optimization"
|
||||
end
|
||||
|
||||
def enable_warnings
|
||||
odisabled "ENV.enable_warnings"
|
||||
end
|
||||
|
||||
def macosxsdk
|
||||
odisabled "ENV.macosxsdk"
|
||||
end
|
||||
|
||||
def remove_macosxsdk
|
||||
odisabled "ENV.remove_macosxsdk"
|
||||
end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
class BuildOptions
|
||||
def build_32_bit?
|
||||
odisabled "build.build_32_bit?"
|
||||
end
|
||||
|
||||
def build_bottle?
|
||||
odisabled "build.build_bottle?", "build.bottle?"
|
||||
end
|
||||
end
|
||||
@ -1,5 +1,6 @@
|
||||
module Dependable
|
||||
def run?
|
||||
odeprecated "Dependable#run?"
|
||||
tags.include? :run
|
||||
end
|
||||
end
|
||||
|
||||
@ -9,56 +9,42 @@ class DependencyCollector
|
||||
|
||||
def parse_string_spec(spec, tags)
|
||||
if (tag = tags.first) && LANGUAGE_MODULES.include?(tag)
|
||||
odeprecated "'depends_on ... => #{tag.inspect}'"
|
||||
LanguageModuleRequirement.new(tag, spec, tags[1])
|
||||
else
|
||||
super
|
||||
odisabled "'depends_on ... => #{tag.inspect}'"
|
||||
end
|
||||
|
||||
if tags.include?(:run)
|
||||
odeprecated "'depends_on ... => :run'"
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def parse_symbol_spec(spec, tags)
|
||||
case spec
|
||||
when :clt
|
||||
odeprecated "'depends_on :clt'"
|
||||
odisabled "'depends_on :clt'"
|
||||
when :tex
|
||||
odeprecated "'depends_on :tex'"
|
||||
TeXRequirement.new(tags)
|
||||
when :autoconf, :automake, :bsdmake, :libtool
|
||||
output_deprecation(spec)
|
||||
autotools_dep(spec, tags)
|
||||
when :cairo, :fontconfig, :freetype, :libpng, :pixman
|
||||
output_deprecation(spec)
|
||||
Dependency.new(spec.to_s, tags)
|
||||
when :ant, :expat
|
||||
output_deprecation(spec)
|
||||
Dependency.new(spec.to_s, tags)
|
||||
odisabled "'depends_on :tex'"
|
||||
when :libltdl
|
||||
output_deprecation("libtool")
|
||||
Dependency.new("libtool", tags)
|
||||
output_disabled(spec, "libtool")
|
||||
when :apr
|
||||
output_deprecation(spec, "apr-util")
|
||||
Dependency.new("apr-util", tags)
|
||||
output_disabled(spec, "apr-util")
|
||||
when :fortran
|
||||
output_deprecation(spec, "gcc")
|
||||
Dependency.new("gcc", tags)
|
||||
output_disabled(spec, "gcc")
|
||||
when :gpg
|
||||
output_deprecation(spec, "gnupg")
|
||||
Dependency.new("gnupg", tags)
|
||||
output_disabled(spec, "gnupg")
|
||||
when :hg
|
||||
output_deprecation(spec, "mercurial")
|
||||
Dependency.new("mercurial", tags)
|
||||
output_disabled(spec, "mercurial")
|
||||
when :mpi
|
||||
output_deprecation(spec, "open-mpi")
|
||||
Dependency.new("open-mpi", tags)
|
||||
output_disabled(spec, "open-mpi")
|
||||
when :python, :python2
|
||||
output_deprecation(spec, "python@2")
|
||||
Dependency.new("python@2", tags)
|
||||
output_disabled(spec, "python@2")
|
||||
when :python3
|
||||
output_deprecation(spec, "python")
|
||||
Dependency.new("python", tags)
|
||||
when :emacs, :mysql, :perl, :postgresql, :rbenv, :ruby
|
||||
output_deprecation(spec)
|
||||
Dependency.new(spec.to_s, tags)
|
||||
output_disabled(spec, "python")
|
||||
when :ant, :autoconf, :automake, :bsdmake, :cairo, :emacs, :expat,
|
||||
:fontconfig, :freetype, :libtool, :libpng, :mysql, :perl, :pixman,
|
||||
:postgresql, :rbenv, :ruby
|
||||
output_disabled(spec)
|
||||
else
|
||||
super
|
||||
end
|
||||
@ -66,14 +52,9 @@ class DependencyCollector
|
||||
|
||||
private
|
||||
|
||||
def autotools_dep(spec, tags)
|
||||
tags << :build
|
||||
Dependency.new(spec.to_s, tags)
|
||||
end
|
||||
|
||||
def output_deprecation(dependency, new_dependency = dependency)
|
||||
odeprecated "'depends_on :#{dependency}'",
|
||||
"'depends_on \"#{new_dependency}\"'"
|
||||
def output_disabled(dependency, new_dependency = dependency)
|
||||
odisabled "'depends_on :#{dependency}'",
|
||||
"'depends_on \"#{new_dependency}\"'"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
class String
|
||||
def undent
|
||||
odeprecated "<<-EOS.undent", "<<~EOS"
|
||||
gsub(/^[ \t]{#{(slice(/^[ \t]+/) || '').length}}/, "")
|
||||
odisabled "<<-EOS.undent", "<<~EOS"
|
||||
self
|
||||
end
|
||||
alias unindent undent
|
||||
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
class Formula
|
||||
def fails_with_llvm(_msg = nil, _data = nil)
|
||||
odisabled "Formula#fails_with_llvm in install"
|
||||
end
|
||||
|
||||
def self.fails_with_llvm(_msg = nil, _data = {})
|
||||
odisabled "Formula.fails_with_llvm"
|
||||
end
|
||||
end
|
||||
@ -1,74 +1,5 @@
|
||||
module FormulaCompat
|
||||
def x11_installed?
|
||||
odisabled "Formula#x11_installed?", "MacOS::X11.installed?"
|
||||
end
|
||||
|
||||
def snow_leopard_64?
|
||||
odisabled "Formula#snow_leopard_64?", "MacOS.prefer_64_bit?"
|
||||
end
|
||||
end
|
||||
|
||||
class Formula
|
||||
include FormulaCompat
|
||||
extend FormulaCompat
|
||||
|
||||
def std_cmake_parameters
|
||||
odisabled "Formula#std_cmake_parameters", "Formula#std_cmake_args"
|
||||
end
|
||||
|
||||
def cxxstdlib_check(_)
|
||||
odisabled "Formula#cxxstdlib_check in install",
|
||||
"Formula.cxxstdlib_check outside install"
|
||||
end
|
||||
|
||||
def self.bottle_sha1(*)
|
||||
odisabled "Formula.bottle_sha1"
|
||||
end
|
||||
|
||||
def self.all
|
||||
odisabled "Formula.all", "Formula.map"
|
||||
end
|
||||
|
||||
def self.canonical_name(_)
|
||||
odisabled "Formula.canonical_name", "Formulary.canonical_name"
|
||||
end
|
||||
|
||||
def self.class_s(_)
|
||||
odisabled "Formula.class_s", "Formulary.class_s"
|
||||
end
|
||||
|
||||
def self.factory(_)
|
||||
odisabled "Formula.factory", "Formulary.factory"
|
||||
end
|
||||
|
||||
def self.require_universal_deps
|
||||
odisabled "Formula.require_universal_deps"
|
||||
end
|
||||
|
||||
def self.path(_)
|
||||
odisabled "Formula.path", "Formulary.core_path"
|
||||
end
|
||||
|
||||
DATA = :DATA
|
||||
|
||||
def patches
|
||||
# Don't print deprecation warning because this method is inherited
|
||||
# when used.
|
||||
{}
|
||||
end
|
||||
|
||||
def python(_options = {}, &_)
|
||||
odisabled "Formula#python"
|
||||
end
|
||||
alias python2 python
|
||||
alias python3 python
|
||||
|
||||
def startup_plist
|
||||
odisabled "Formula#startup_plist", "Formula#plist"
|
||||
end
|
||||
|
||||
def rake(*args)
|
||||
odeprecated "FileUtils#rake", "system \"rake\""
|
||||
system "rake", *args
|
||||
def rake(*)
|
||||
odisabled "FileUtils#rake", "system \"rake\""
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
class ScriptFileFormula < Formula
|
||||
def install
|
||||
odisabled "ScriptFileFormula#install", "Formula#install"
|
||||
end
|
||||
end
|
||||
|
||||
class GithubGistFormula < ScriptFileFormula
|
||||
def self.url(_val)
|
||||
odisabled "GithubGistFormula.url", "Formula.url"
|
||||
end
|
||||
end
|
||||
|
||||
class AmazonWebServicesFormula < Formula
|
||||
def install
|
||||
odisabled "AmazonWebServicesFormula#install", "Formula#install"
|
||||
end
|
||||
alias standard_install install
|
||||
|
||||
# Use this method to generate standard caveats.
|
||||
def standard_instructions(_, _)
|
||||
odisabled "AmazonWebServicesFormula#standard_instructions", "Formula#caveats"
|
||||
end
|
||||
end
|
||||
@ -2,17 +2,80 @@ require "formula_support"
|
||||
|
||||
class KegOnlyReason
|
||||
module Compat
|
||||
def valid?
|
||||
case @reason
|
||||
when :provided_by_osx
|
||||
odisabled "keg_only :provided_by_osx", "keg_only :provided_by_macos"
|
||||
when :shadowed_by_osx
|
||||
odisabled "keg_only :shadowed_by_osx", "keg_only :shadowed_by_macos"
|
||||
when :provided_pre_mountain_lion
|
||||
odeprecated "keg_only :provided_pre_mountain_lion"
|
||||
MacOS.version < :mountain_lion
|
||||
when :provided_pre_mavericks
|
||||
odeprecated "keg_only :provided_pre_mavericks"
|
||||
MacOS.version < :mavericks
|
||||
when :provided_pre_el_capitan
|
||||
odeprecated "keg_only :provided_pre_el_capitan"
|
||||
MacOS.version < :el_capitan
|
||||
when :provided_pre_high_sierra
|
||||
odeprecated "keg_only :provided_pre_high_sierra"
|
||||
MacOS.version < :high_sierra
|
||||
when :provided_until_xcode43
|
||||
odeprecated "keg_only :provided_until_xcode43"
|
||||
MacOS::Xcode.version < "4.3"
|
||||
when :provided_until_xcode5
|
||||
odeprecated "keg_only :provided_until_xcode5"
|
||||
MacOS::Xcode.version < "5.0"
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def to_s
|
||||
case @reason
|
||||
when :provided_by_osx
|
||||
odeprecated "keg_only :provided_by_osx", "keg_only :provided_by_macos"
|
||||
@reason = :provided_by_macos
|
||||
odisabled "keg_only :provided_by_osx", "keg_only :provided_by_macos"
|
||||
when :shadowed_by_osx
|
||||
odeprecated "keg_only :shadowed_by_osx", "keg_only :shadowed_by_macos"
|
||||
@reason = :shadowed_by_macos
|
||||
end
|
||||
odisabled "keg_only :shadowed_by_osx", "keg_only :shadowed_by_macos"
|
||||
when :provided_pre_mountain_lion
|
||||
odeprecated "keg_only :provided_pre_mountain_lion"
|
||||
|
||||
super
|
||||
<<~EOS
|
||||
macOS already provides this software in versions before Mountain Lion
|
||||
EOS
|
||||
when :provided_pre_mavericks
|
||||
odeprecated "keg_only :provided_pre_mavericks"
|
||||
|
||||
<<~EOS
|
||||
macOS already provides this software in versions before Mavericks
|
||||
EOS
|
||||
when :provided_pre_el_capitan
|
||||
odeprecated "keg_only :provided_pre_el_capitan"
|
||||
|
||||
<<~EOS
|
||||
macOS already provides this software in versions before El Capitan
|
||||
EOS
|
||||
when :provided_pre_high_sierra
|
||||
odeprecated "keg_only :provided_pre_high_sierra"
|
||||
|
||||
<<~EOS
|
||||
macOS already provides this software in versions before High Sierra
|
||||
EOS
|
||||
when :provided_until_xcode43
|
||||
odeprecated "keg_only :provided_until_xcode43"
|
||||
|
||||
<<~EOS
|
||||
Xcode provides this software prior to version 4.3
|
||||
EOS
|
||||
when :provided_until_xcode5
|
||||
odeprecated "keg_only :provided_until_xcode5"
|
||||
|
||||
<<~EOS
|
||||
Xcode provides this software prior to version 5
|
||||
EOS
|
||||
else
|
||||
super
|
||||
end.to_s.strip
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
def method_missing(method, *args, &block)
|
||||
if instance_methods.include?(method)
|
||||
odisabled "#{self}##{method}", "'module_function' or 'def self.#{method}' to convert it to a class method"
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def respond_to_missing?(method, include_private = false)
|
||||
return true if method_defined?(method)
|
||||
super(method, include_private)
|
||||
end
|
||||
end
|
||||
@ -1,27 +1,24 @@
|
||||
require "utils"
|
||||
|
||||
module Gpg
|
||||
module_function
|
||||
|
||||
def executable
|
||||
odeprecated "Gpg.executable", 'which "gpg"'
|
||||
which "gpg"
|
||||
odisabled "Gpg.executable", 'which "gpg"'
|
||||
end
|
||||
|
||||
def available?
|
||||
odeprecated "Gpg.available?", 'which "gpg"'
|
||||
File.executable?(executable.to_s)
|
||||
odisabled "Gpg.available?", 'which "gpg"'
|
||||
end
|
||||
|
||||
def create_test_key(_)
|
||||
odeprecated "Gpg.create_test_key"
|
||||
odisabled "Gpg.create_test_key"
|
||||
end
|
||||
|
||||
def cleanup_test_processes!
|
||||
odeprecated "Gpg.cleanup_test_processes!"
|
||||
odisabled "Gpg.cleanup_test_processes!"
|
||||
end
|
||||
|
||||
def test(_)
|
||||
odeprecated "Gpg.test"
|
||||
odisabled "Gpg.test"
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
module Hardware
|
||||
class << self
|
||||
def is_32_bit?
|
||||
odisabled "Hardware.is_32_bit?", "Hardware::CPU.is_32_bit?"
|
||||
end
|
||||
|
||||
def is_64_bit?
|
||||
odisabled "Hardware.is_64_bit?", "Hardware::CPU.is_64_bit?"
|
||||
end
|
||||
|
||||
def bits
|
||||
odisabled "Hardware.bits", "Hardware::CPU.bits"
|
||||
end
|
||||
|
||||
def cpu_type
|
||||
odisabled "Hardware.cpu_type", "Hardware::CPU.type"
|
||||
end
|
||||
|
||||
def cpu_family
|
||||
odisabled "Hardware.cpu_family", "Hardware::CPU.family"
|
||||
end
|
||||
|
||||
def intel_family
|
||||
odisabled "Hardware.intel_family", "Hardware::CPU.family"
|
||||
end
|
||||
|
||||
def ppc_family
|
||||
odisabled "Hardware.ppc_family", "Hardware::CPU.family"
|
||||
end
|
||||
|
||||
def processor_count
|
||||
odisabled "Hardware.processor_count", "Hardware::CPU.cores"
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,19 +0,0 @@
|
||||
require "json"
|
||||
|
||||
module Utils
|
||||
module JSON
|
||||
module_function
|
||||
|
||||
def load(_)
|
||||
odisabled "Utils::JSON.load", "JSON.parse"
|
||||
end
|
||||
|
||||
def dump(_)
|
||||
odisabled "Utils::JSON.dump", "JSON.generate"
|
||||
end
|
||||
|
||||
def stringify_keys(_)
|
||||
odisabled "Utils::JSON.stringify_keys"
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,5 +0,0 @@
|
||||
class Keg
|
||||
def fname
|
||||
odisabled "Keg#fname", "Keg#name"
|
||||
end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
module Language
|
||||
module Haskell
|
||||
module Cabal
|
||||
def cabal_clean_lib
|
||||
odisabled "Language::Haskell::Cabal#cabal_clean_lib"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,124 +0,0 @@
|
||||
require "development_tools"
|
||||
|
||||
if OS.mac?
|
||||
MACOS_FULL_VERSION = OS::Mac.full_version.to_s.freeze
|
||||
MACOS_VERSION = OS::Mac.version.to_s.freeze
|
||||
end
|
||||
|
||||
module OS
|
||||
module Mac
|
||||
module_function
|
||||
|
||||
def xcode_folder
|
||||
odisabled "MacOS.xcode_folder", "MacOS::Xcode.folder"
|
||||
end
|
||||
|
||||
def xcode_prefix
|
||||
odisabled "MacOS.xcode_prefix", "MacOS::Xcode.prefix"
|
||||
end
|
||||
|
||||
def xcode_installed?
|
||||
odisabled "MacOS.xcode_installed?", "MacOS::Xcode.installed?"
|
||||
end
|
||||
|
||||
def xcode_version
|
||||
odisabled "MacOS.xcode_version", "MacOS::Xcode.version"
|
||||
end
|
||||
|
||||
def clt_installed?
|
||||
odisabled "MacOS.clt_installed?", "MacOS::CLT.installed?"
|
||||
end
|
||||
|
||||
def clt_version?
|
||||
odisabled "MacOS.clt_version?", "MacOS::CLT.version"
|
||||
end
|
||||
|
||||
def x11_installed?
|
||||
odisabled "MacOS.x11_installed?", "MacOS::X11.installed?"
|
||||
end
|
||||
|
||||
def x11_prefix
|
||||
odisabled "MacOS.x11_prefix", "MacOS::X11.prefix"
|
||||
end
|
||||
|
||||
def leopard?
|
||||
odisabled "MacOS.leopard?", "'MacOS.version == :leopard'"
|
||||
end
|
||||
|
||||
def snow_leopard?
|
||||
odisabled "MacOS.snow_leopard?", "'MacOS.version >= :snow_leopard'"
|
||||
end
|
||||
|
||||
def snow_leopard_or_newer?
|
||||
odisabled "MacOS.snow_leopard_or_newer?", "'MacOS.version >= :snow_leopard'"
|
||||
end
|
||||
|
||||
def lion?
|
||||
odisabled "MacOS.lion?", "'MacOS.version >= :lion'"
|
||||
end
|
||||
|
||||
def lion_or_newer?
|
||||
odisabled "MacOS.lion_or_newer?", "'MacOS.version >= :lion'"
|
||||
end
|
||||
|
||||
def mountain_lion?
|
||||
odisabled "MacOS.mountain_lion?", "'MacOS.version >= :mountain_lion'"
|
||||
end
|
||||
|
||||
def mountain_lion_or_newer?
|
||||
odisabled "MacOS.mountain_lion_or_newer?", "'MacOS.version >= :mountain_lion'"
|
||||
end
|
||||
|
||||
def macports_or_fink_installed?
|
||||
odisabled "MacOS.macports_or_fink_installed?", "!MacOS.macports_or_fink.empty?"
|
||||
end
|
||||
|
||||
def locate(_)
|
||||
odisabled "MacOS.locate", "DevelopmentTools.locate"
|
||||
end
|
||||
|
||||
def default_cc
|
||||
odisabled "MacOS.default_cc", "DevelopmentTools.default_cc"
|
||||
end
|
||||
|
||||
def default_compiler
|
||||
odisabled "MacOS.default_compiler", "DevelopmentTools.default_compiler"
|
||||
end
|
||||
|
||||
def gcc_40_build_version
|
||||
odisabled "MacOS.gcc_40_build_version", "DevelopmentTools.gcc_4_0_build_version"
|
||||
end
|
||||
|
||||
def gcc_4_0_build_version
|
||||
odisabled "MacOS.gcc_4_0_build_version", "DevelopmentTools.gcc_4_0_build_version"
|
||||
end
|
||||
|
||||
def gcc_42_build_version
|
||||
odisabled "MacOS.gcc_42_build_version", "DevelopmentTools.gcc_4_2_build_version"
|
||||
end
|
||||
|
||||
def gcc_build_version
|
||||
odisabled "MacOS.gcc_build_version", "DevelopmentTools.gcc_4_2_build_version"
|
||||
end
|
||||
|
||||
def llvm_build_version
|
||||
odisabled "MacOS.llvm_build_version"
|
||||
end
|
||||
|
||||
def clang_version
|
||||
odisabled "MacOS.clang_version", "DevelopmentTools.clang_version"
|
||||
end
|
||||
|
||||
def clang_build_version
|
||||
odisabled "MacOS.clang_build_version", "DevelopmentTools.clang_build_version"
|
||||
end
|
||||
|
||||
def has_apple_developer_tools?
|
||||
odisabled "MacOS.has_apple_developer_tools?", "DevelopmentTools.installed?"
|
||||
end
|
||||
|
||||
def release
|
||||
odisabled "MacOS.release", "MacOS.version"
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,23 +0,0 @@
|
||||
class Formula
|
||||
def self.md5(_val)
|
||||
odisabled "Formula.md5", "Formula.sha256"
|
||||
end
|
||||
end
|
||||
|
||||
class SoftwareSpec
|
||||
def md5(_val)
|
||||
odisabled "SoftwareSpec#md5", "SoftwareSpec#sha256"
|
||||
end
|
||||
end
|
||||
|
||||
class Resource
|
||||
def md5(_val)
|
||||
odisabled "Resource#md5", "Resource#sha256"
|
||||
end
|
||||
end
|
||||
|
||||
class Pathname
|
||||
def md5
|
||||
odisabled "Pathname#md5", "Pathname#sha256"
|
||||
end
|
||||
end
|
||||
10
Library/Homebrew/compat/os/mac.rb
Normal file
10
Library/Homebrew/compat/os/mac.rb
Normal file
@ -0,0 +1,10 @@
|
||||
module OS
|
||||
module Mac
|
||||
class << self
|
||||
def release
|
||||
odeprecated "MacOS.release", "MacOS.version"
|
||||
version
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,9 +0,0 @@
|
||||
class Pathname
|
||||
def cp(_)
|
||||
odisabled "Pathname#cp", "FileUtils.cp"
|
||||
end
|
||||
|
||||
def chmod_R(_)
|
||||
odisabled "Pathname#chmod_R", "FileUtils.chmod_R"
|
||||
end
|
||||
end
|
||||
@ -1,123 +1,107 @@
|
||||
require "requirements"
|
||||
require "compat/requirements/language_module_requirement"
|
||||
|
||||
class CVSRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("CVSRequirement", "'depends_on \"cvs\"'")
|
||||
which "cvs"
|
||||
odisabled("CVSRequirement", "'depends_on \"cvs\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class EmacsRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("EmacsRequirement", "'depends_on \"emacs\"'")
|
||||
which "emacs"
|
||||
odisabled("EmacsRequirement", "'depends_on \"emacs\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class FortranRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("FortranRequirement", "'depends_on \"gcc\"'")
|
||||
which "gfortran"
|
||||
odisabled("FortranRequirement", "'depends_on \"gcc\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class GitRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("GitRequirement", "'depends_on \"git\"'")
|
||||
which "git"
|
||||
odisabled("GitRequirement", "'depends_on \"git\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class GPG2Requirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("GPG2Requirement", "'depends_on \"gnupg\"'")
|
||||
which "gpg"
|
||||
odisabled("GPG2Requirement", "'depends_on \"gnupg\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class MercurialRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("MercurialRequirement", "'depends_on \"mercurial\"'")
|
||||
which "hg"
|
||||
odisabled("MercurialRequirement", "'depends_on \"mercurial\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class MPIRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("MPIRequirement", "'depends_on \"open-mpi\"'")
|
||||
which "mpicc"
|
||||
odisabled("MPIRequirement", "'depends_on \"open-mpi\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class MysqlRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("MysqlRequirement", "'depends_on \"mysql\"'")
|
||||
which "mysql_config"
|
||||
odisabled("MysqlRequirement", "'depends_on \"mysql\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class PerlRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("PerlRequirement", "'depends_on \"perl\"'")
|
||||
which "perl"
|
||||
odisabled("PerlRequirement", "'depends_on \"perl\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class PostgresqlRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("PostgresqlRequirement", "'depends_on \"postgresql\"'")
|
||||
which "pg_config"
|
||||
odisabled("PostgresqlRequirement", "'depends_on \"postgresql\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class PythonRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("PythonRequirement", "'depends_on \"python@2\"'")
|
||||
which "python2"
|
||||
odisabled("PythonRequirement", "'depends_on \"python@2\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class Python3Requirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("Python3Requirement", "'depends_on \"python\"'")
|
||||
which "python"
|
||||
odisabled("Python3Requirement", "'depends_on \"python\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class RbenvRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("RbenvRequirement", "'depends_on \"rbenv\"'")
|
||||
which "rbenv"
|
||||
odisabled("RbenvRequirement", "'depends_on \"rbenv\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class RubyRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("RubyRequirement", "'depends_on \"ruby\"'")
|
||||
which "ruby"
|
||||
odisabled("RubyRequirement", "'depends_on \"ruby\"'")
|
||||
end
|
||||
end
|
||||
|
||||
class SubversionRequirement < Requirement
|
||||
fatal true
|
||||
satisfy do
|
||||
odeprecated("SubversionRequirement", "'depends_on \"subversion\"'")
|
||||
which "svn"
|
||||
odisabled("SubversionRequirement", "'depends_on \"subversion\"'")
|
||||
end
|
||||
end
|
||||
|
||||
@ -126,8 +110,7 @@ class TeXRequirement < Requirement
|
||||
cask "mactex"
|
||||
download "https://www.tug.org/mactex/"
|
||||
satisfy do
|
||||
odeprecated("TeXRequirement")
|
||||
which("tex") || which("latex")
|
||||
odisabled("TeXRequirement")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
require "requirement"
|
||||
|
||||
class LanguageModuleRequirement < Requirement
|
||||
fatal true
|
||||
|
||||
def initialize(language, module_name, import_name = nil)
|
||||
@language = language
|
||||
@module_name = module_name
|
||||
@import_name = import_name || module_name
|
||||
super([language, module_name, import_name])
|
||||
end
|
||||
|
||||
satisfy(build_env: false) { quiet_system(*the_test) }
|
||||
|
||||
def message
|
||||
s = <<~EOS
|
||||
Unsatisfied dependency: #{@module_name}
|
||||
Homebrew does not provide special #{@language.to_s.capitalize} dependencies; install with:
|
||||
`#{command_line} #{@module_name}`
|
||||
EOS
|
||||
|
||||
unless [:python, :perl, :ruby].include? @language
|
||||
s += <<~EOS
|
||||
You may need to: `brew install #{@language}`
|
||||
|
||||
EOS
|
||||
end
|
||||
|
||||
s
|
||||
end
|
||||
|
||||
def the_test
|
||||
case @language
|
||||
when :lua
|
||||
["/usr/bin/env", "luarocks-5.2", "show", @import_name.to_s]
|
||||
when :lua51
|
||||
["/usr/bin/env", "luarocks-5.1", "show", @import_name.to_s]
|
||||
when :perl
|
||||
["/usr/bin/env", "perl", "-e", "use #{@import_name}"]
|
||||
when :python
|
||||
["/usr/bin/env", "python2", "-c", "import #{@import_name}"]
|
||||
when :python3
|
||||
["/usr/bin/env", "python", "-c", "import #{@import_name}"]
|
||||
when :ruby
|
||||
["/usr/bin/env", "ruby", "-rubygems", "-e", "require '#{@import_name}'"]
|
||||
end
|
||||
end
|
||||
|
||||
def command_line
|
||||
case @language
|
||||
when :lua then "luarocks-5.2 install"
|
||||
when :lua51 then "luarocks-5.1 install"
|
||||
when :perl then "cpan -i"
|
||||
when :python then "pip3 install"
|
||||
when :python3 then "pip install"
|
||||
when :ruby then "gem install"
|
||||
end
|
||||
end
|
||||
|
||||
def display_s
|
||||
"#{@module_name} (#{@language} module)"
|
||||
end
|
||||
end
|
||||
@ -1,29 +0,0 @@
|
||||
class Formula
|
||||
def self.sha1(_val)
|
||||
odisabled "Formula.sha1", "Formula.sha256"
|
||||
end
|
||||
end
|
||||
|
||||
class SoftwareSpec
|
||||
def sha1(_val)
|
||||
odisabled "SoftwareSpec#sha1", "SoftwareSpec#sha256"
|
||||
end
|
||||
end
|
||||
|
||||
class Resource
|
||||
def sha1(_val)
|
||||
odisabled "Resource#sha1", "Resource#sha256"
|
||||
end
|
||||
end
|
||||
|
||||
class BottleSpecification
|
||||
def sha1(_val)
|
||||
odisabled "BottleSpecification#sha1", "BottleSpecification#sha256"
|
||||
end
|
||||
end
|
||||
|
||||
class Pathname
|
||||
def sha1
|
||||
odisabled "Pathname#sha1", "Pathname#sha256"
|
||||
end
|
||||
end
|
||||
@ -1,5 +0,0 @@
|
||||
class BottleSpecification
|
||||
def revision(*)
|
||||
odisabled "BottleSpecification.revision", "BottleSpecification.rebuild"
|
||||
end
|
||||
end
|
||||
@ -1,5 +0,0 @@
|
||||
class Tab < OpenStruct
|
||||
def build_32_bit?
|
||||
odisabled "Tab.build_32_bit?"
|
||||
end
|
||||
end
|
||||
@ -1,7 +0,0 @@
|
||||
require "tap"
|
||||
|
||||
class Tap
|
||||
def core_formula_repository?
|
||||
odisabled "Tap#core_formula_repository?", "Tap#core_tap?"
|
||||
end
|
||||
end
|
||||
@ -1,15 +0,0 @@
|
||||
module Tty
|
||||
module_function
|
||||
|
||||
def white
|
||||
odisabled "Tty.white", "Tty.reset.bold"
|
||||
end
|
||||
end
|
||||
|
||||
def puts_columns(_)
|
||||
odisabled "puts_columns", "puts Formatter.columns"
|
||||
end
|
||||
|
||||
def plural(_, _)
|
||||
odisabled "#plural", "Formatter.pluralize"
|
||||
end
|
||||
@ -1,7 +0,0 @@
|
||||
module Utils
|
||||
module Shell
|
||||
def self.shell_profile
|
||||
odisabled "Utils::Shell.shell_profile", "Utils::Shell.profile"
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,5 +0,0 @@
|
||||
class Version
|
||||
def slice(*)
|
||||
odisabled "Version#slice", "Version#to_s.slice"
|
||||
end
|
||||
end
|
||||
@ -1,11 +0,0 @@
|
||||
module OS
|
||||
module Mac
|
||||
module Xcode
|
||||
module_function
|
||||
|
||||
def provides_autotools?
|
||||
odisabled "OS::Mac::Xcode.provides_autotools?"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -2,8 +2,6 @@ unless ENV["HOMEBREW_BREW_FILE"]
|
||||
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!"
|
||||
end
|
||||
|
||||
require "constants"
|
||||
|
||||
# Path to `bin/brew` main executable in HOMEBREW_PREFIX
|
||||
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# RuboCop version used for `brew style` and `brew cask style`
|
||||
HOMEBREW_RUBOCOP_VERSION = "0.54.0"
|
||||
HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.18.0" # has to be updated when RuboCop version changes
|
||||
HOMEBREW_RUBOCOP_VERSION = "0.55.0"
|
||||
HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.19.0" # has to be updated when RuboCop version changes
|
||||
|
||||
@ -2,7 +2,6 @@ require "dependency"
|
||||
require "dependencies"
|
||||
require "requirement"
|
||||
require "requirements"
|
||||
require "set"
|
||||
require "extend/cachable"
|
||||
|
||||
## A dependency is a formula that another formula needs to install.
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
require "set"
|
||||
require "formula"
|
||||
require "formula_versions"
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
#: * `bottle` [`--verbose`] [`--no-rebuild`|`--keep-old`] [`--skip-relocation`] [`--root-url=`<URL>] [`--force-core-tap`] <formulae>:
|
||||
#: * `bottle` [`--verbose`] [`--no-rebuild`|`--keep-old`] [`--skip-relocation`] [`--or-later`] [`--root-url=`<URL>] [`--force-core-tap`] <formulae>:
|
||||
#: Generate a bottle (binary package) from a formula installed with
|
||||
#: `--build-bottle`.
|
||||
#:
|
||||
@ -15,6 +15,8 @@
|
||||
#: If `--root-url` is passed, use the specified <URL> as the root of the
|
||||
#: bottle's URL instead of Homebrew's default.
|
||||
#:
|
||||
#: If `--or-later` is passed, append _or_later to the bottle tag.
|
||||
#:
|
||||
#: If `--force-core-tap` is passed, build a bottle even if <formula> is not
|
||||
#: in homebrew/core or any installed taps.
|
||||
#:
|
||||
@ -37,7 +39,6 @@ require "formula_versions"
|
||||
require "cli_parser"
|
||||
require "utils/inreplace"
|
||||
require "erb"
|
||||
require "extend/pathname"
|
||||
|
||||
BOTTLE_ERB = <<-EOS.freeze
|
||||
bottle do
|
||||
@ -58,7 +59,7 @@ BOTTLE_ERB = <<-EOS.freeze
|
||||
<% checksums.each do |checksum_type, checksum_values| %>
|
||||
<% checksum_values.each do |checksum_value| %>
|
||||
<% checksum, macos = checksum_value.shift %>
|
||||
<%= checksum_type %> "<%= checksum %>" => :<%= macos %>
|
||||
<%= checksum_type %> "<%= checksum %>" => :<%= macos %><%= "_or_later" if Homebrew.args.or_later? %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
end
|
||||
@ -79,7 +80,9 @@ module Homebrew
|
||||
switch "--write"
|
||||
switch "--no-commit"
|
||||
switch "--json"
|
||||
switch "--or-later"
|
||||
switch :verbose
|
||||
switch :debug
|
||||
flag "--root-url"
|
||||
end
|
||||
|
||||
@ -114,7 +117,7 @@ module Homebrew
|
||||
linked_libraries = Keg.file_linked_libraries(file, string)
|
||||
result ||= !linked_libraries.empty?
|
||||
|
||||
if @args.verbose?
|
||||
if Homebrew.args.verbose?
|
||||
print_filename.call(string, file) unless linked_libraries.empty?
|
||||
linked_libraries.each do |lib|
|
||||
puts " #{Tty.bold}-->#{Tty.reset} links to #{lib}"
|
||||
@ -137,7 +140,7 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
next unless @args.verbose? && !text_matches.empty?
|
||||
next unless Homebrew.args.verbose? && !text_matches.empty?
|
||||
print_filename.call(string, file)
|
||||
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}"
|
||||
@ -158,7 +161,7 @@ module Homebrew
|
||||
absolute_symlinks_start_with_string << pn if link.to_s.start_with?(string)
|
||||
end
|
||||
|
||||
if @args.verbose?
|
||||
if Homebrew.args.verbose?
|
||||
unless absolute_symlinks_start_with_string.empty?
|
||||
opoo "Absolute symlink starting with #{string}:"
|
||||
absolute_symlinks_start_with_string.each do |pn|
|
||||
@ -299,7 +302,7 @@ module Homebrew
|
||||
end
|
||||
skip_relocation = relocatable && !keg.require_relocation?
|
||||
end
|
||||
puts if !relocatable && @args.verbose?
|
||||
puts if !relocatable && Homebrew.args.verbose?
|
||||
rescue Interrupt
|
||||
ignore_interrupts { bottle_path.unlink if bottle_path.exist? }
|
||||
raise
|
||||
@ -360,6 +363,8 @@ module Homebrew
|
||||
puts output
|
||||
|
||||
return unless @args.json?
|
||||
tag = Utils::Bottles.tag.to_s
|
||||
tag += "_or_later" if @args.or_later?
|
||||
json = {
|
||||
f.full_name => {
|
||||
"formula" => {
|
||||
@ -372,7 +377,7 @@ module Homebrew
|
||||
"cellar" => bottle.cellar.to_s,
|
||||
"rebuild" => bottle.rebuild,
|
||||
"tags" => {
|
||||
Utils::Bottles.tag.to_s => {
|
||||
tag => {
|
||||
"filename" => filename.to_s,
|
||||
"sha256" => sha256,
|
||||
},
|
||||
|
||||
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