未验证 提交 d7335125 编辑于 作者: Mike McQuaid's avatar Mike McQuaid
浏览文件

Deprecate, disable, delete code for next major/minor version.

Do the usual dance for bumping our major/minor version.
上级 fa3af8d2
......@@ -16,8 +16,6 @@ module Cask
:cask,
:macos,
:arch,
:x11,
:java,
]).freeze
VALID_ARCHES = {
......@@ -27,7 +25,7 @@ module Cask
arm64: { type: :arm, bits: 64 },
}.freeze
attr_reader :arch, :cask, :formula, :java, :macos, :x11
attr_reader :arch, :cask, :formula, :macos
def initialize
super({})
......@@ -81,20 +79,6 @@ module Cask
@arch.concat(arches.map { |arch| VALID_ARCHES[arch] })
end
def java=(arg)
odisabled "depends_on :java", "depends_on a specific Java formula"
@java = arg
end
def x11=(arg)
raise "invalid 'depends_on x11' value: #{arg.inspect}" unless [true, false].include?(arg)
odisabled "depends_on :x11", "depends_on specific X11 formula(e)"
@x11 = arg
end
end
end
end
......@@ -260,7 +260,6 @@ timeout: timeout)
macos_dependencies
arch_dependencies
x11_dependencies
cask_and_formula_dependencies
end
......@@ -286,11 +285,6 @@ timeout: timeout)
"but you are running #{@current_arch}."
end
def x11_dependencies
return unless @cask.depends_on.x11
raise CaskX11DependencyError, @cask.token unless MacOS::XQuartz.installed?
end
def graph_dependencies(cask_or_formula, acc = TopologicalHash.new)
return acc if acc.key?(cask_or_formula)
......
......@@ -38,7 +38,6 @@ class CaskDependent
requirements << Requirement.new([{ cask: cask_ref }])
end
requirements << dsl_reqs.macos if dsl_reqs.macos
requirements << X11Requirement.new if dsl_reqs.x11
requirements
end
......
......@@ -207,7 +207,8 @@ module Homebrew
end
end
def flag(*names, description: nil, replacement: nil, required_for: nil, depends_on: nil)
def flag(*names, description: nil, replacement: nil, required_for: nil,
depends_on: nil, hidden: false)
required, flag_type = if names.any? { |name| name.end_with? "=" }
[OptionParser::REQUIRED_ARGUMENT, :required_flag]
else
......@@ -216,7 +217,7 @@ module Homebrew
names.map! { |name| name.chomp "=" }
description = option_to_description(*names) if description.nil?
if replacement.nil?
process_option(*names, description, type: flag_type)
process_option(*names, description, type: flag_type, hidden: hidden)
else
description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})"
end
......@@ -396,42 +397,16 @@ module Homebrew
end
end
def max_named(count)
odeprecated "`max_named`", "`named_args max:`"
raise TypeError, "Unsupported type #{count.class.name} for max_named" unless count.is_a?(Integer)
@max_named_args = count
def max_named(_count)
odisabled "`max_named`", "`named_args max:`"
end
def min_named(count_or_type)
odeprecated "`min_named`", "`named_args min:`"
case count_or_type
when Integer
@min_named_args = count_or_type
@named_args_type = nil
when Symbol
@min_named_args = 1
@named_args_type = count_or_type
else
raise TypeError, "Unsupported type #{count_or_type.class.name} for min_named"
end
def min_named(_count_or_type)
odisabled "`min_named`", "`named_args min:`"
end
def named(count_or_type)
odeprecated "`named`", "`named_args`"
case count_or_type
when Integer
@max_named_args = @min_named_args = count_or_type
@named_args_type = nil
when Symbol
@max_named_args = @min_named_args = 1
@named_args_type = count_or_type
else
raise TypeError, "Unsupported type #{count_or_type.class.name} for named"
end
def named(_count_or_type)
odisabled "`named`", "`named_args`"
end
sig { void }
......@@ -619,7 +594,7 @@ module Homebrew
raise exception if exception
end
def process_option(*args, type:)
def process_option(*args, type:, hidden: false)
option, = @parser.make_switch(args)
@processed_options.reject! { |existing| existing.second == option.long.first } if option.long.first.present?
@processed_options << [option.short.first, option.long.first, option.arg, option.desc.first]
......
......@@ -44,8 +44,7 @@ module Homebrew
description: "Treat all named arguments as formulae.",
}],
[:flag, "--env=", {
description: "If `std` is passed, use the standard build environment instead of superenv. If `super` is " \
"passed, use superenv even if the formula specifies the standard build environment.",
description: "Disabled other than for internal Homebrew use.",
}],
[:switch, "--ignore-dependencies", {
description: "An unsupported Homebrew development flag to skip installing any dependencies of any kind. " \
......@@ -132,8 +131,10 @@ module Homebrew
args = install_args.parse
if args.env.present?
# TODO: use `replacement: false` for 3.1.0.
odeprecated "brew install --env", "`env :std` in specific formula files"
# Can't use `replacement: false` because `install_args` are used by
# `build.rb`. Instead, `hide_from_man_page` and don't do anything with
# this argument here.
odisabled "brew install --env", "`env :std` in specific formula files"
end
args.named.each do |name|
......@@ -406,7 +407,6 @@ module Homebrew
only_deps: args.only_dependencies?,
include_test_formulae: args.include_test_formulae,
build_from_source_formulae: args.build_from_source_formulae,
env: args.env,
cc: args.cc,
git: args.git?,
interactive: args.interactive?,
......
......@@ -34,16 +34,11 @@ module Homebrew
Perform a substring search of cask tokens and formula names for <text>. If <text>
is flanked by slashes, it is interpreted as a regular expression.
The search for <text> is extended online to `homebrew/core` and `homebrew/cask`.
If no <text> is provided, list all locally available formulae (including tapped ones).
No online search is performed.
EOS
switch "--formula", "--formulae",
description: "Without <text>, list all locally available formulae (no online search is performed). " \
"With <text>, search online and locally for formulae."
description: "Search online and locally for formulae."
switch "--cask", "--casks",
description: "Without <text>, list all locally available casks (including tapped ones, no online " \
"search is performed). With <text>, search online and locally for casks."
description: "Search online and locally for casks."
switch "--desc",
description: "Search for formulae with a description matching <text> and casks with "\
"a name matching <text>."
......@@ -65,8 +60,7 @@ module Homebrew
conflicts "--open", "--closed"
conflicts(*package_manager_switches)
# TODO: (3.1) add `min: 1` when the `odeprecated`/`odisabled` for `brew search` with no arguments is removed
named_args :text_or_regex
named_args :text_or_regex, min: 1
end
end
......@@ -79,19 +73,6 @@ module Homebrew
return
end
if args.no_named?
if args.cask?
raise UsageError, "specifying both --formula and --cask requires <text>" if args.formula?
puts Formatter.columns(Cask::Cask.to_a.map(&:full_name).sort)
else
odisabled "`brew search` with no arguments to output formulae", "`brew formulae`"
puts Formatter.columns(Formula.full_names.sort)
end
return
end
query = args.named.join(" ")
string_or_regex = query_regexp(query)
......@@ -140,7 +121,6 @@ module Homebrew
end
return unless $stdout.tty?
return if args.no_named?
metacharacters = %w[\\ | ( ) [ ] { } ^ $ * + ?].freeze
return unless metacharacters.any? do |char|
......
......@@ -17,7 +17,7 @@ class AbstractDownloadStrategy
rescue ArgumentError => e
raise unless e.message.include?("timeout")
odeprecated "`def _fetch` in a subclass of `CurlDownloadStrategy`"
odisabled "`def _fetch` in a subclass of `CurlDownloadStrategy`"
options.delete(:timeout)
super(*args, **options)
end
......@@ -27,9 +27,9 @@ class AbstractDownloadStrategy
class << self
def method_added(method)
if method == :fetch && instance_method(method).arity.zero?
odeprecated "`def fetch` in a subclass of `#{self}`",
"`def fetch(timeout: nil, **options)` and output a warning " \
"when `options` contains new unhandled options"
odisabled "`def fetch` in a subclass of `#{self}`",
"`def fetch(timeout: nil, **options)` and output a warning " \
"when `options` contains new unhandled options"
class_eval do
prepend CompatFetch
......
......@@ -123,9 +123,6 @@ class DependencyCollector
when :linux then LinuxRequirement.new(tags)
when :macos then MacOSRequirement.new(tags)
when :maximum_macos then MacOSRequirement.new(tags, comparator: "<=")
when :osxfuse then OsxfuseRequirement.new(tags)
when :tuntap then TuntapRequirement.new(tags)
when :x11 then X11Requirement.new(tags)
when :xcode then XcodeRequirement.new(tags)
else
raise ArgumentError, "Unsupported special dependency #{spec.inspect}"
......
......@@ -16,11 +16,6 @@ BOTTLE_ERB = <<-EOS
"#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}/bottles"].exclude?(root_url) %>
root_url "<%= root_url %>"
<% end %>
<% if ![HOMEBREW_DEFAULT_PREFIX,
HOMEBREW_MACOS_ARM_DEFAULT_PREFIX,
HOMEBREW_LINUX_DEFAULT_PREFIX].include?(prefix) %>
prefix "<%= prefix %>"
<% end %>
<% if rebuild.positive? %>
rebuild <%= rebuild %>
<% end %>
......@@ -471,19 +466,18 @@ module Homebrew
bottle = BottleSpecification.new
bottle.tap = tap
bottle.root_url(root_url) if root_url
if relocatable
bottle_cellar = if relocatable
if skip_relocation
bottle.cellar :any_skip_relocation
:any_skip_relocation
else
bottle.cellar :any
:any
end
else
bottle.cellar cellar
bottle.prefix prefix
cellar
end
bottle.rebuild rebuild
sha256 = bottle_path.sha256
bottle.sha256 sha256 => bottle_tag.to_sym
bottle.sha256 cellar: bottle_cellar, bottle_tag.to_sym => sha256
old_spec = f.bottle_specification
if args.keep_old? && !old_spec.checksums.empty?
......@@ -591,7 +585,6 @@ module Homebrew
bottle = BottleSpecification.new
bottle.root_url bottle_hash["bottle"]["root_url"]
bottle.prefix bottle_hash["bottle"]["prefix"]
bottle.rebuild bottle_hash["bottle"]["rebuild"]
bottle_hash["bottle"]["tags"].each do |tag, tag_hash|
cellar = tag_hash["cellar"]
......
......@@ -23,12 +23,16 @@ module Homebrew
description: "Upload to Bintray, but don't publish."
named_args :formula, min: 1
hide_from_man_page!
end
end
def mirror
args = mirror_args.parse
odeprecated "brew mirror"
bintray_org = args.bintray_org || "homebrew"
bintray_repo = args.bintray_repo || "mirror"
......
......@@ -32,37 +32,6 @@ module Homebrew
end
def release_notes
args = release_notes_args.parse
odeprecated "`brew release-notes`", "`brew release`"
previous_tag = args.named.first
if previous_tag.present?
most_recent_major_minor_tag = previous_tag.sub(/\d+$/, "0")
one_month_ago = Date.today << 1
previous_tag_date = Date.parse Utils.popen_read(
"git", "-C", HOMEBREW_REPOSITORY, "log", "-1", "--format=%aI", most_recent_major_minor_tag
)
opoo "The latest major/minor release was less than one month ago." if previous_tag_date > one_month_ago
end
previous_tag ||= Utils.popen_read(
"git", "-C", HOMEBREW_REPOSITORY, "tag", "--list", "--sort=-version:refname"
).lines.first.chomp
odie "Could not find any previous tags!" unless previous_tag
end_ref = args.named.second || "origin/master"
[previous_tag, end_ref].each do |ref|
next if quiet_system "git", "-C", HOMEBREW_REPOSITORY, "rev-parse", "--verify", "--quiet", ref
odie "Ref #{ref} does not exist!"
end
release_notes = ReleaseNotes.generate_release_notes previous_tag, end_ref, markdown: args.markdown?
$stderr.puts "Release notes between #{previous_tag} and #{end_ref}:"
puts release_notes
odisabled "`brew release-notes`", "`brew release`"
end
end
......@@ -241,31 +241,13 @@ module SharedEnvExtension
# @see https://bugs.python.org/issue6848
sig { void }
def ncurses_define
odeprecated "ENV.ncurses_define"
append "CPPFLAGS", "-DNCURSES_OPAQUE=0"
odisabled "ENV.ncurses_define"
end
# @private
sig { void }
def userpaths!
odeprecated "ENV.userpaths!"
path = PATH.new(self["PATH"]).select do |p|
# put Superenv.bin and opt path at the first
p.start_with?("#{HOMEBREW_REPOSITORY}/Library/ENV", "#{HOMEBREW_PREFIX}/opt")
end
path.append(HOMEBREW_PREFIX/"bin") # XXX hot fix to prefer brewed stuff (e.g. python) over /usr/bin.
path.append(self["PATH"]) # reset of self["PATH"]
path.append(
# user paths
ORIGINAL_PATHS.map do |p|
p.realpath.to_s
rescue
nil
end - %w[/usr/X11/bin /opt/X11/bin],
)
self["PATH"] = path
odisabled "ENV.userpaths!"
end
sig { void }
......@@ -347,7 +329,7 @@ module SharedEnvExtension
sig { void }
def permit_weak_imports
odeprecated "ENV.permit_weak_imports"
odisabled "ENV.permit_weak_imports"
end
# @private
......
......@@ -98,15 +98,6 @@ module Stdenv
old
end
%w[O3 O2 Os].each do |opt|
define_method opt do
odisabled "ENV.#{opt}"
send(:remove_from_cflags, /-O./)
send(:append_to_cflags, "-#{opt}")
end
end
%w[O1 O0].each do |opt|
define_method opt do
send(:remove_from_cflags, /-O./)
......@@ -147,38 +138,6 @@ module Stdenv
set_cpu_cflags(map)
end
sig { void }
def m64
odisabled "ENV.m64"
append_to_cflags "-m64"
append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}"
end
sig { void }
def m32
odisabled "ENV.m32"
append_to_cflags "-m32"
append "LDFLAGS", "-arch #{Hardware::CPU.arch_32_bit}"
end
sig { void }
def universal_binary
odisabled "ENV.universal_binary"
check_for_compiler_universal_support
append_to_cflags Hardware::CPU.universal_archs.as_arch_flags
append "LDFLAGS", Hardware::CPU.universal_archs.as_arch_flags
return if compiler_any_clang?
return unless Hardware::CPU.is_32_bit?
# 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")
end
sig { void }
def cxx11
append "CXX", "-std=c++11"
......@@ -190,13 +149,6 @@ module Stdenv
append "CXX", "-stdlib=libc++" if compiler == :clang
end
sig { void }
def libstdcxx
odisabled "ENV.libstdcxx"
append "CXX", "-stdlib=libstdc++" if compiler == :clang
end
# @private
sig { params(before: Regexp, after: String).void }
def replace_in_cflags(before, after)
......@@ -226,11 +178,6 @@ module Stdenv
append flags, map.fetch(effective_arch)
end
sig { void }
def x11
odisabled "ENV.x11", "depends_on specific X11 formula(e)"
end
# @private
sig { params(map: T::Hash[Symbol, String]).void }
def set_cpu_cflags(map = Hardware::CPU.optimization_flags) # rubocop:disable Naming/AccessorMethodName
......
......@@ -293,34 +293,11 @@ module Superenv
[Regexp.last_match(1).to_i, 1].max
end
sig { void }
def universal_binary
odisabled "ENV.universal_binary"
check_for_compiler_universal_support
self["HOMEBREW_ARCHFLAGS"] = Hardware::CPU.universal_archs.as_arch_flags
end
sig { void }
def permit_arch_flags
append_to_cccfg "K"
end
sig { void }
def m32
odisabled "ENV.m32"
append "HOMEBREW_ARCHFLAGS", "-m32"
end
sig { void }
def m64
odisabled "ENV.m64"
append "HOMEBREW_ARCHFLAGS", "-m64"
end
sig { void }
def cxx11
append_to_cccfg "x"
......@@ -332,37 +309,17 @@ module Superenv
append_to_cccfg "g" if compiler == :clang
end
sig { void }
def libstdcxx
odisabled "ENV.libstdcxx"
append_to_cccfg "h" if compiler == :clang
end
# @private
sig { void }
def refurbish_args
append_to_cccfg "O"
end
%w[O3 O2 Os].each do |opt|
define_method opt do
odisabled "ENV.#{opt}"
send(:[]=, "HOMEBREW_OPTIMIZATION_LEVEL", opt)
end
end
%w[O1 O0].each do |opt|
define_method opt do
send(:[]=, "HOMEBREW_OPTIMIZATION_LEVEL", opt)
end
end
sig { void }
def set_x11_env_if_installed
odisabled "ENV.set_x11_env_if_installed"
end
end
require "extend/os/extend/ENV/super"
# typed: false
# frozen_string_literal: true
require "requirement"
class OsxfuseRequirement < Requirement
extend T::Sig
def initialize(tags = [])
odisabled "depends_on :osxfuse", 'on_linux do; depends_on "libfuse"; end'
super(tags)
end
download "https://github.com/libfuse/libfuse"
satisfy(build_env: false) do
next true if libfuse_formula_exists? && Formula["libfuse"].latest_version_installed?
includedirs = %w[
/usr/include
/usr/local/include
]
next true if (includedirs.map do |dir|
File.exist? "#{dir}/fuse.h"
end).any?
false
end
sig { returns(String) }
def message
msg = "libfuse is required for this software.\n"
if libfuse_formula_exists?
<<~EOS
#{msg}Run `brew install libfuse` to install it.
EOS
else