Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate, disable & delete code for Homebrew 4.2.0 #16306

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions Library/Homebrew/cask/cask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ class Cask

attr_predicate :loaded_from_api?

# @api private
def self.all
# TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser
# TODO: replace this ARGV and ENV logic with an argument, like how we do with formulae
if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all?
odisabled "Cask::Cask#all without --eval-all or HOMEBREW_EVAL_ALL"
raise ArgumentError, "Cask::Cask#all cannot be used without --eval-all or HOMEBREW_EVAL_ALL"
end

Tap.flat_map(&:cask_files).map do |f|
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def version
.returns(Pathname)
}
def fetch(quiet: nil, verify_download_integrity: true, timeout: nil)
downloader.shutup! if quiet
downloader.quiet! if quiet

begin
super(verify_download_integrity: false, timeout: timeout)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
# @api public
def appcast(*args, **kwargs)
set_unique_stanza(:appcast, args.empty? && kwargs.empty?) do
odeprecated "the `appcast` stanza", "the `livecheck` stanza"
odisabled "the `appcast` stanza", "the `livecheck` stanza"

Check warning on line 214 in Library/Homebrew/cask/dsl.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/dsl.rb#L214

Added line #L214 was not covered by tests
true
end
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/dsl/postflight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
include Staged

def suppress_move_to_applications(_options = {})
odeprecated "Cask::DSL#suppress_move_to_applications"
odisabled "Cask::DSL#suppress_move_to_applications"

Check warning on line 15 in Library/Homebrew/cask/dsl/postflight.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/dsl/postflight.rb#L15

Added line #L15 was not covered by tests
end
end
end
Expand Down
16 changes: 4 additions & 12 deletions Library/Homebrew/caveats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,26 +159,18 @@ def service_caveats

s = []

command = if formula.service.command?
formula.service.manual_command
else
formula.plist_manual
end

return <<~EOS if !Utils::Service.launchctl? && formula.plist
#{Formatter.warning("Warning:")} #{formula.name} provides a launchd plist which can only be used on macOS!
You can manually execute the service instead with:
#{command}
EOS

# Brew services only works with these two tools
return <<~EOS if !Utils::Service.systemctl? && !Utils::Service.launchctl? && formula.service.command?
#{Formatter.warning("Warning:")} #{formula.name} provides a service which can only be used on macOS or systemd!
You can manually execute the service instead with:
#{command}
#{formula.service.manual_command}
EOS

startup = formula.service.requires_root? || formula.plist_startup
startup = formula.service.requires_root?
if Utils::Service.running?(formula)
s << "To restart #{formula.full_name} after an upgrade:"
s << " #{startup ? "sudo " : ""}brew services restart #{formula.full_name}"
Expand All @@ -190,9 +182,9 @@ def service_caveats
s << " brew services start #{formula.full_name}"
end

if formula.plist_manual || formula.service.command?
if formula.service.command?
s << "Or, if you don't want/need a background service you can just run:"
s << " #{command}"
s << " #{formula.service.manual_command}"
end

# pbpaste is the system clipboard tool on macOS and fails with `tmux` by default
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/cmd/postgresql-upgrade-database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
def postgresql_upgrade_database
postgresql_upgrade_database_args.parse

odeprecated "brew postgresql_upgrade_database",
"using new, versioned e.g. `var/postgres@14` datadir and `pg_upgrade`"
odisabled "brew postgresql_upgrade_database",

Check warning on line 27 in Library/Homebrew/cmd/postgresql-upgrade-database.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/postgresql-upgrade-database.rb#L27

Added line #L27 was not covered by tests
"using new, versioned e.g. `var/postgres@14` datadir and `pg_upgrade`"

name = "postgresql"
pg = Formula[name]
Expand Down
31 changes: 11 additions & 20 deletions Library/Homebrew/dev-cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,15 @@ def self.audit_args
"for Homebrew. This should be used when creating new formulae or casks and implies " \
"`--strict` and `--online`."
switch "--new-formula",
# odeprecated: uncomment `replacement` to enable the `odeprecated` handling in `CLI::Parser`
# replacement: "--new",
# odeprecated: remove `args.new_formula?` calls once this is `true`
disable: false,
hidden: true
replacement: "--new",
# odeprecated: change this to true on disable and remove `args.new_formula?` calls
disable: false,
hidden: true
switch "--new-cask",
# odeprecated: uncomment `replacement` to enable the `odeprecated` handling in `CLI::Parser`
# replacement: "--new",
# odeprecated: remove `args.new_cask?` calls once this is `true`
disable: false,
hidden: true
replacement: "--new",
# odeprecated: change this to true on disable and remove `args.new_formula?` calls
disable: false,
hidden: true
switch "--[no-]signing",
description: "Audit for signed apps, which are required on ARM"
switch "--token-conflicts",
Expand All @@ -74,9 +72,6 @@ def self.audit_args
switch "--display-filename",
description: "Prefix every line of output with the file or formula name being audited, to " \
"make output easy to grep."
switch "--display-failures-only",
description: "Only display casks that fail the audit. This is the default for formulae and casks.",
hidden: true
switch "--skip-style",
description: "Skip running non-RuboCop style checks. Useful if you plan on running " \
"`brew style` separately. Enabled by default unless a formula is specified by name."
Expand Down Expand Up @@ -153,6 +148,8 @@ def self.audit
[Formula.all(eval_all: args.eval_all?), Cask::Cask.all]
else
if args.named.any? { |named_arg| named_arg.end_with?(".rb") }
# This odisabled should probably stick around indefinitely,
# until at least we have a way to exclude error on these in the CLI parser.
odisabled "brew audit [path ...]",
"brew audit [name ...]"
end
Expand Down Expand Up @@ -247,13 +244,7 @@ def self.audit
problems[[f.full_name, path]] = errors if errors.any?
end

if audit_casks.any?
require "cask/auditor"

if args.display_failures_only?
odisabled "`brew audit <cask> --display-failures-only`", "`brew audit <cask>` without the argument"
end
end
require "cask/auditor" if audit_casks.any?

cask_problems = audit_casks.each_with_object({}) do |cask, problems|
path = cask.sourcefile_path
Expand Down
3 changes: 2 additions & 1 deletion Library/Homebrew/dev-cmd/bump-cask-pr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def bump_cask_pr_args
def bump_cask_pr
args = bump_cask_pr_args.parse

# odeprecated "brew bump-cask-pr --online" if args.online?
odeprecated "brew bump-cask-pr --online" if args.online?

# This will be run by `brew audit` or `brew style` later so run it first to
# not start spamming during normal output.
gem_groups = []
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/livecheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def watchlist_path
unless File.exist?(watchlist)
previous_default_watchlist = File.expand_path("~/.brew_livecheck_watchlist")
if File.exist?(previous_default_watchlist)
odeprecated "~/.brew_livecheck_watchlist", "~/.homebrew/livecheck_watchlist.txt"
odisabled "~/.brew_livecheck_watchlist", "~/.homebrew/livecheck_watchlist.txt"
watchlist = previous_default_watchlist
end
end
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/dev-cmd/pr-automerge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def pr_automerge_args
"in the pull request to the preferred format."
switch "--no-autosquash",
description: "Instruct `brew pr-publish` to skip automatically reformatting and rewording commits " \
"in the pull request to the preferred format."
"in the pull request to the preferred format.",
disable: true, # odisabled: remove this switch with 4.3.0
hidden: true
switch "--ignore-failures",
description: "Include pull requests that have failing status checks."

Expand All @@ -43,8 +45,6 @@ def pr_automerge_args
def pr_automerge
args = pr_automerge_args.parse

odeprecated "`brew pr-publish --no-autosquash`" if args.no_autosquash?

without_labels = args.without_labels || [
"do not merge",
"new formula",
Expand Down
5 changes: 0 additions & 5 deletions Library/Homebrew/dev-cmd/pr-publish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ def pr_publish_args
switch "--autosquash",
description: "If supported on the target tap, automatically reformat and reword commits " \
"to our preferred format."
switch "--no-autosquash",
description: "Skip automatically reformatting and rewording commits in the pull request " \
"to the preferred format, even if supported on the target tap."
switch "--large-runner",
description: "Run the upload job on a large runner."
flag "--branch=",
Expand All @@ -39,8 +36,6 @@ def pr_publish_args
def pr_publish
args = pr_publish_args.parse

odisabled "`brew pr-publish --no-autosquash`" if args.no_autosquash?

tap = Tap.fetch(args.tap || CoreTap.instance.name)
workflow = args.workflow || "publish-commit-bottles.yml"
ref = args.branch || "master"
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/dev-cmd/pr-pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def self.pr_pull_args
"preferred format."
switch "--no-autosquash",
description: "Skip automatically reformatting and rewording commits in the pull request to our " \
"preferred format."
"preferred format.",
disable: true, # odisabled: remove this switch with 4.3.0
hidden: true
switch "--branch-okay",
description: "Do not warn if pulling to a branch besides the repository default (useful for testing)."
switch "--resolve",
Expand Down Expand Up @@ -406,8 +408,6 @@ def self.pr_check_conflicts(repo, pull_request)
def self.pr_pull
args = pr_pull_args.parse

odeprecated "`brew pr-pull --no-autosquash`" if args.no_autosquash?

# Needed when extracting the CI artifact.
ensure_executable!("unzip", reason: "extracting CI artifacts")

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
# @api private
sig { void }
def shutup!
# odeprecated "AbstractDownloadStrategy#shutup!", "AbstractDownloadStrategy#quiet!"
odeprecated "AbstractDownloadStrategy#shutup!", "AbstractDownloadStrategy#quiet!"

Check warning on line 89 in Library/Homebrew/download_strategy.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/download_strategy.rb#L89

Added line #L89 was not covered by tests
quiet!
end

Expand Down
18 changes: 0 additions & 18 deletions Library/Homebrew/extend/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,6 @@ def exec_browser(*args)
end
end

# GZips the given paths, and returns the gzipped paths.
def gzip(*paths)
odisabled "Utils.gzip", "Utils::Gzip.compress"
Utils::Gzip.compress(*paths)
end

def ignore_interrupts(_opt = nil)
# rubocop:disable Style/GlobalVars
$ignore_interrupts_nesting_level = 0 unless defined?($ignore_interrupts_nesting_level)
Expand Down Expand Up @@ -502,18 +496,6 @@ def with_env(hash)
end
end

sig { returns(String) }
def preferred_shell
odisabled "preferred_shell"
Utils::Shell.preferred_path(default: "/bin/sh")
end

sig { returns(String) }
def shell_profile
odisabled "shell_profile"
Utils::Shell.profile
end

def tap_and_name_comparison
proc do |a, b|
if a.include?("/") && b.exclude?("/")
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Tap
def self.install_default_cask_tap_if_necessary(force: false)
odeprecated "Tap.install_default_cask_tap_if_necessary", "CoreCaskTap.ensure_installed!"
odisabled "Tap.install_default_cask_tap_if_necessary", "CoreCaskTap.ensure_installed!"

Check warning on line 6 in Library/Homebrew/extend/os/mac/tap.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/extend/os/mac/tap.rb#L6

Added line #L6 was not covered by tests

cask_tap = CoreCaskTap.instance
return false if cask_tap.installed?
Expand Down