Handle 2.2.0 deprecations/disableds

- Make all `odeprecated` from 2.1.0 `odisabled` instead
- Remove dead code that won't be run now
- Remove (unused) `or_later` handling for bottles
This commit is contained in:
Mike McQuaid 2019-11-06 14:31:03 +00:00
parent e80008d6de
commit 176297d361
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
11 changed files with 23 additions and 83 deletions

View File

@ -7,29 +7,12 @@ module Homebrew
def tap_pin_args def tap_pin_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`tap-pin` <tap>
Pin <tap>, prioritising its formulae over core when formula names are supplied
by the user. See also `tap-unpin`.
EOS
switch :debug
hide_from_man_page! hide_from_man_page!
end end
end end
def tap_pin def tap_pin
odeprecated "brew tap-pin user/tap", odisabled "brew tap-pin user/tap",
"fully-scoped user/tap/formula naming" "fully-scoped user/tap/formula naming"
tap_pin_args.parse
ARGV.named.each do |name|
tap = Tap.fetch(name)
raise "pinning #{tap} is not allowed" if tap.core_tap?
tap.pin
ohai "Pinned #{tap}"
end
end end
end end

View File

@ -7,28 +7,12 @@ module Homebrew
def tap_unpin_args def tap_unpin_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`tap-unpin` <tap>
Unpin <tap> so its formulae are no longer prioritised. See also `tap-pin`.
EOS
switch :debug
hide_from_man_page! hide_from_man_page!
end end
end end
def tap_unpin def tap_unpin
odeprecated "brew tap-pin user/tap", odisabled "brew tap-pin user/tap",
"fully-scoped user/tap/formula naming" "fully-scoped user/tap/formula naming"
tap_unpin_args.parse
ARGV.named.each do |name|
tap = Tap.fetch(name)
raise "unpinning #{tap} is not allowed" if tap.core_tap?
tap.unpin
ohai "Unpinned #{tap}"
end
end end
end end

View File

@ -5,18 +5,15 @@ module Cask
class Version < ::String class Version < ::String
module Compat module Compat
def dots_to_slashes def dots_to_slashes
odeprecated "#dots_to_slashes" odisabled "#dots_to_slashes"
version { tr(".", "/") }
end end
def hyphens_to_slashes def hyphens_to_slashes
odeprecated "#hyphens_to_slashes" odisabled "#hyphens_to_slashes"
version { tr("-", "/") }
end end
def underscores_to_slashes def underscores_to_slashes
odeprecated "#underscores_to_slashes" odisabled "#underscores_to_slashes"
version { tr("_", "/") }
end end
end end

View File

@ -11,9 +11,8 @@ class MacOSRequirement < Requirement
sym = MacOS::Version.new(v).to_sym sym = MacOS::Version.new(v).to_sym
odeprecated "depends_on macos: #{v.inspect}", "depends_on macos: #{sym.inspect}", odisabled "depends_on macos: #{v.inspect}",
disable_on: Time.parse("2019-10-15") "depends_on macos: #{sym.inspect}"
sym sym
end end
@ -22,8 +21,8 @@ class MacOSRequirement < Requirement
v, *rest = tags v, *rest = tags
sym = MacOS::Version.new(v).to_sym sym = MacOS::Version.new(v).to_sym
odeprecated "depends_on macos: #{v.inspect}", "depends_on macos: #{sym.inspect}", odisabled "depends_on macos: #{v.inspect}",
disable_on: Time.parse("2019-10-15") "depends_on macos: #{sym.inspect}"
tags = [sym, *rest] tags = [sym, *rest]
end end

View File

@ -28,7 +28,7 @@ BOTTLE_ERB = <<-EOS
<% checksums.each do |checksum_type, checksum_values| %> <% checksums.each do |checksum_type, checksum_values| %>
<% checksum_values.each do |checksum_value| %> <% checksum_values.each do |checksum_value| %>
<% checksum, macos = checksum_value.shift %> <% checksum, macos = checksum_value.shift %>
<%= checksum_type %> "<%= checksum %>" => :<%= macos %><%= "_or_later" if Homebrew.args.or_later? %> <%= checksum_type %> "<%= checksum %>" => :<%= macos %>
<% end %> <% end %>
<% end %> <% end %>
end end
@ -52,8 +52,6 @@ module Homebrew
EOS EOS
switch "--skip-relocation", switch "--skip-relocation",
description: "Do not check if the bottle can be marked as relocatable." description: "Do not check if the bottle can be marked as relocatable."
switch "--or-later",
description: "Append `_or_later` to the bottle tag."
switch "--force-core-tap", switch "--force-core-tap",
description: "Build a bottle even if <formula> is not in `homebrew/core` or any installed taps." description: "Build a bottle even if <formula> is not in `homebrew/core` or any installed taps."
switch "--no-rebuild", switch "--no-rebuild",
@ -396,8 +394,6 @@ module Homebrew
return unless args.json? return unless args.json?
tag = Utils::Bottles.tag.to_s
tag += "_or_later" if args.or_later?
json = { json = {
f.full_name => { f.full_name => {
"formula" => { "formula" => {
@ -410,7 +406,7 @@ module Homebrew
"cellar" => bottle.cellar.to_s, "cellar" => bottle.cellar.to_s,
"rebuild" => bottle.rebuild, "rebuild" => bottle.rebuild,
"tags" => { "tags" => {
tag => { Utils::Bottles.tag.to_s => {
"filename" => filename.bintray, "filename" => filename.bintray,
"local_filename" => filename.to_s, "local_filename" => filename.to_s,
"sha256" => sha256, "sha256" => sha256,

View File

@ -25,27 +25,20 @@ module Utils
end end
end end
def tag_without_or_later(tag)
tag
end
# Find a bottle built for a previous version of macOS. # Find a bottle built for a previous version of macOS.
def find_older_compatible_tag(tag) def find_older_compatible_tag(tag)
begin tag_version = begin
tag_version = MacOS::Version.from_symbol(tag) MacOS::Version.from_symbol(tag)
rescue ArgumentError rescue ArgumentError
return return
end end
keys.find do |key| keys.find do |key|
key_tag_version = tag_without_or_later(key) MacOS::Version.from_symbol(key) <= tag_version
begin
MacOS::Version.from_symbol(key_tag_version) <= tag_version
rescue ArgumentError rescue ArgumentError
false false
end end
end end
end end
end end
end
end end

View File

@ -490,14 +490,8 @@ module Formulary
if possible_pinned_tap_formulae.size == 1 if possible_pinned_tap_formulae.size == 1
selected_formula = factory(possible_pinned_tap_formulae.first, spec) selected_formula = factory(possible_pinned_tap_formulae.first, spec)
if core_path(ref).file? if core_path(ref).file?
odeprecated "brew tap-pin user/tap", odisabled "brew tap-pin user/tap",
"fully-scoped user/tap/formula naming" "fully-scoped user/tap/formula naming"
opoo <<~EOS
#{ref} is provided by core, but is now shadowed by #{selected_formula.full_name}.
This behaviour is deprecated and will be removed in Homebrew 2.2.0.
To refer to the core formula, use Homebrew/core/#{ref} instead.
To refer to the tap formula, use #{selected_formula.full_name} instead.
EOS
end end
selected_formula selected_formula
else else

View File

@ -261,7 +261,7 @@ class Bottle
def initialize(name, version, tag, rebuild) def initialize(name, version, tag, rebuild)
@name = File.basename name @name = File.basename name
@version = version @version = version
@tag = tag.to_s.gsub(/_or_later$/, "") @tag = tag.to_s
@rebuild = rebuild @rebuild = rebuild
end end

View File

@ -717,8 +717,6 @@ at its original value, while `--no-rebuild` will remove it.
* `--skip-relocation`: * `--skip-relocation`:
Do not check if the bottle can be marked as relocatable. Do not check if the bottle can be marked as relocatable.
* `--or-later`:
Append `_or_later` to the bottle tag.
* `--force-core-tap`: * `--force-core-tap`:
Build a bottle even if *`formula`* is not in `homebrew/core` or any installed taps. Build a bottle even if *`formula`* is not in `homebrew/core` or any installed taps.
* `--no-rebuild`: * `--no-rebuild`:

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW\-CASK" "1" "October 2019" "Homebrew" "brew-cask" .TH "BREW\-CASK" "1" "November 2019" "Homebrew" "brew-cask"
. .
.SH "NAME" .SH "NAME"
\fBbrew\-cask\fR \- a friendly binary installer for macOS \fBbrew\-cask\fR \- a friendly binary installer for macOS

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW" "1" "October 2019" "Homebrew" "brew" .TH "BREW" "1" "November 2019" "Homebrew" "brew"
. .
.SH "NAME" .SH "NAME"
\fBbrew\fR \- The missing package manager for macOS \fBbrew\fR \- The missing package manager for macOS
@ -898,10 +898,6 @@ Generate a bottle (binary package) from a formula that was installed with \fB\-\
Do not check if the bottle can be marked as relocatable\. Do not check if the bottle can be marked as relocatable\.
. .
.TP .TP
\fB\-\-or\-later\fR
Append \fB_or_later\fR to the bottle tag\.
.
.TP
\fB\-\-force\-core\-tap\fR \fB\-\-force\-core\-tap\fR
Build a bottle even if \fIformula\fR is not in \fBhomebrew/core\fR or any installed taps\. Build a bottle even if \fIformula\fR is not in \fBhomebrew/core\fR or any installed taps\.
. .