Homebrew 4.3.0 deprecation/disable/removals.

The usual pass of deprecating/disabling/removing code for the next
minor Homebrew release.
This commit is contained in:
Mike McQuaid 2024-05-07 12:01:26 +01:00
parent 621dce827e
commit 222fe8ef0b
No known key found for this signature in database
50 changed files with 79 additions and 734 deletions

View File

@ -112,7 +112,6 @@ Layout/LineLength:
' url "', ' url "',
' mirror "', ' mirror "',
" plist_options ", " plist_options ",
' appcast "',
' executable: "', ' executable: "',
' font "', ' font "',
' homepage "', ' homepage "',

View File

@ -289,7 +289,7 @@ module Cask
sig { params(livecheck_result: T.any(NilClass, T::Boolean, Symbol)).void } sig { params(livecheck_result: T.any(NilClass, T::Boolean, Symbol)).void }
def audit_hosting_with_livecheck(livecheck_result: audit_livecheck_version) def audit_hosting_with_livecheck(livecheck_result: audit_livecheck_version)
return if cask.discontinued? || cask.deprecated? || cask.disabled? return if cask.deprecated? || cask.disabled?
return if cask.version&.latest? return if cask.version&.latest?
return unless cask.url return unless cask.url
return if block_url_offline? return if block_url_offline?
@ -682,7 +682,7 @@ module Cask
sig { void } sig { void }
def audit_github_repository_archived def audit_github_repository_archived
# Deprecated/disabled casks may have an archived repository. # Deprecated/disabled casks may have an archived repository.
return if cask.discontinued? || cask.deprecated? || cask.disabled? return if cask.deprecated? || cask.disabled?
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if online? user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if online?
return if user.nil? return if user.nil?
@ -696,7 +696,7 @@ module Cask
sig { void } sig { void }
def audit_gitlab_repository_archived def audit_gitlab_repository_archived
# Deprecated/disabled casks may have an archived repository. # Deprecated/disabled casks may have an archived repository.
return if cask.discontinued? || cask.deprecated? || cask.disabled? return if cask.deprecated? || cask.disabled?
user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*}) if online? user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*}) if online?
return if user.nil? return if user.nil?

View File

@ -352,7 +352,6 @@ module Cask
"homepage" => homepage, "homepage" => homepage,
"url" => url, "url" => url,
"url_specs" => url_specs, "url_specs" => url_specs,
"appcast" => appcast,
"version" => version, "version" => version,
"installed" => installed_version, "installed" => installed_version,
"installed_time" => install_time&.to_i, "installed_time" => install_time&.to_i,

View File

@ -2,8 +2,6 @@
module Cask module Cask
class Cask class Cask
def appcast; end
def appdir; end def appdir; end
def artifacts; end def artifacts; end

View File

@ -315,7 +315,6 @@ module Cask
end end
url json_cask[:url], **json_cask.fetch(:url_specs, {}) if json_cask[:url].present? url json_cask[:url], **json_cask.fetch(:url_specs, {}) if json_cask[:url].present?
appcast json_cask[:appcast] if json_cask[:appcast].present?
json_cask[:name]&.each do |cask_name| json_cask[:name]&.each do |cask_name|
name cask_name name cask_name
end end

View File

@ -248,16 +248,6 @@ module Cask
end end
end end
# Sets the cask's appcast URL.
#
# @api public
def appcast(*args, **kwargs)
set_unique_stanza(:appcast, args.empty? && kwargs.empty?) do
odisabled "the `appcast` stanza", "the `livecheck` stanza"
true
end
end
# Sets the cask's container type or nested container path. # Sets the cask's container type or nested container path.
# #
# ### Examples # ### Examples
@ -417,7 +407,7 @@ module Cask
end end
def discontinued? def discontinued?
# odeprecated "`discontinued?`", "`deprecated?` or `disabled?`" odeprecated "`discontinued?`", "`deprecated?` or `disabled?`"
@caveats&.discontinued? == true @caveats&.discontinued? == true
end end

View File

@ -164,7 +164,7 @@ module Cask
end end
caveat :discontinued do caveat :discontinued do
# odeprecated "`caveats :discontinued`", "`deprecate!`" odeprecated "`caveats :discontinued`", "`deprecate!`"
@discontinued = true @discontinued = true
<<~EOS <<~EOS
#{@cask} has been officially discontinued upstream. #{@cask} has been officially discontinued upstream.

View File

@ -8,10 +8,6 @@ module Cask
# Class corresponding to the `postflight` stanza. # Class corresponding to the `postflight` stanza.
class Postflight < Base class Postflight < Base
include Staged include Staged
def suppress_move_to_applications(**_options)
odisabled "`Cask::DSL::Postflight#suppress_move_to_applications`"
end
end end
end end
end end

View File

@ -152,15 +152,11 @@ class Caveats
end end
def service_caveats def service_caveats
return if !formula.plist && !formula.service? && !Utils::Service.installed?(formula) && !keg&.plist_installed? return if !formula.service? && !Utils::Service.installed?(formula) && !keg&.plist_installed?
return if formula.service? && !formula.service.command? && !Utils::Service.installed?(formula) return if formula.service? && !formula.service.command? && !Utils::Service.installed?(formula)
s = [] s = []
return <<~EOS if !Utils::Service.launchctl? && formula.plist
#{Formatter.warning("Warning:")} #{formula.name} provides a launchd plist which can only be used on macOS!
EOS
# Brew services only works with these two tools # Brew services only works with these two tools
return <<~EOS if !Utils::Service.systemctl? && !Utils::Service.launchctl? && formula.service.command? 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! #{Formatter.warning("Warning:")} #{formula.name} provides a service which can only be used on macOS or systemd!

View File

@ -1,169 +0,0 @@
# typed: strict
# frozen_string_literal: true
require "abstract_command"
require "formula"
module Homebrew
module Cmd
class PostgresqlUpgradeDatabase < AbstractCommand
cmd_args do
description <<~EOS
Upgrades the database for the `postgresql` formula.
EOS
named_args :none
hide_from_man_page!
end
sig { override.void }
def run
odisabled "brew postgresql_upgrade_database",
"using new, versioned e.g. `var/postgres@14` datadir and `pg_upgrade`"
name = "postgresql"
pg = Formula[name]
bin = pg.bin
var = pg.var
version = pg.version
pg_version_file = var/"postgres/PG_VERSION"
pg_version_installed = version.to_s[/^\d+/]
pg_version_data = pg_version_file.read.chomp
if pg_version_installed == pg_version_data
odie <<~EOS
#{name} data already upgraded!
EOS
end
datadir = var/"postgres"
old_datadir = var/"postgres.old"
if old_datadir.exist?
odie <<~EOS
#{old_datadir} already exists!
Remove it if you want to upgrade data automatically.
EOS
end
old_pg_name = "#{name}@#{pg_version_data}"
old_pg_glob = "#{HOMEBREW_CELLAR}/#{old_pg_name}/#{pg_version_data}.*/bin"
old_bin = Pathname.glob(old_pg_glob).first
old_bin ||= begin
Formula[old_pg_name]
ohai "brew install #{old_pg_name}"
system HOMEBREW_BREW_FILE, "install", old_pg_name
Pathname.glob(old_pg_glob).first
rescue FormulaUnavailableError
nil
end
odie "No #{name} #{pg_version_data}.* version installed!" unless old_bin
server_stopped = T.let(false, T::Boolean)
moved_data = T.let(false, T::Boolean)
initdb_run = T.let(false, T::Boolean)
upgraded = T.let(false, T::Boolean)
begin
# Following instructions from:
# https://www.postgresql.org/docs/10/static/pgupgrade.html
ohai "Upgrading #{name} data from #{pg_version_data} to #{pg_version_installed}..."
services_json_output = Utils.popen_read(HOMEBREW_BREW_FILE, "services", "info", "--all", "--json")
services_json = JSON.parse(services_json_output)
loaded_service_names = services_json.select { |sj| sj[:loaded] }.map { |sj| sj[:name] }
if loaded_service_names.include?(name)
system HOMEBREW_BREW_FILE, "services", "stop", name
service_stopped = true
elsif quiet_system "#{bin}/pg_ctl", "-D", datadir, "status"
system "#{bin}/pg_ctl", "-D", datadir, "stop"
server_stopped = true
end
# Shut down old server if it is up via brew services
system HOMEBREW_BREW_FILE, "services", "stop", old_pg_name if loaded_service_names.include?(old_pg_name)
# get 'lc_collate' from old DB"
unless quiet_system "#{old_bin}/pg_ctl", "-w", "-D", datadir, "status"
system "#{old_bin}/pg_ctl", "-w", "-D", datadir, "start"
end
initdb_args = T.let([], T::Array[String])
locale_settings = %w[
lc_collate
lc_ctype
lc_messages
lc_monetary
lc_numeric
lc_time
server_encoding
]
locale_settings.each do |setting|
sql = "SELECT setting FROM pg_settings WHERE name LIKE '#{setting}';"
value = Utils.popen_read("#{old_bin}/psql", "postgres", "-qtAX", "-U", ENV.fetch("USER"), "-c",
sql).strip
next if value.empty?
initdb_args += if setting == "server_encoding"
["-E #{value}"]
else
["--#{setting.tr("_", "-")}=#{value}"]
end
end
if quiet_system "#{old_bin}/pg_ctl", "-w", "-D", datadir, "status"
system "#{old_bin}/pg_ctl", "-w", "-D", datadir, "stop"
end
ohai "Moving #{name} data from #{datadir} to #{old_datadir}..."
FileUtils.mv datadir, old_datadir
moved_data = true
(var/"postgres").mkpath
ohai "Creating database..."
safe_system "#{bin}/initdb", *initdb_args, "#{var}/postgres"
initdb_run = true
ohai "Migrating and upgrading data..."
(var/"log").cd do
safe_system "#{bin}/pg_upgrade",
"-r",
"-b", old_bin,
"-B", bin,
"-d", old_datadir,
"-D", datadir,
"-j", Hardware::CPU.cores.to_s
end
upgraded = true
ohai "Upgraded #{name} data from #{pg_version_data} to #{pg_version_installed}!"
ohai "Your #{name} #{pg_version_data} data remains at #{old_datadir}"
ensure
if upgraded
if server_stopped
safe_system "#{bin}/pg_ctl", "-D", datadir, "start"
elsif service_stopped
safe_system HOMEBREW_BREW_FILE, "services", "start", name
end
else
onoe "Upgrading #{name} data from #{pg_version_data} to #{pg_version_installed} failed!"
if initdb_run
ohai "Removing empty #{name} initdb database..."
FileUtils.rm_r datadir
end
if moved_data
ohai "Moving #{name} data back from #{old_datadir} to #{datadir}..."
FileUtils.mv old_datadir, datadir
end
if server_stopped
system "#{bin}/pg_ctl", "-D", datadir, "start"
elsif service_stopped
system HOMEBREW_BREW_FILE, "services", "start", name
end
end
end
end
end
end
end

View File

@ -754,52 +754,20 @@ class ReporterHub
end end
def dump(auto_update: false) def dump(auto_update: false)
report_all = ENV["HOMEBREW_UPDATE_REPORT_ALL_FORMULAE"].present?
if report_all && !Homebrew::EnvConfig.no_install_from_api?
odisabled "`HOMEBREW_UPDATE_REPORT_ALL_FORMULAE`"
opoo "This will not report all formulae because Homebrew cannot get this data from the API."
report_all = false
end
unless Homebrew::EnvConfig.no_update_report_new? unless Homebrew::EnvConfig.no_update_report_new?
dump_new_formula_report dump_new_formula_report
dump_new_cask_report dump_new_cask_report
end end
if report_all dump_deleted_formula_report
dump_renamed_formula_report dump_deleted_cask_report
dump_renamed_cask_report
outdated_formulae = Formula.installed.select(&:outdated?).map(&:name)
outdated_casks = Cask::Caskroom.casks.select(&:outdated?).map(&:token)
unless auto_update
output_dump_formula_or_cask_report "Outdated Formulae", outdated_formulae
output_dump_formula_or_cask_report "Outdated Casks", outdated_casks
end end
dump_deleted_formula_report(report_all)
dump_deleted_cask_report(report_all)
outdated_formulae = []
outdated_casks = []
if report_all
if auto_update
if (changed_formulae = select_formula_or_cask(:M).count) && changed_formulae.positive?
ohai "Modified Formulae",
"Modified #{Utils.pluralize("formula", changed_formulae, plural: "e", include_count: true)}."
end
if (changed_casks = select_formula_or_cask(:MC).count) && changed_casks.positive?
ohai "Modified Casks", "Modified #{Utils.pluralize("cask", changed_casks, include_count: true)}."
end
else
dump_modified_formula_report
dump_modified_cask_report
end
else
outdated_formulae = Formula.installed.select(&:outdated?).map(&:name)
outdated_casks = Cask::Caskroom.casks.select(&:outdated?).map(&:token)
unless auto_update
output_dump_formula_or_cask_report "Outdated Formulae", outdated_formulae
output_dump_formula_or_cask_report "Outdated Casks", outdated_casks
end
end
return if outdated_formulae.blank? && outdated_casks.blank? return if outdated_formulae.blank? && outdated_casks.blank?
outdated_formulae = outdated_formulae.count outdated_formulae = outdated_formulae.count
@ -853,92 +821,21 @@ class ReporterHub
output_dump_formula_or_cask_report "New Casks", casks output_dump_formula_or_cask_report "New Casks", casks
end end
def dump_renamed_formula_report def dump_deleted_formula_report
formulae = select_formula_or_cask(:R).sort.map do |name, new_name|
name = pretty_installed(name) if installed?(name)
new_name = pretty_installed(new_name) if installed?(new_name)
"#{name} -> #{new_name}"
end
output_dump_formula_or_cask_report "Renamed Formulae", formulae
end
def dump_renamed_cask_report
casks = select_formula_or_cask(:RC).sort.map do |name, new_name|
name = pretty_installed(name) if installed?(name)
new_name = pretty_installed(new_name) if installed?(new_name)
"#{name} -> #{new_name}"
end
output_dump_formula_or_cask_report "Renamed Casks", casks
end
def dump_deleted_formula_report(report_all)
formulae = select_formula_or_cask(:D).sort.filter_map do |name| formulae = select_formula_or_cask(:D).sort.filter_map do |name|
if installed?(name) pretty_uninstalled(name) if installed?(name)
pretty_uninstalled(name)
elsif report_all
name
end
end end
title = if report_all output_dump_formula_or_cask_report "Deleted Installed Formulae", formulae
"Deleted Formulae"
else
"Deleted Installed Formulae"
end
output_dump_formula_or_cask_report title, formulae
end end
def dump_deleted_cask_report(report_all) def dump_deleted_cask_report
casks = select_formula_or_cask(:DC).sort.filter_map do |name| casks = select_formula_or_cask(:DC).sort.filter_map do |name|
name = name.split("/").last name = name.split("/").last
if cask_installed?(name) pretty_uninstalled(name) if cask_installed?(name)
pretty_uninstalled(name)
elsif report_all
name
end
end end
title = if report_all output_dump_formula_or_cask_report "Deleted Installed Casks", casks
"Deleted Casks"
else
"Deleted Installed Casks"
end
output_dump_formula_or_cask_report title, casks
end
def dump_modified_formula_report
formulae = select_formula_or_cask(:M).sort.map do |name|
if installed?(name)
if outdated?(name)
pretty_outdated(name)
else
pretty_installed(name)
end
else
name
end
end
output_dump_formula_or_cask_report "Modified Formulae", formulae
end
def dump_modified_cask_report
casks = select_formula_or_cask(:MC).sort.map do |name|
name = name.split("/").last
if cask_installed?(name)
if cask_outdated?(name)
pretty_outdated(name)
else
pretty_installed(name)
end
else
name
end
end
output_dump_formula_or_cask_report "Modified Casks", casks
end end
def output_dump_formula_or_cask_report(title, formulae_or_casks) def output_dump_formula_or_cask_report(title, formulae_or_casks)

View File

@ -124,8 +124,8 @@ module Homebrew
sig { override.void } sig { override.void }
def run def run
# Deprecated since this is now the default behavior. # Disabled since this is now the default behavior.
odeprecated "`brew upgrade --ignore-pinned`" if args.ignore_pinned? odisabled "`brew upgrade --ignore-pinned`" if args.ignore_pinned?
formulae, casks = args.named.to_resolved_formulae_to_casks formulae, casks = args.named.to_resolved_formulae_to_casks
# If one or more formulae are specified, but no casks were # If one or more formulae are specified, but no casks were

View File

@ -50,13 +50,11 @@ module Homebrew
"`--strict` and `--online`." "`--strict` and `--online`."
switch "--new-formula", switch "--new-formula",
replacement: "--new", replacement: "--new",
# odeprecated: change this to true on disable and remove `args.new_formula?` calls disable: true,
disable: false,
hidden: true hidden: true
switch "--new-cask", switch "--new-cask",
replacement: "--new", replacement: "--new",
# odeprecated: change this to true on disable and remove `args.new_formula?` calls disable: true,
disable: false,
hidden: true hidden: true
switch "--[no-]signing", switch "--[no-]signing",
description: "Audit for signed apps, which are required on ARM" description: "Audit for signed apps, which are required on ARM"
@ -105,9 +103,6 @@ module Homebrew
sig { override.void } sig { override.void }
def run def run
new_cask = args.new? || args.new_cask?
new_formula = args.new? || args.new_formula?
Formulary.enable_factory_cache! Formulary.enable_factory_cache!
os_arch_combinations = args.os_arch_combinations os_arch_combinations = args.os_arch_combinations
@ -115,8 +110,8 @@ module Homebrew
Homebrew.auditing = true Homebrew.auditing = true
Homebrew.inject_dump_stats!(FormulaAuditor, /^audit_/) if args.audit_debug? Homebrew.inject_dump_stats!(FormulaAuditor, /^audit_/) if args.audit_debug?
strict = new_formula || args.strict? strict = args.new? || args.strict?
online = new_formula || args.online? online = args.new? || args.online?
tap_audit = args.tap.present? tap_audit = args.tap.present?
skip_style = args.skip_style? || args.no_named? || tap_audit skip_style = args.skip_style? || args.no_named? || tap_audit
no_named_args = T.let(false, T::Boolean) no_named_args = T.let(false, T::Boolean)
@ -176,7 +171,7 @@ module Homebrew
if only_cops if only_cops
style_options[:only_cops] = only_cops style_options[:only_cops] = only_cops
elsif new_formula || new_cask elsif args.new?
nil nil
elsif except_cops elsif except_cops
style_options[:except_cops] = except_cops style_options[:except_cops] = except_cops
@ -207,7 +202,7 @@ module Homebrew
only = only_cops ? ["style"] : args.only only = only_cops ? ["style"] : args.only
options = { options = {
new_formula:, new_formula: args.new?,
strict:, strict:,
online:, online:,
git: args.git?, git: args.git?,
@ -262,7 +257,7 @@ module Homebrew
# No need for `|| nil` for `--[no-]signing` # No need for `|| nil` for `--[no-]signing`
# because boolean switches are already `nil` if not passed # because boolean switches are already `nil` if not passed
audit_signing: args.signing?, audit_signing: args.signing?,
audit_new_cask: new_cask || nil, audit_new_cask: args.new? || nil,
audit_token_conflicts: args.token_conflicts? || nil, audit_token_conflicts: args.token_conflicts? || nil,
quarantine: true, quarantine: true,
any_named_args: !no_named_args, any_named_args: !no_named_args,

View File

@ -49,8 +49,6 @@ module Homebrew
description: "Specify the <SHA-256> checksum of the new download." description: "Specify the <SHA-256> checksum of the new download."
flag "--fork-org=", flag "--fork-org=",
description: "Use the specified GitHub organization for forking." description: "Use the specified GitHub organization for forking."
switch "-f", "--force",
hidden: true
conflicts "--dry-run", "--write" conflicts "--dry-run", "--write"
conflicts "--no-audit", "--online" conflicts "--no-audit", "--online"
@ -62,8 +60,7 @@ module Homebrew
sig { override.void } sig { override.void }
def run def run
odeprecated "brew bump-cask-pr --online" if args.online? odisabled "brew bump-cask-pr --online" if args.online?
odisabled "brew bump-cask-pr --force" if args.force?
# This will be run by `brew audit` or `brew style` later so run it first to # This will be run by `brew audit` or `brew style` later so run it first to
# not start spamming during normal output. # not start spamming during normal output.

View File

@ -475,7 +475,7 @@ module Homebrew
def check_throttle(formula, new_version) def check_throttle(formula, new_version)
throttled_rate = formula.livecheck.throttle throttled_rate = formula.livecheck.throttle
throttled_rate ||= if (rate = formula.tap.audit_exceptions.dig(:throttled_formulae, formula.name)) throttled_rate ||= if (rate = formula.tap.audit_exceptions.dig(:throttled_formulae, formula.name))
odeprecated "throttled_formulae.json", "Livecheck#throttle" odisabled "throttled_formulae.json", "Livecheck#throttle"
rate rate
end end
return if throttled_rate.blank? return if throttled_rate.blank?

View File

@ -44,7 +44,7 @@ module Homebrew
casks = args.named.to_paths(only: :cask, recurse_tap: true).map { |path| Cask::CaskLoader.load(path) } casks = args.named.to_paths(only: :cask, recurse_tap: true).map { |path| Cask::CaskLoader.load(path) }
unversioned_casks = casks.select do |cask| unversioned_casks = casks.select do |cask|
cask.url&.unversioned? && !cask.livecheckable? && !cask.discontinued? cask.url&.unversioned? && !cask.livecheckable?
end end
ohai "Unversioned Casks: #{unversioned_casks.count} (#{state.size} cached)" ohai "Unversioned Casks: #{unversioned_casks.count} (#{state.size} cached)"

View File

@ -45,8 +45,6 @@ module Homebrew
description: "Limit number of package results returned." description: "Limit number of package results returned."
flag "--start-with=", flag "--start-with=",
description: "Letter or word that the list of package results should alphabetically follow." description: "Letter or word that the list of package results should alphabetically follow."
switch "-f", "--force",
hidden: true
conflicts "--cask", "--formula" conflicts "--cask", "--formula"
conflicts "--tap=", "--installed" conflicts "--tap=", "--installed"
@ -63,8 +61,6 @@ module Homebrew
raise UsageError, "`--limit` must be used with either `--formula` or `--cask`." raise UsageError, "`--limit` must be used with either `--formula` or `--cask`."
end end
odisabled "brew bump --force" if args.force?
Homebrew.with_no_api_env do Homebrew.with_no_api_env do
formulae_and_casks = if args.tap formulae_and_casks = if args.tap
tap = Tap.fetch(T.must(args.tap)) tap = Tap.fetch(T.must(args.tap))

View File

@ -120,19 +120,7 @@ module Homebrew
private private
def watchlist_path def watchlist_path
@watchlist_path ||= begin @watchlist_path ||= File.expand_path(Homebrew::EnvConfig.livecheck_watchlist)
watchlist = File.expand_path(Homebrew::EnvConfig.livecheck_watchlist)
unless File.exist?(watchlist)
previous_default_watchlist = File.expand_path("~/.brew_livecheck_watchlist")
if File.exist?(previous_default_watchlist)
odisabled "~/.brew_livecheck_watchlist", "~/.homebrew/livecheck_watchlist.txt"
watchlist = previous_default_watchlist
end
end
watchlist
end
end end
end end
end end

View File

@ -28,11 +28,6 @@ module Homebrew
switch "--autosquash", switch "--autosquash",
description: "Instruct `brew pr-publish` to automatically reformat and reword commits " \ description: "Instruct `brew pr-publish` to automatically reformat and reword commits " \
"in the pull request to the preferred format." "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.",
disable: true, # odisabled: remove this switch with 4.3.0
hidden: true
switch "--ignore-failures", switch "--ignore-failures",
description: "Include pull requests that have failing status checks." description: "Include pull requests that have failing status checks."

View File

@ -35,11 +35,6 @@ module Homebrew
switch "--autosquash", switch "--autosquash",
description: "Automatically reformat and reword commits in the pull request to our " \ description: "Automatically reformat and reword commits in the pull request to our " \
"preferred format." "preferred format."
switch "--no-autosquash",
description: "Skip automatically reformatting and rewording commits in the pull request to our " \
"preferred format.",
disable: true, # odisabled: remove this switch with 4.3.0
hidden: true
switch "--branch-okay", switch "--branch-okay",
description: "Do not warn if pulling to a branch besides the repository default (useful for testing)." description: "Do not warn if pulling to a branch besides the repository default (useful for testing)."
switch "--resolve", switch "--resolve",

View File

@ -79,7 +79,7 @@ class AbstractDownloadStrategy
# Disable any output during downloading. # Disable any output during downloading.
sig { void } sig { void }
def shutup! def shutup!
odeprecated "`AbstractDownloadStrategy#shutup!`", "`AbstractDownloadStrategy#quiet!`" odisabled "`AbstractDownloadStrategy#shutup!`", "`AbstractDownloadStrategy#quiet!`"
quiet! quiet!
end end

View File

@ -565,13 +565,6 @@ class Formula
} }
def resource(name, klass = Resource, &block) = active_spec.resource(name, klass, &block) def resource(name, klass = Resource, &block) = active_spec.resource(name, klass, &block)
# An old name for the formula.
sig { returns(T.nilable(String)) }
def oldname
odisabled "`Formula#oldname`", "`Formula#oldnames`"
@oldname ||= oldnames.first
end
# Old names for the formula. # Old names for the formula.
# #
# @api internal # @api internal
@ -605,16 +598,6 @@ class Formula
# The declared {Dependency}s for the currently active {SoftwareSpec} (i.e. including those provided by macOS) # The declared {Dependency}s for the currently active {SoftwareSpec} (i.e. including those provided by macOS)
delegate declared_deps: :active_spec delegate declared_deps: :active_spec
# Dependencies provided by macOS for the currently active {SoftwareSpec}.
def uses_from_macos_elements
odisabled "`Formula#uses_from_macos_elements`", "`Formula#declared_deps`"
end
# Dependency names provided by macOS for the currently active {SoftwareSpec}.
def uses_from_macos_names
odisabled "`Formula#uses_from_macos_names`", "`Formula#declared_deps`"
end
# The {Requirement}s for the currently active {SoftwareSpec}. # The {Requirement}s for the currently active {SoftwareSpec}.
delegate requirements: :active_spec delegate requirements: :active_spec
@ -1241,8 +1224,7 @@ class Formula
# #
# @see https://www.unix.com/man-page/all/5/plist/ <code>plist(5)</code> man page # @see https://www.unix.com/man-page/all/5/plist/ <code>plist(5)</code> man page
def plist def plist
# odeprecated: consider removing entirely in 4.3.0 odeprecated "`Formula#plist`", "`Homebrew::Service`"
# odeprecated "`Formula#plist`", "`Homebrew::Service`"
nil nil
end end
@ -2401,7 +2383,7 @@ class Formula
"name" => name, "name" => name,
"full_name" => full_name, "full_name" => full_name,
"tap" => tap&.name, "tap" => tap&.name,
"oldname" => oldnames.first, # deprecated "oldname" => ("odeprecated" if oldnames.first),
"oldnames" => oldnames, "oldnames" => oldnames,
"aliases" => aliases.sort, "aliases" => aliases.sort,
"versioned_formulae" => versioned_formulae.map(&:name), "versioned_formulae" => versioned_formulae.map(&:name),
@ -3731,7 +3713,7 @@ class Formula
# #
# @api public # @api public
def go_resource(name, &block) def go_resource(name, &block)
# odeprecated "`Formula.go_resource`", "Go modules" odeprecated "`Formula.go_resource`", "Go modules"
specs.each { |spec| spec.go_resource(name, &block) } specs.each { |spec| spec.go_resource(name, &block) }
end end

View File

@ -427,7 +427,7 @@ module FormulaCellarChecks
problem_if_output(check_elisp_root(formula.share, formula.name)) problem_if_output(check_elisp_root(formula.share, formula.name))
problem_if_output(check_python_packages(formula.lib, formula.deps)) problem_if_output(check_python_packages(formula.lib, formula.deps))
problem_if_output(check_shim_references(formula.prefix)) problem_if_output(check_shim_references(formula.prefix))
problem_if_output(check_plist(formula.prefix, formula.plist)) problem_if_output(check_plist(formula.prefix, formula.launchd_service_path))
problem_if_output(check_python_symlinks(formula.name, formula.keg_only?)) problem_if_output(check_python_symlinks(formula.name, formula.keg_only?))
problem_if_output(check_cpuid_instruction(formula)) problem_if_output(check_cpuid_instruction(formula))
problem_if_output(check_binary_arches(formula)) problem_if_output(check_binary_arches(formula))

View File

@ -1049,12 +1049,7 @@ on_request: installed_on_request?, options:)
sig { void } sig { void }
def install_service def install_service
if formula.service? && formula.plist service = if formula.service? && formula.service.command?
ofail "Formula specified both service and plist"
return
end
if formula.service? && formula.service.command?
service_path = formula.systemd_service_path service_path = formula.systemd_service_path
service_path.atomic_write(formula.service.to_systemd_unit) service_path.atomic_write(formula.service.to_systemd_unit)
service_path.chmod 0644 service_path.chmod 0644
@ -1064,14 +1059,9 @@ on_request: installed_on_request?, options:)
timer_path.atomic_write(formula.service.to_systemd_timer) timer_path.atomic_write(formula.service.to_systemd_timer)
timer_path.chmod 0644 timer_path.chmod 0644
end end
end
service = if formula.service? && formula.service.command?
formula.service.to_plist formula.service.to_plist
elsif formula.plist
formula.plist
end end
return unless service return unless service
launchd_service_path = formula.launchd_service_path launchd_service_path = formula.launchd_service_path

View File

@ -125,8 +125,8 @@ class GitHubPackages
def self.image_version_rebuild(version_rebuild) def self.image_version_rebuild(version_rebuild)
return version_rebuild if version_rebuild.match?(VALID_OCI_TAG_REGEX) return version_rebuild if version_rebuild.match?(VALID_OCI_TAG_REGEX)
odeprecated "GitHub Packages versions that do not match #{VALID_OCI_TAG_REGEX.source}", odisabled "GitHub Packages versions that do not match #{VALID_OCI_TAG_REGEX.source}",
"declaring a new `version` without these characters" "declaring a new `version` without these characters"
version_rebuild.gsub(INVALID_OCI_TAG_CHARS_REGEX, ".") version_rebuild.gsub(INVALID_OCI_TAG_CHARS_REGEX, ".")
end end

View File

@ -14,7 +14,7 @@ module Language
# e.g. `resource "github.com/foo/bar"`. # e.g. `resource "github.com/foo/bar"`.
sig { params(resources: T::Array[Resource], target: T.any(String, Pathname)).void } sig { params(resources: T::Array[Resource], target: T.any(String, Pathname)).void }
def self.stage_deps(resources, target) def self.stage_deps(resources, target)
# odeprecated "`Language::Go.stage_deps`", "Go modules" odeprecated "`Language::Go.stage_deps`", "Go modules"
if resources.empty? if resources.empty?
if Homebrew::EnvConfig.developer? if Homebrew::EnvConfig.developer?
odie "Tried to stage empty Language::Go resources array" odie "Tried to stage empty Language::Go resources array"

View File

@ -107,20 +107,6 @@ module Homebrew
Livecheck.status_hash(formula, "versioned", full_name:, verbose:) Livecheck.status_hash(formula, "versioned", full_name:, verbose:)
end end
sig {
params(
cask: Cask::Cask,
livecheckable: T::Boolean,
full_name: T::Boolean,
verbose: T::Boolean,
).returns(Hash)
}
def cask_discontinued(cask, livecheckable, full_name: false, verbose: false)
return {} if !cask.discontinued? || livecheckable
Livecheck.status_hash(cask, "discontinued", full_name:, verbose:)
end
sig { sig {
params( params(
cask: Cask::Cask, cask: Cask::Cask,
@ -210,7 +196,6 @@ module Homebrew
# Skip conditions for casks. # Skip conditions for casks.
CASK_CHECKS = [ CASK_CHECKS = [
:package_or_resource_skip, :package_or_resource_skip,
:cask_discontinued,
:cask_deprecated, :cask_deprecated,
:cask_disabled, :cask_disabled,
:cask_extract_plist, :cask_extract_plist,

View File

@ -136,40 +136,3 @@ class MacOSVersion < Version
# NOTE: Constructor needs to called with an arbitrary macOS-like version which is then set to `nil`. # NOTE: Constructor needs to called with an arbitrary macOS-like version which is then set to `nil`.
NULL = MacOSVersion.new("10.0").tap { |v| v.instance_variable_set(:@version, nil) }.freeze NULL = MacOSVersion.new("10.0").tap { |v| v.instance_variable_set(:@version, nil) }.freeze
end end
require "lazy_object"
module MacOSVersionErrorCompat
def const_missing(name)
if name == :MacOSVersionError
odisabled "`MacOSVersionError`", "`MacOSVersion::Error`"
return MacOSVersion::Error
end
super
end
end
# `LazyObject` does not work for exceptions when used in `rescue` statements.
class Object
class << self
prepend MacOSVersionErrorCompat
end
end
module MacOSVersions
SYMBOLS = LazyObject.new do # rubocop:disable Style/MutableConstant
odisabled "`MacOSVersions::SYMBOLS`", "`MacOSVersion::SYMBOLS`"
MacOSVersion::SYMBOLS
end
end
module OS
module Mac
# TODO: Replace `::Version` with `Version` when this is removed.
Version = LazyObject.new do # rubocop:disable Style/MutableConstant
odisabled "`OS::Mac::Version`", "`MacOSVersion`"
MacOSVersion
end
end
end

View File

@ -58,60 +58,60 @@ module OS
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"] raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
def self.version def self.version
odeprecated "`MacOS.version` on Linux" odisabled "`MacOS.version` on Linux"
MacOSVersion::NULL MacOSVersion::NULL
end end
def self.full_version def self.full_version
odeprecated "`MacOS.full_version` on Linux" odisabled "`MacOS.full_version` on Linux"
MacOSVersion::NULL MacOSVersion::NULL
end end
def self.languages def self.languages
odeprecated "`MacOS.languages` on Linux" odisabled "`MacOS.languages` on Linux"
@languages ||= Array(ENV["LANG"]&.slice(/[a-z]+/)).uniq @languages ||= Array(ENV["LANG"]&.slice(/[a-z]+/)).uniq
end end
def self.language def self.language
odeprecated "`MacOS.language` on Linux" odisabled "`MacOS.language` on Linux"
languages.first languages.first
end end
def self.sdk_root_needed? def self.sdk_root_needed?
odeprecated "`MacOS.sdk_root_needed?` on Linux" odisabled "`MacOS.sdk_root_needed?` on Linux"
false false
end end
def self.sdk_path_if_needed(_version = nil) def self.sdk_path_if_needed(_version = nil)
odeprecated "`MacOS.sdk_path_if_needed` on Linux" odisabled "`MacOS.sdk_path_if_needed` on Linux"
nil nil
end end
def self.sdk_path(_version = nil) def self.sdk_path(_version = nil)
odeprecated "`MacOS.sdk_path` on Linux" odisabled "`MacOS.sdk_path` on Linux"
nil nil
end end
module Xcode module Xcode
def self.version def self.version
odeprecated "`MacOS::Xcode.version` on Linux" odisabled "`MacOS::Xcode.version` on Linux"
::Version::NULL ::Version::NULL
end end
def self.installed? def self.installed?
odeprecated "`MacOS::Xcode.installed?` on Linux" odisabled "`MacOS::Xcode.installed?` on Linux"
false false
end end
end end
module CLT module CLT
def self.version def self.version
odeprecated "`MacOS::CLT.version` on Linux" odisabled "`MacOS::CLT.version` on Linux"
::Version::NULL ::Version::NULL
end end
def self.installed? def self.installed?
odeprecated "`MacOS::CLT.installed?` on Linux" odisabled "`MacOS::CLT.installed?` on Linux"
false false
end end
end end

View File

@ -26,7 +26,7 @@ module OS
# @api internal # @api internal
sig { returns(MacOSVersion) } sig { returns(MacOSVersion) }
def self.version def self.version
odeprecated "`MacOS.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
@version ||= full_version.strip_patch @version ||= full_version.strip_patch
end end
@ -36,7 +36,7 @@ module OS
# @api internal # @api internal
sig { returns(MacOSVersion) } sig { returns(MacOSVersion) }
def self.full_version def self.full_version
odeprecated "`MacOS.full_version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS.full_version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
@full_version ||= if (fake_macos = ENV.fetch("HOMEBREW_FAKE_MACOS", nil)) # for Portable Ruby building @full_version ||= if (fake_macos = ENV.fetch("HOMEBREW_FAKE_MACOS", nil)) # for Portable Ruby building
MacOSVersion.new(fake_macos) MacOSVersion.new(fake_macos)
else else
@ -69,7 +69,7 @@ module OS
end end
def self.languages def self.languages
odeprecated "`MacOS.languages` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS.languages` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
return @languages if @languages return @languages if @languages
os_langs = Utils.popen_read("defaults", "read", "-g", "AppleLanguages") os_langs = Utils.popen_read("defaults", "read", "-g", "AppleLanguages")
@ -83,7 +83,7 @@ module OS
end end
def self.language def self.language
odeprecated "`MacOS.language` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS.language` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
languages.first languages.first
end end
@ -94,7 +94,7 @@ module OS
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def self.sdk_root_needed? def self.sdk_root_needed?
odeprecated "`MacOS.sdk_root_needed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS.sdk_root_needed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
if MacOS::CLT.installed? if MacOS::CLT.installed?
# If there's no CLT SDK, return false # If there's no CLT SDK, return false
return false unless MacOS::CLT.provides_sdk? return false unless MacOS::CLT.provides_sdk?
@ -143,13 +143,13 @@ module OS
# Returns the path to an SDK or nil, following the rules set by {sdk}. # Returns the path to an SDK or nil, following the rules set by {sdk}.
def self.sdk_path(version = nil) def self.sdk_path(version = nil)
odeprecated "`MacOS.sdk_path` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS.sdk_path` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
s = sdk(version) s = sdk(version)
s&.path s&.path
end end
def self.sdk_path_if_needed(version = nil) def self.sdk_path_if_needed(version = nil)
odeprecated "`MacOS.sdk_path_if_needed` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS.sdk_path_if_needed` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
# Prefer CLT SDK when both Xcode and the CLT are installed. # Prefer CLT SDK when both Xcode and the CLT are installed.
# Expected results: # Expected results:
# 1. On Xcode-only systems, return the Xcode SDK. # 1. On Xcode-only systems, return the Xcode SDK.

View File

@ -123,7 +123,7 @@ module OS
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def self.installed? def self.installed?
odeprecated "`MacOS::Xcode.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS::Xcode.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
!prefix.nil? !prefix.nil?
end end
@ -175,7 +175,7 @@ module OS
# @api internal # @api internal
sig { returns(::Version) } sig { returns(::Version) }
def self.version def self.version
odeprecated "`MacOS::Xcode.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS::Xcode.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
# may return a version string # may return a version string
# that is guessed based on the compiler, so do not # that is guessed based on the compiler, so do not
# use it in order to check if Xcode is installed. # use it in order to check if Xcode is installed.
@ -274,7 +274,7 @@ module OS
# Returns true even if outdated tools are installed. # Returns true even if outdated tools are installed.
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def self.installed? def self.installed?
odeprecated "`MacOS::CLT.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS::CLT.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
!version.null? !version.null?
end end
@ -409,7 +409,7 @@ module OS
# @api internal # @api internal
sig { returns(::Version) } sig { returns(::Version) }
def self.version def self.version
odeprecated "`MacOS::CLT.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? odisabled "`MacOS::CLT.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
if @version ||= detect_version if @version ||= detect_version
::Version.new @version ::Version.new @version
else else

View File

@ -143,7 +143,7 @@ class SoftwareSpec
end end
def go_resource(name, &block) def go_resource(name, &block)
# odeprecated "`SoftwareSpec#go_resource`", "Go modules" odeprecated "`SoftwareSpec#go_resource`", "Go modules"
resource name, Resource::Go, &block resource name, Resource::Go, &block
end end

View File

@ -1,12 +0,0 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Homebrew::Cmd::PostgresqlUpgradeDatabase`.
# Please instead update this file by running `bin/tapioca dsl Homebrew::Cmd::PostgresqlUpgradeDatabase`.
class Homebrew::Cmd::PostgresqlUpgradeDatabase
sig { returns(Homebrew::Cmd::PostgresqlUpgradeDatabase::Args) }
def args; end
end
class Homebrew::Cmd::PostgresqlUpgradeDatabase::Args < Homebrew::CLI::Args; end

View File

@ -58,12 +58,6 @@ class Homebrew::DevCmd::Audit::Args < Homebrew::CLI::Args
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def new?; end def new?; end
sig { returns(T::Boolean) }
def new_cask?; end
sig { returns(T::Boolean) }
def new_formula?; end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def online?; end def online?; end

View File

@ -16,12 +16,6 @@ class Homebrew::DevCmd::Bump::Args < Homebrew::CLI::Args
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def casks?; end def casks?; end
sig { returns(T::Boolean) }
def f?; end
sig { returns(T::Boolean) }
def force?; end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def formula?; end def formula?; end

View File

@ -16,12 +16,6 @@ class Homebrew::DevCmd::BumpCaskPr::Args < Homebrew::CLI::Args
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def dry_run?; end def dry_run?; end
sig { returns(T::Boolean) }
def f?; end
sig { returns(T::Boolean) }
def force?; end
sig { returns(T.nilable(String)) } sig { returns(T.nilable(String)) }
def fork_org; end def fork_org; end

View File

@ -118,20 +118,6 @@ class Tap
[tap, token.downcase] [tap, token.downcase]
end end
sig { returns(CoreCaskTap) }
def self.default_cask_tap
odisabled "`Tap.default_cask_tap`", "`CoreCaskTap.instance`"
CoreCaskTap.instance
end
sig { params(force: T::Boolean).returns(T::Boolean) }
def self.install_default_cask_tap_if_necessary(force: false)
odisabled "`Tap.install_default_cask_tap_if_necessary`", "`CoreCaskTap.instance.ensure_installed!`"
false
end
sig { returns(T::Set[Tap]) } sig { returns(T::Set[Tap]) }
def self.allowed_taps def self.allowed_taps
cache_key = :"allowed_taps_#{Homebrew::EnvConfig.allowed_taps.to_s.tr(" ", "_")}" cache_key = :"allowed_taps_#{Homebrew::EnvConfig.allowed_taps.to_s.tr(" ", "_")}"
@ -1042,7 +1028,7 @@ class Tap
# An array of all installed {Tap} names. # An array of all installed {Tap} names.
sig { returns(T::Array[String]) } sig { returns(T::Array[String]) }
def self.names def self.names
# odeprecated "`#{self}.names`" odeprecated "`#{self}.names`"
map(&:name).sort map(&:name).sort
end end
@ -1154,7 +1140,7 @@ class AbstractCoreTap < Tap
sig { void } sig { void }
def self.ensure_installed! def self.ensure_installed!
# odeprecated "`#{self}.ensure_installed!`", "`#{self}.instance.ensure_installed!`" odeprecated "`#{self}.ensure_installed!`", "`#{self}.instance.ensure_installed!`"
instance.ensure_installed! instance.ensure_installed!
end end

View File

@ -31,30 +31,9 @@ RSpec.describe Caveats do
end end
describe "#caveats" do describe "#caveats" do
context "when f.plist is not nil", :needs_macos do context "when service block is defined" do
before do before do
allow(Utils::Service).to receive(:launchctl?).and_return(true) allow(Utils::Service).to receive_messages(launchctl?: true, systemctl?: true)
end
it "prints error when no launchd is present" do
f = formula do
url "foo-1.0"
def plist
"plist_test.plist"
end
end
expect(Utils::Service).to receive(:launchctl?).once.and_return(false)
expect(described_class.new(f).caveats).to include("provides a launchd plist which can only be used on macOS!")
end
it "prints plist login information when f.plist_startup is nil" do
f = formula do
url "foo-1.0"
def plist
"plist_test.plist"
end
end
expect(described_class.new(f).caveats).to include("restart at login")
end end
it "gives information about service" do it "gives information about service" do
@ -71,41 +50,6 @@ RSpec.describe Caveats do
expect(caveats).to include("background service") expect(caveats).to include("background service")
end end
it "warns about brew failing under tmux" do
f = formula do
url "foo-1.0"
def plist
"plist_test.plist"
end
end
ENV["HOMEBREW_TMUX"] = "1"
allow(Homebrew).to receive(:_system).and_return(true)
allow(Homebrew).to receive(:_system).with("/usr/bin/pbpaste").and_return(false)
caveats = described_class.new(f).caveats
expect(caveats).to include("WARNING:")
expect(caveats).to include("tmux")
end
# TODO: This should get deprecated and the service block `plist_name` method should get used instead.
it "prints info when there are custom service files" do
f = formula do
url "foo-1.0"
def plist_name
"custom.mxcl.foo"
end
end
expect(Utils::Service).to receive(:installed?).with(f).once.and_return(true)
expect(Utils::Service).to receive(:running?).with(f).once.and_return(false)
expect(described_class.new(f).caveats).to include("restart at login")
end
end
context "when service block is defined" do
before do
allow(Utils::Service).to receive_messages(launchctl?: true, systemctl?: true)
end
it "prints warning when no service daemon is found" do it "prints warning when no service daemon is found" do
f = formula do f = formula do
url "foo-1.0" url "foo-1.0"
@ -113,8 +57,8 @@ RSpec.describe Caveats do
run [bin/"cmd"] run [bin/"cmd"]
end end
end end
expect(Utils::Service).to receive(:launchctl?).twice.and_return(false) expect(Utils::Service).to receive(:launchctl?).and_return(false)
expect(Utils::Service).to receive(:systemctl?).once.and_return(false) expect(Utils::Service).to receive(:systemctl?).and_return(false)
expect(described_class.new(f).caveats).to include("service which can only be used on macOS or systemd!") expect(described_class.new(f).caveats).to include("service which can only be used on macOS or systemd!")
end end

View File

@ -1,8 +0,0 @@
# frozen_string_literal: true
require "cmd/postgresql-upgrade-database"
require "cmd/shared_examples/args_parse"
RSpec.describe Homebrew::Cmd::PostgresqlUpgradeDatabase do
it_behaves_like "parseable arguments"
end

View File

@ -451,22 +451,6 @@ RSpec.describe FormulaInstaller do
end end
describe "#install_service" do describe "#install_service" do
it "works if plist is set" do
formula = Testball.new
path = formula.launchd_service_path
formula.opt_prefix.mkpath
expect(formula).to receive(:plist).twice.and_return("PLIST")
expect(formula).to receive(:launchd_service_path).and_call_original
installer = described_class.new(formula)
expect do
installer.install_service
end.not_to output(/Error: Failed to install service files/).to_stderr
expect(path).to exist
end
it "works if service is set" do it "works if service is set" do
formula = Testball.new formula = Testball.new
service = Homebrew::Service.new(formula) service = Homebrew::Service.new(formula)
@ -474,14 +458,13 @@ RSpec.describe FormulaInstaller do
service_path = formula.systemd_service_path service_path = formula.systemd_service_path
formula.opt_prefix.mkpath formula.opt_prefix.mkpath
expect(formula).to receive(:plist).and_return(nil) expect(formula).to receive(:service?).and_return(true)
expect(formula).to receive(:service?).exactly(3).and_return(true) expect(formula).to receive(:service).at_least(:once).and_return(service)
expect(formula).to receive(:service).exactly(7).and_return(service)
expect(formula).to receive(:launchd_service_path).and_call_original expect(formula).to receive(:launchd_service_path).and_call_original
expect(formula).to receive(:systemd_service_path).and_call_original expect(formula).to receive(:systemd_service_path).and_call_original
expect(service).to receive(:timed?).and_return(false) expect(service).to receive(:timed?).and_return(false)
expect(service).to receive(:command?).exactly(2).and_return(true) expect(service).to receive(:command?).and_return(true)
expect(service).to receive(:to_plist).and_return("plist") expect(service).to receive(:to_plist).and_return("plist")
expect(service).to receive(:to_systemd_unit).and_return("unit") expect(service).to receive(:to_systemd_unit).and_return("unit")
@ -502,15 +485,14 @@ RSpec.describe FormulaInstaller do
timer_path = formula.systemd_timer_path timer_path = formula.systemd_timer_path
formula.opt_prefix.mkpath formula.opt_prefix.mkpath
expect(formula).to receive(:plist).and_return(nil) expect(formula).to receive(:service?).and_return(true)
expect(formula).to receive(:service?).exactly(3).and_return(true) expect(formula).to receive(:service).at_least(:once).and_return(service)
expect(formula).to receive(:service).exactly(9).and_return(service)
expect(formula).to receive(:launchd_service_path).and_call_original expect(formula).to receive(:launchd_service_path).and_call_original
expect(formula).to receive(:systemd_service_path).and_call_original expect(formula).to receive(:systemd_service_path).and_call_original
expect(formula).to receive(:systemd_timer_path).and_call_original expect(formula).to receive(:systemd_timer_path).and_call_original
expect(service).to receive(:timed?).and_return(true) expect(service).to receive(:timed?).and_return(true)
expect(service).to receive(:command?).exactly(2).and_return(true) expect(service).to receive(:command?).and_return(true)
expect(service).to receive(:to_plist).and_return("plist") expect(service).to receive(:to_plist).and_return("plist")
expect(service).to receive(:to_systemd_unit).and_return("unit") expect(service).to receive(:to_systemd_unit).and_return("unit")
expect(service).to receive(:to_systemd_timer).and_return("timer") expect(service).to receive(:to_systemd_timer).and_return("timer")
@ -530,8 +512,7 @@ RSpec.describe FormulaInstaller do
path = formula.launchd_service_path path = formula.launchd_service_path
formula.opt_prefix.mkpath formula.opt_prefix.mkpath
expect(formula).to receive(:plist).and_return(nil) expect(formula).to receive(:service?).and_return(nil)
expect(formula).to receive(:service?).exactly(3).and_return(nil)
expect(formula).not_to receive(:launchd_service_path) expect(formula).not_to receive(:launchd_service_path)
installer = described_class.new(formula) installer = described_class.new(formula)
@ -541,24 +522,5 @@ RSpec.describe FormulaInstaller do
expect(path).not_to exist expect(path).not_to exist
end end
it "errors with duplicate definition" do
formula = Testball.new
path = formula.launchd_service_path
formula.opt_prefix.mkpath
expect(formula).to receive(:plist).and_return("plist")
expect(formula).to receive(:service?).and_return(true)
expect(formula).not_to receive(:service)
expect(formula).not_to receive(:launchd_service_path)
installer = described_class.new(formula)
expect do
installer.install_service
end.to output("Error: Formula specified both service and plist\n").to_stderr
expect(Homebrew).to have_failed
expect(path).not_to exist
end
end end
end end

View File

@ -1,15 +0,0 @@
# frozen_string_literal: true
require "language/go"
RSpec.describe Language::Go do
specify "#stage_deps" do
ENV.delete("HOMEBREW_DEVELOPER")
expect(described_class).to receive(:opoo).once
mktmpdir do |path|
described_class.stage_deps [], path
end
end
end

View File

@ -92,19 +92,6 @@ RSpec.describe Homebrew::Livecheck::SkipConditions do
regex(/"stable":"(\d+(?:\.\d+)+)"/i) regex(/"stable":"(\d+(?:\.\d+)+)"/i)
end end
end, end,
discontinued: Cask::Cask.new("test_discontinued") do
version "0.0.1"
sha256 :no_check
url "https://brew.sh/test-0.0.1.tgz"
name "Test Discontinued"
desc "Discontinued test cask"
homepage "https://brew.sh"
caveats do
discontinued
end
end,
deprecated: Cask::Cask.new("test_deprecated") do deprecated: Cask::Cask.new("test_deprecated") do
version "0.0.1" version "0.0.1"
sha256 :no_check sha256 :no_check
@ -258,13 +245,6 @@ RSpec.describe Homebrew::Livecheck::SkipConditions do
}, },
}, },
cask: { cask: {
discontinued: {
cask: "test_discontinued",
status: "discontinued",
meta: {
livecheckable: false,
},
},
deprecated: { deprecated: {
cask: "test_deprecated", cask: "test_deprecated",
status: "deprecated", status: "deprecated",
@ -380,13 +360,6 @@ RSpec.describe Homebrew::Livecheck::SkipConditions do
end end
end end
context "when a cask without a livecheckable is discontinued" do
it "skips" do
expect(skip_conditions.skip_information(casks[:discontinued]))
.to eq(status_hashes[:cask][:discontinued])
end
end
context "when a cask without a livecheckable is deprecated" do context "when a cask without a livecheckable is deprecated" do
it "skips" do it "skips" do
expect(skip_conditions.skip_information(casks[:deprecated])) expect(skip_conditions.skip_information(casks[:deprecated]))
@ -503,13 +476,6 @@ RSpec.describe Homebrew::Livecheck::SkipConditions do
end end
end end
context "when a cask without a livecheckable is discontinued" do
it "errors" do
expect { skip_conditions.referenced_skip_information(casks[:discontinued], original_name) }
.to raise_error(RuntimeError, "Referenced cask (test_discontinued) is skipped as discontinued")
end
end
context "when a cask without a livecheckable is deprecated" do context "when a cask without a livecheckable is deprecated" do
it "errors" do it "errors" do
expect { skip_conditions.referenced_skip_information(casks[:deprecated], original_name) } expect { skip_conditions.referenced_skip_information(casks[:deprecated], original_name) }
@ -635,14 +601,6 @@ RSpec.describe Homebrew::Livecheck::SkipConditions do
end end
end end
context "when the cask is discontinued without a livecheckable" do
it "prints skip information" do
expect { skip_conditions.print_skip_information(status_hashes[:cask][:discontinued]) }
.to output("test_discontinued: discontinued\n").to_stdout
.and not_to_output.to_stderr
end
end
context "when the cask is deprecated without a livecheckable" do context "when the cask is deprecated without a livecheckable" do
it "prints skip information" do it "prints skip information" do
expect { skip_conditions.print_skip_information(status_hashes[:cask][:deprecated]) } expect { skip_conditions.print_skip_information(status_hashes[:cask][:deprecated]) }

View File

@ -20,7 +20,7 @@ RSpec.describe Migrator do
let(:old_pin) { HOMEBREW_PINNED_KEGS/"oldname" } let(:old_pin) { HOMEBREW_PINNED_KEGS/"oldname" }
before do |example| before do |example|
allow(new_formula).to receive(:oldname).and_return("oldname") allow(new_formula).to receive(:oldnames).and_return(["oldname"])
# do not create directories for error tests # do not create directories for error tests
next if example.metadata[:description].start_with?("raises an error") next if example.metadata[:description].start_with?("raises an error")

View File

@ -1,11 +0,0 @@
cask "invalid-appcast-multiple" do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
appcast "https://brew.sh/appcast1.xml"
appcast "https://brew.sh/appcast2.xml"
homepage "https://brew.sh/invalid-appcast-multiple"
app "Caffeine.app"
end

View File

@ -1,10 +0,0 @@
cask "invalid-appcast-url" do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
appcast 1
homepage "https://brew.sh/invalid-appcast-url"
app "Caffeine.app"
end

View File

@ -1,10 +0,0 @@
cask "with-appcast" do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
appcast "https://brew.sh/appcast.xml"
homepage "https://brew.sh/with-appcast"
app "Caffeine.app"
end

View File

@ -8,7 +8,6 @@
"desc": null, "desc": null,
"homepage": "https://brew.sh/", "homepage": "https://brew.sh/",
"url": "https://www.example.com/cask/caffeine.zip", "url": "https://www.example.com/cask/caffeine.zip",
"appcast": null,
"version": "1.2.3", "version": "1.2.3",
"installed": null, "installed": null,
"outdated": false, "outdated": false,

View File

@ -17,7 +17,6 @@
}, },
"user_agent": ":fake" "user_agent": ":fake"
}, },
"appcast": null,
"version": "1.2.3", "version": "1.2.3",
"installed": null, "installed": null,
"installed_time": null, "installed_time": null,

View File

@ -160,10 +160,6 @@ RSpec.describe Tap do
end end
end end
specify "::names" do
expect(described_class.names.sort).to eq(["homebrew/core", "homebrew/foo"])
end
specify "attributes" do specify "attributes" do
expect(homebrew_foo_tap.user).to eq("Homebrew") expect(homebrew_foo_tap.user).to eq("Homebrew")
expect(homebrew_foo_tap.repo).to eq("foo") expect(homebrew_foo_tap.repo).to eq("foo")

View File

@ -345,12 +345,6 @@ class Version
parse(specs.fetch(:tag, url), detected_from_url: true) parse(specs.fetch(:tag, url), detected_from_url: true)
end end
sig { params(val: String).returns(Version) }
def self.create(val)
odisabled "`Version.create`", "`Version.new`"
new(val)
end
sig { params(spec: T.any(String, Pathname), detected_from_url: T::Boolean).returns(T.attached_class) } sig { params(spec: T.any(String, Pathname), detected_from_url: T::Boolean).returns(T.attached_class) }
def self.parse(spec, detected_from_url: false) def self.parse(spec, detected_from_url: false)
spec = CGI.unescape(spec.to_s) if detected_from_url spec = CGI.unescape(spec.to_s) if detected_from_url