cmd/update-report: use better wording where appropriate.

From reading https://github.com/orgs/Homebrew/discussions/3328: I
initially thought we should just change "Updated" to "Modified" when
appropriate. After conversation with Bo98, though, I thought more and
saw that we're already checking for outdated formulae here so, rather
than ever traverse through the formula history, look at the outdated
formula and list them unless we've set
`HOMEBREW_UPDATE_REPORT_ALL_FORMULAE` in which case we show the
modifications.

While we're here, also do a bit of reformatting and renaming to better
clarify intent.
This commit is contained in:
Mike McQuaid 2022-06-03 19:16:15 +01:00
parent 5bf52d1ffe
commit 04c8e02418
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
8 changed files with 240 additions and 202 deletions

View File

@ -1,7 +1,6 @@
# typed: false
# frozen_string_literal: true
require "formula_versions"
require "migrator"
require "formulary"
require "descriptions"
@ -204,6 +203,7 @@ module Homebrew
hub.dump(updated_formula_report: !args.auto_update?) unless args.quiet?
hub.reporters.each(&:migrate_tap_migration)
hub.reporters.each { |r| r.migrate_formula_rename(force: args.force?, verbose: args.verbose?) }
CacheStoreDatabase.use(:descriptions) do |db|
DescriptionCacheStore.new(db)
.update_from_report!(hub)
@ -212,32 +212,6 @@ module Homebrew
CaskDescriptionCacheStore.new(db)
.update_from_report!(hub)
end
if !args.auto_update? && !args.quiet?
outdated_formulae = Formula.installed.count(&:outdated?)
outdated_casks = Cask::Caskroom.casks.count(&:outdated?)
update_pronoun = if (outdated_formulae + outdated_casks) == 1
"it"
else
"them"
end
msg = ""
if outdated_formulae.positive?
msg += "#{Tty.bold}#{outdated_formulae}#{Tty.reset} outdated #{"formula".pluralize(outdated_formulae)}"
end
if outdated_casks.positive?
msg += " and " if msg.present?
msg += "#{Tty.bold}#{outdated_casks}#{Tty.reset} outdated #{"cask".pluralize(outdated_casks)}"
end
if msg.present?
puts
puts <<~EOS
You have #{msg} installed.
You can upgrade #{update_pronoun} with #{Tty.bold}brew upgrade#{Tty.reset}
or list #{update_pronoun} with #{Tty.bold}brew outdated#{Tty.reset}.
EOS
end
end
end
puts if args.auto_update?
elsif !args.auto_update? && !ENV["HOMEBREW_UPDATE_FAILED"] && !ENV["HOMEBREW_MIGRATE_LINUXBREW_FORMULAE"]
@ -369,24 +343,6 @@ class Reporter
when "M"
name = tap.formula_file_to_name(src)
# Skip filtering unchanged formulae versions by default (as it's slow).
unless Homebrew::EnvConfig.update_report_version_changed_formulae?
@report[:M] << name
next
end
begin
formula = Formulary.factory(tap.path/src)
new_version = formula.pkg_version
old_version = FormulaVersions.new(formula).formula_at_revision(@initial_revision, &:pkg_version)
next if new_version == old_version
rescue FormulaUnavailableError
# Don't care if the formula isn't available right now.
nil
rescue Exception => e # rubocop:disable Lint/RescueException
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if Homebrew::EnvConfig.developer?
end
@report[:M] << name
when /^R\d{0,3}/
src_full_name = tap.formula_file_to_name(src)
@ -571,7 +527,7 @@ class ReporterHub
@reporters = []
end
def select_formula(key)
def select_formula_or_cask(key)
@hash.fetch(key, [])
end
@ -586,70 +542,155 @@ class ReporterHub
def dump(updated_formula_report: true)
# Key Legend: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R)
dump_formula_report :A, "New Formulae"
if updated_formula_report
dump_formula_report :M, "Updated Formulae"
else
updated = select_formula(:M).count
ohai "Updated Formulae", "Updated #{updated} #{"formula".pluralize(updated)}." if updated.positive?
unless Homebrew::EnvConfig.update_report_all_formulae?
dump_formula_or_cask_report :A, "New Formulae"
dump_formula_or_cask_report :AC, "New Casks"
dump_formula_or_cask_report :R, "Renamed Formulae"
end
dump_formula_report :R, "Renamed Formulae"
dump_formula_report :D, "Deleted Formulae"
dump_formula_report :AC, "New Casks"
if updated_formula_report
dump_formula_report :MC, "Updated Casks"
dump_formula_or_cask_report :D, "Deleted Formulae"
dump_formula_or_cask_report :DC, "Deleted Casks"
outdated_formulae = nil
outdated_casks = nil
if updated_formula_report && Homebrew::EnvConfig.update_report_all_formulae?
dump_formula_or_cask_report :M, "Modified Formulae"
dump_formula_or_cask_report :MC, "Modified Casks"
elsif updated_formula_report
outdated_formulae = Formula.installed.select(&:outdated?).map(&:name)
output_dump_formula_or_cask_report "Outdated Formulae", outdated_formulae
outdated_casks = Cask::Caskroom.casks.select(&:outdated?).map(&:token)
output_dump_formula_or_cask_report "Outdated Casks", outdated_casks
elsif Homebrew::EnvConfig.update_report_all_formulae?
if (changed_formulae = select_formula_or_cask(:M).count) && changed_formulae.positive?
ohai "Modified Formulae", "Modified #{changed_formulae} #{"formula".pluralize(changed_formulae)}."
end
if (changed_casks = select_formula_or_cask(:MC).count) && changed_casks.positive?
ohai "Modified Casks", "Modified #{changed_casks} #{"cask".pluralize(changed_casks)}."
end
else
updated = select_formula(:MC).count
ohai "Updated Casks", "Updated #{updated} #{"cask".pluralize(updated)}." if updated.positive?
outdated_formulae = Formula.installed.select(&:outdated?).map(&:name)
outdated_casks = Cask::Caskroom.casks.select(&:outdated?).map(&:token)
end
dump_formula_report :DC, "Deleted Casks"
return if outdated_formulae.blank? && outdated_casks.blank?
outdated_formulae = outdated_formulae.count
outdated_casks = outdated_casks.count
update_pronoun = if (outdated_formulae + outdated_casks) == 1
"it"
else
"them"
end
msg = ""
if outdated_formulae.positive?
msg += "#{Tty.bold}#{outdated_formulae}#{Tty.reset} outdated #{"formula".pluralize(outdated_formulae)}"
end
if outdated_casks.positive?
msg += " and " if msg.present?
msg += "#{Tty.bold}#{outdated_casks}#{Tty.reset} outdated #{"cask".pluralize(outdated_casks)}"
end
return if msg.blank?
puts
puts <<~EOS
You have #{msg} installed.
You can upgrade #{update_pronoun} with #{Tty.bold}brew upgrade#{Tty.reset}
or list #{update_pronoun} with #{Tty.bold}brew outdated#{Tty.reset}.
EOS
end
private
def dump_formula_report(key, title)
only_installed = !Homebrew::EnvConfig.update_report_all_formulae?
def dump_formula_or_cask_report(key, title)
report_all = Homebrew::EnvConfig.update_report_all_formulae?
formulae = select_formula(key).sort.map do |name, new_name|
# Format list items of renamed formulae
formulae_or_casks = select_formula_or_cask(key).sort.map do |name, new_name|
# Format list items of formulae
case key
when :R
unless only_installed
if report_all
name = pretty_installed(name) if installed?(name)
new_name = pretty_installed(new_name) if installed?(new_name)
"#{name} -> #{new_name}"
end
when :A
name if !only_installed && !installed?(name)
name if report_all && !installed?(name)
when :AC
name.split("/").last if !only_installed && !cask_installed?(name)
when :MC, :DC
name.split("/").last if report_all && !cask_installed?(name)
when :MC
name = name.split("/").last
if cask_installed?(name)
pretty_installed(name)
elsif !only_installed
if cask_outdated?(name)
pretty_outdated(name)
else
pretty_installed(name)
end
elsif report_all
name
end
when :DC
name = name.split("/").last
if cask_installed?(name)
pretty_uninstalled(name)
elsif report_all
name
end
when :M
if installed?(name)
if outdated?(name)
pretty_outdated(name)
else
pretty_installed(name)
end
elsif report_all
name
end
when :D
if installed?(name)
pretty_uninstalled(name)
elsif report_all
name
end
else
if installed?(name)
pretty_installed(name)
elsif !only_installed
name
end
raise ArgumentError, ":#{key} passed to dump_formula_or_cask_report!"
end
end.compact
return if formulae.empty?
output_dump_formula_or_cask_report title, formulae_or_casks
end
# Dump formula list.
ohai title, Formatter.columns(formulae.sort)
def output_dump_formula_or_cask_report(title, formulae_or_casks)
return if formulae_or_casks.blank?
ohai title, Formatter.columns(formulae_or_casks.sort)
end
def installed?(formula)
(HOMEBREW_CELLAR/formula.split("/").last).directory?
end
def outdated?(formula)
Formula[formula].outdated?
rescue FormulaUnavailableError
false
end
def cask_installed?(cask)
(Cask::Caskroom.path/cask).directory?
end
def cask_outdated?(cask)
Cask::CaskLoader.load(cask).outdated?
rescue Cask::CaskError
false
end
end

View File

@ -48,13 +48,13 @@ class DescriptionCacheStore < CacheStore
return populate_if_empty! if database.empty?
return if report.empty?
renamings = report.select_formula(:R)
alterations = report.select_formula(:A) +
report.select_formula(:M) +
renamings = report.select_formula_or_cask(:R)
alterations = report.select_formula_or_cask(:A) +
report.select_formula_or_cask(:M) +
renamings.map(&:last)
update_from_formula_names!(alterations)
delete_from_formula_names!(report.select_formula(:D) +
delete_from_formula_names!(report.select_formula_or_cask(:D) +
renamings.map(&:first))
end
@ -114,11 +114,11 @@ class CaskDescriptionCacheStore < DescriptionCacheStore
return populate_if_empty! if database.empty?
return if report.empty?
alterations = report.select_formula(:AC) +
report.select_formula(:MC)
alterations = report.select_formula_or_cask(:AC) +
report.select_formula_or_cask(:MC)
update_from_cask_tokens!(alterations)
delete_from_cask_tokens!(report.select_formula(:DC))
delete_from_cask_tokens!(report.select_formula_or_cask(:DC))
end
# Use an array of cask tokens to update the {CaskDescriptionCacheStore}.

View File

@ -11,15 +11,15 @@ module Homebrew
module_function
ENVS = {
HOMEBREW_ADDITIONAL_GOOGLE_ANALYTICS_ID: {
HOMEBREW_ADDITIONAL_GOOGLE_ANALYTICS_ID: {
description: "Additional Google Analytics tracking ID to emit user behaviour analytics to. " \
"For more information, see: <https://docs.brew.sh/Analytics>",
},
HOMEBREW_ARCH: {
HOMEBREW_ARCH: {
description: "Linux only: Pass this value to a type name representing the compiler's `-march` option.",
default: "native",
},
HOMEBREW_ARTIFACT_DOMAIN: {
HOMEBREW_ARTIFACT_DOMAIN: {
description: "Prefix all download URLs, including those for bottles, with this value. " \
"For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` will cause a " \
"formula with the URL `https://example.com/foo.tar.gz` to instead download from " \
@ -30,26 +30,26 @@ module Homebrew
"to instead be downloaded from " \
"`http://localhost:8080/v2/homebrew/core/gettext/manifests/0.21`",
},
HOMEBREW_AUTO_UPDATE_SECS: {
HOMEBREW_AUTO_UPDATE_SECS: {
description: "Run `brew update` once every `HOMEBREW_AUTO_UPDATE_SECS` seconds before some commands, " \
"e.g. `brew install`, `brew upgrade` and `brew tap`. Alternatively, " \
"disable auto-update entirely with HOMEBREW_NO_AUTO_UPDATE.",
default: 300,
},
HOMEBREW_BAT: {
HOMEBREW_BAT: {
description: "If set, use `bat` for the `brew cat` command.",
boolean: true,
},
HOMEBREW_BAT_CONFIG_PATH: {
HOMEBREW_BAT_CONFIG_PATH: {
description: "Use this as the `bat` configuration file.",
default_text: "`$HOME/.config/bat/config`.",
},
HOMEBREW_BOOTSNAP: {
HOMEBREW_BOOTSNAP: {
description: "If set, use Bootsnap to speed up repeated `brew` calls. "\
"A no-op when using Homebrew's vendored, relocatable Ruby on macOS (as it doesn't work).",
boolean: true,
},
HOMEBREW_BOTTLE_DOMAIN: {
HOMEBREW_BOTTLE_DOMAIN: {
description: "Use this URL as the download mirror for bottles. " \
"If bottles at that URL are temporarily unavailable, " \
"the default bottle domain will be used as a fallback mirror. " \
@ -60,78 +60,78 @@ module Homebrew
default_text: "`https://ghcr.io/v2/homebrew/core`.",
default: HOMEBREW_BOTTLE_DEFAULT_DOMAIN,
},
HOMEBREW_BREW_GIT_REMOTE: {
HOMEBREW_BREW_GIT_REMOTE: {
description: "Use this URL as the Homebrew/brew `git`(1) remote.",
default: HOMEBREW_BREW_DEFAULT_GIT_REMOTE,
},
HOMEBREW_BROWSER: {
HOMEBREW_BROWSER: {
description: "Use this as the browser when opening project homepages.",
default_text: "`$BROWSER` or the OS's default browser.",
},
HOMEBREW_CACHE: {
HOMEBREW_CACHE: {
description: "Use this directory as the download cache.",
default_text: "macOS: `$HOME/Library/Caches/Homebrew`, " \
"Linux: `$XDG_CACHE_HOME/Homebrew` or `$HOME/.cache/Homebrew`.",
default: HOMEBREW_DEFAULT_CACHE,
},
HOMEBREW_CASK_OPTS: {
HOMEBREW_CASK_OPTS: {
description: "Append these options to all `cask` commands. All `--*dir` options, " \
"`--language`, `--require-sha`, `--no-quarantine` and `--no-binaries` are supported. " \
"For example, you might add something like the following to your " \
"`~/.profile`, `~/.bash_profile`, or `~/.zshenv`:\n\n" \
' `export HOMEBREW_CASK_OPTS="--appdir=~/Applications --fontdir=/Library/Fonts"`',
},
HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS: {
HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS: {
description: "If set, `brew install`, `brew upgrade` and `brew reinstall` will cleanup all formulae " \
"when this number of days has passed.",
default: 30,
},
HOMEBREW_CLEANUP_MAX_AGE_DAYS: {
HOMEBREW_CLEANUP_MAX_AGE_DAYS: {
description: "Cleanup all cached files older than this many days.",
default: 120,
},
HOMEBREW_COLOR: {
HOMEBREW_COLOR: {
description: "If set, force colour output on non-TTY outputs.",
boolean: true,
},
HOMEBREW_CORE_GIT_REMOTE: {
HOMEBREW_CORE_GIT_REMOTE: {
description: "Use this URL as the Homebrew/homebrew-core `git`(1) remote.",
default_text: "`https://github.com/Homebrew/homebrew-core`.",
default: HOMEBREW_CORE_DEFAULT_GIT_REMOTE,
},
HOMEBREW_CURLRC: {
HOMEBREW_CURLRC: {
description: "If set, do not pass `--disable` when invoking `curl`(1), which disables the " \
"use of `curlrc`.",
boolean: true,
},
HOMEBREW_CURL_RETRIES: {
HOMEBREW_CURL_RETRIES: {
description: "Pass the given retry count to `--retry` when invoking `curl`(1).",
default: 3,
},
HOMEBREW_CURL_VERBOSE: {
HOMEBREW_CURL_VERBOSE: {
description: "If set, pass `--verbose` when invoking `curl`(1).",
boolean: true,
},
HOMEBREW_DEVELOPER: {
HOMEBREW_DEVELOPER: {
description: "If set, tweak behaviour to be more relevant for Homebrew developers (active or " \
"budding) by e.g. turning warnings into errors.",
boolean: true,
},
HOMEBREW_DISABLE_LOAD_FORMULA: {
HOMEBREW_DISABLE_LOAD_FORMULA: {
description: "If set, refuse to load formulae. This is useful when formulae are not trusted (such " \
"as in pull requests).",
boolean: true,
},
HOMEBREW_DISPLAY: {
HOMEBREW_DISPLAY: {
description: "Use this X11 display when opening a page in a browser, for example with " \
"`brew home`. Primarily useful on Linux.",
default_text: "`$DISPLAY`.",
},
HOMEBREW_DISPLAY_INSTALL_TIMES: {
HOMEBREW_DISPLAY_INSTALL_TIMES: {
description: "If set, print install times for each formula at the end of the run.",
boolean: true,
},
HOMEBREW_EDITOR: {
HOMEBREW_EDITOR: {
description: "Use this editor when editing a single formula, or several formulae in the " \
"same directory." \
"\n\n *Note:* `brew edit` will open all of Homebrew as discontinuous files " \
@ -139,35 +139,35 @@ module Homebrew
"editors will do strange things in this case.",
default_text: "`$EDITOR` or `$VISUAL`.",
},
HOMEBREW_FAIL_LOG_LINES: {
HOMEBREW_FAIL_LOG_LINES: {
description: "Output this many lines of output on formula `system` failures.",
default: 15,
},
HOMEBREW_FORBIDDEN_LICENSES: {
HOMEBREW_FORBIDDEN_LICENSES: {
description: "A space-separated list of licenses. Homebrew will refuse to install a " \
"formula if it or any of its dependencies has a license on this list.",
},
HOMEBREW_FORCE_BREWED_CA_CERTIFICATES: {
HOMEBREW_FORCE_BREWED_CA_CERTIFICATES: {
description: "If set, always use a Homebrew-installed `ca-certificates` rather than the system version. " \
"Automatically set if the system version is too old.",
boolean: true,
},
HOMEBREW_FORCE_BREWED_CURL: {
HOMEBREW_FORCE_BREWED_CURL: {
description: "If set, always use a Homebrew-installed `curl`(1) rather than the system version. " \
"Automatically set if the system version of `curl` is too old.",
boolean: true,
},
HOMEBREW_FORCE_BREWED_GIT: {
HOMEBREW_FORCE_BREWED_GIT: {
description: "If set, always use a Homebrew-installed `git`(1) rather than the system version. " \
"Automatically set if the system version of `git` is too old.",
boolean: true,
},
HOMEBREW_FORCE_VENDOR_RUBY: {
HOMEBREW_FORCE_VENDOR_RUBY: {
description: "If set, always use Homebrew's vendored, relocatable Ruby version even if the system version " \
"of Ruby is new enough.",
boolean: true,
},
HOMEBREW_GITHUB_API_TOKEN: {
HOMEBREW_GITHUB_API_TOKEN: {
description: "Use this personal access token for the GitHub API, for features such as " \
"`brew search`. You can create one at <https://github.com/settings/tokens>. If set, " \
"GitHub will allow you a greater number of API requests. For more information, see: " \
@ -175,51 +175,51 @@ module Homebrew
"\n\n *Note:* Homebrew doesn't require permissions for any of the scopes, but some " \
"developer commands may require additional permissions.",
},
HOMEBREW_GITHUB_PACKAGES_TOKEN: {
HOMEBREW_GITHUB_PACKAGES_TOKEN: {
description: "Use this GitHub personal access token when accessing the GitHub Packages Registry "\
"(where bottles may be stored).",
},
HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN: {
HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN: {
description: "Use this base64 encoded username and password for authenticating with a Docker registry " \
"proxying GitHub Packages. If HOMEBREW_DOCKER_REGISTRY_TOKEN is set, it will be used instead.",
},
HOMEBREW_DOCKER_REGISTRY_TOKEN: {
HOMEBREW_DOCKER_REGISTRY_TOKEN: {
description: "Use this bearer token for authenticating with a Docker registry proxying GitHub Packages. " \
"Preferred over HOMEBREW_DOCKER_REGISTRY_TOKEN_BASIC.",
},
HOMEBREW_GITHUB_PACKAGES_USER: {
HOMEBREW_GITHUB_PACKAGES_USER: {
description: "Use this username when accessing the GitHub Packages Registry (where bottles may be stored).",
},
HOMEBREW_GIT_EMAIL: {
HOMEBREW_GIT_EMAIL: {
description: "Set the Git author and committer email to this value.",
},
HOMEBREW_GIT_NAME: {
HOMEBREW_GIT_NAME: {
description: "Set the Git author and committer name to this value.",
},
HOMEBREW_INSTALL_BADGE: {
HOMEBREW_INSTALL_BADGE: {
description: "Print this text before the installation summary of each successful build.",
default_text: 'The "Beer Mug" emoji.',
default: "🍺",
},
HOMEBREW_INSTALL_FROM_API: {
HOMEBREW_INSTALL_FROM_API: {
description: "If set, install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew's " \
"API instead of needing (large, slow) local checkouts of these repositories." \
"\n\n *Note:* Setting HOMEBREW_INSTALL_FROM_API is not compatible with Homebrew's " \
"developer mode so will error (as Homebrew development needs a full clone).",
boolean: true,
},
HOMEBREW_LIVECHECK_WATCHLIST: {
HOMEBREW_LIVECHECK_WATCHLIST: {
description: "Consult this file for the list of formulae to check by default when no formula argument " \
"is passed to `brew livecheck`.",
default: "$HOME/.brew_livecheck_watchlist",
},
HOMEBREW_LOGS: {
HOMEBREW_LOGS: {
description: "Use this directory to store log files.",
default_text: "macOS: `$HOME/Library/Logs/Homebrew`, " \
"Linux: `$XDG_CACHE_HOME/Homebrew/Logs` or `$HOME/.cache/Homebrew/Logs`.",
default: HOMEBREW_DEFAULT_LOGS,
},
HOMEBREW_MAKE_JOBS: {
HOMEBREW_MAKE_JOBS: {
description: "Use this value as the number of parallel jobs to run when building with `make`(1).",
default_text: "The number of available CPU cores.",
default: lambda {
@ -228,100 +228,100 @@ module Homebrew
Hardware::CPU.cores
},
},
HOMEBREW_NO_ANALYTICS: {
HOMEBREW_NO_ANALYTICS: {
description: "If set, do not send analytics. For more information, see: <https://docs.brew.sh/Analytics>",
boolean: true,
},
HOMEBREW_NO_AUTO_UPDATE: {
HOMEBREW_NO_AUTO_UPDATE: {
description: "If set, do not automatically update before running some commands, e.g. " \
"`brew install`, `brew upgrade` and `brew tap`. Alternatively, " \
"run this less often by setting HOMEBREW_AUTO_UPDATE_SECS to a value higher than the default.",
boolean: true,
},
HOMEBREW_NO_BOOTSNAP: {
HOMEBREW_NO_BOOTSNAP: {
description: "If set, do not use Bootsnap to speed up repeated `brew` calls.",
boolean: true,
},
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: {
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: {
description: "If set, do not check for broken linkage of dependents or outdated dependents after " \
"installing, upgrading or reinstalling formulae. This will result in fewer dependents " \
" (and their dependencies) being upgraded or reinstalled but may result in more breakage " \
"from running `brew install <formula>` or `brew upgrade <formula>`.",
boolean: true,
},
HOMEBREW_NO_CLEANUP_FORMULAE: {
HOMEBREW_NO_CLEANUP_FORMULAE: {
description: "A comma-separated list of formulae. Homebrew will refuse to clean up a " \
"formula if it appears on this list.",
},
HOMEBREW_NO_COLOR: {
HOMEBREW_NO_COLOR: {
description: "If set, do not print text with colour added.",
default_text: "`$NO_COLOR`.",
boolean: true,
},
HOMEBREW_NO_COMPAT: {
HOMEBREW_NO_COMPAT: {
description: "If set, disable all use of legacy compatibility code.",
boolean: true,
},
HOMEBREW_NO_EMOJI: {
HOMEBREW_NO_EMOJI: {
description: "If set, do not print `HOMEBREW_INSTALL_BADGE` on a successful build." \
"\n\n *Note:* Will only try to print emoji on OS X Lion or newer.",
boolean: true,
},
HOMEBREW_NO_ENV_HINTS: {
HOMEBREW_NO_ENV_HINTS: {
description: "If set, do not print any hints about changing Homebrew's behaviour with environment variables.",
boolean: true,
},
HOMEBREW_NO_GITHUB_API: {
HOMEBREW_NO_GITHUB_API: {
description: "If set, do not use the GitHub API, e.g. for searches or fetching relevant issues " \
"after a failed install.",
boolean: true,
},
HOMEBREW_NO_INSECURE_REDIRECT: {
HOMEBREW_NO_INSECURE_REDIRECT: {
description: "If set, forbid redirects from secure HTTPS to insecure HTTP." \
"\n\n *Note:* While ensuring your downloads are fully secure, this is likely to cause " \
"from-source SourceForge, some GNU & GNOME-hosted formulae to fail to download.",
boolean: true,
},
HOMEBREW_NO_INSTALL_CLEANUP: {
HOMEBREW_NO_INSTALL_CLEANUP: {
description: "If set, `brew install`, `brew upgrade` and `brew reinstall` will never automatically " \
"cleanup installed/upgraded/reinstalled formulae or all formulae every " \
"`HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS` days. Alternatively, HOMEBREW_NO_CLEANUP_FORMULAE " \
"allows specifying specific formulae to not clean up.",
boolean: true,
},
HOMEBREW_NO_INSTALL_UPGRADE: {
HOMEBREW_NO_INSTALL_UPGRADE: {
description: "If set, `brew install <formula>` will not upgrade `<formula>` if it is installed but " \
"outdated.",
boolean: true,
},
HOMEBREW_PRY: {
HOMEBREW_PRY: {
description: "If set, use Pry for the `brew irb` command.",
boolean: true,
},
HOMEBREW_SIMULATE_MACOS_ON_LINUX: {
HOMEBREW_SIMULATE_MACOS_ON_LINUX: {
description: "If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful " \
"when auditing macOS formulae while on Linux.",
boolean: true,
},
HOMEBREW_SSH_CONFIG_PATH: {
HOMEBREW_SSH_CONFIG_PATH: {
description: "If set, Homebrew will use the given config file instead of `~/.ssh/config` when fetching " \
"`git` repos over `ssh`.",
default_text: "`$HOME/.ssh/config`",
},
HOMEBREW_SKIP_OR_LATER_BOTTLES: {
HOMEBREW_SKIP_OR_LATER_BOTTLES: {
description: "If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions " \
"of macOS. This is useful in development on new macOS versions.",
boolean: true,
},
HOMEBREW_SORBET_RUNTIME: {
HOMEBREW_SORBET_RUNTIME: {
description: "If set, enable runtime typechecking using Sorbet.",
boolean: true,
},
HOMEBREW_SVN: {
HOMEBREW_SVN: {
description: "Use this as the `svn`(1) binary.",
default_text: "A Homebrew-built Subversion (if installed), or the system-provided binary.",
},
HOMEBREW_TEMP: {
HOMEBREW_TEMP: {
description: "Use this path as the temporary directory for building packages. Changing " \
"this may be needed if your system temporary directory and Homebrew prefix are on " \
"different volumes, as macOS has trouble moving symlinks across volumes when the target " \
@ -330,50 +330,46 @@ module Homebrew
default_text: "macOS: `/private/tmp`, Linux: `/tmp`.",
default: HOMEBREW_DEFAULT_TEMP,
},
HOMEBREW_UPDATE_REPORT_ALL_FORMULAE: {
description: "If set, `brew update` lists updates to all software.",
HOMEBREW_UPDATE_REPORT_ALL_FORMULAE: {
description: "If set, `brew update` lists changes to all formulae and cask files rather than only showing " \
"when they are installed or outdated.",
boolean: true,
},
HOMEBREW_UPDATE_REPORT_VERSION_CHANGED_FORMULAE: {
description: "If set, `brew update` only lists updates to formulae with differing versions. " \
"Note this is slower than the default behaviour.",
boolean: true,
},
HOMEBREW_UPDATE_TO_TAG: {
HOMEBREW_UPDATE_TO_TAG: {
description: "If set, always use the latest stable tag (even if developer commands " \
"have been run).",
boolean: true,
},
HOMEBREW_VERBOSE: {
HOMEBREW_VERBOSE: {
description: "If set, always assume `--verbose` when running commands.",
boolean: true,
},
HOMEBREW_DEBUG: {
HOMEBREW_DEBUG: {
description: "If set, always assume `--debug` when running commands.",
boolean: true,
},
HOMEBREW_VERBOSE_USING_DOTS: {
HOMEBREW_VERBOSE_USING_DOTS: {
description: "If set, verbose output will print a `.` no more than once a minute. This can be " \
"useful to avoid long-running Homebrew commands being killed due to no output.",
boolean: true,
},
all_proxy: {
all_proxy: {
description: "Use this SOCKS5 proxy for `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.",
},
ftp_proxy: {
ftp_proxy: {
description: "Use this FTP proxy for `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.",
},
http_proxy: {
http_proxy: {
description: "Use this HTTP proxy for `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.",
},
https_proxy: {
https_proxy: {
description: "Use this HTTPS proxy for `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.",
},
no_proxy: {
no_proxy: {
description: "A comma-separated list of hostnames and domain names excluded " \
"from proxying by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.",
},
SUDO_ASKPASS: {
SUDO_ASKPASS: {
description: "If set, pass the `-A` option when calling `sudo`(8).",
},
}.freeze

View File

@ -52,39 +52,39 @@ describe "brew update-report" do
specify "without Formula changes" do
perform_update("update_git_diff_output_without_formulae_changes")
expect(hub.select_formula(:M)).to be_empty
expect(hub.select_formula(:A)).to be_empty
expect(hub.select_formula(:D)).to be_empty
expect(hub.select_formula_or_cask(:M)).to be_empty
expect(hub.select_formula_or_cask(:A)).to be_empty
expect(hub.select_formula_or_cask(:D)).to be_empty
end
specify "with Formula changes" do
perform_update("update_git_diff_output_with_formulae_changes")
expect(hub.select_formula(:M)).to eq(%w[xar yajl])
expect(hub.select_formula(:A)).to eq(%w[antiword bash-completion ddrescue dict lua])
expect(hub.select_formula_or_cask(:M)).to eq(%w[xar yajl])
expect(hub.select_formula_or_cask(:A)).to eq(%w[antiword bash-completion ddrescue dict lua])
end
specify "with removed Formulae" do
perform_update("update_git_diff_output_with_removed_formulae")
expect(hub.select_formula(:D)).to eq(%w[libgsasl])
expect(hub.select_formula_or_cask(:D)).to eq(%w[libgsasl])
end
specify "with changed file type" do
perform_update("update_git_diff_output_with_changed_filetype")
expect(hub.select_formula(:M)).to eq(%w[elixir])
expect(hub.select_formula(:A)).to eq(%w[libbson])
expect(hub.select_formula(:D)).to eq(%w[libgsasl])
expect(hub.select_formula_or_cask(:M)).to eq(%w[elixir])
expect(hub.select_formula_or_cask(:A)).to eq(%w[libbson])
expect(hub.select_formula_or_cask(:D)).to eq(%w[libgsasl])
end
specify "with renamed Formula" do
allow(tap).to receive(:formula_renames).and_return("cv" => "progress")
perform_update("update_git_diff_output_with_formula_rename")
expect(hub.select_formula(:A)).to be_empty
expect(hub.select_formula(:D)).to be_empty
expect(hub.select_formula(:R)).to eq([["cv", "progress"]])
expect(hub.select_formula_or_cask(:A)).to be_empty
expect(hub.select_formula_or_cask(:D)).to be_empty
expect(hub.select_formula_or_cask(:R)).to eq([["cv", "progress"]])
end
context "when updating a Tap other than the core Tap" do
@ -101,34 +101,34 @@ describe "brew update-report" do
specify "with restructured Tap" do
perform_update("update_git_diff_output_with_restructured_tap")
expect(hub.select_formula(:A)).to be_empty
expect(hub.select_formula(:D)).to be_empty
expect(hub.select_formula(:R)).to be_empty
expect(hub.select_formula_or_cask(:A)).to be_empty
expect(hub.select_formula_or_cask(:D)).to be_empty
expect(hub.select_formula_or_cask(:R)).to be_empty
end
specify "with renamed Formula and restructured Tap" do
allow(tap).to receive(:formula_renames).and_return("xchat" => "xchat2")
perform_update("update_git_diff_output_with_formula_rename_and_restructuring")
expect(hub.select_formula(:A)).to be_empty
expect(hub.select_formula(:D)).to be_empty
expect(hub.select_formula(:R)).to eq([%w[foo/bar/xchat foo/bar/xchat2]])
expect(hub.select_formula_or_cask(:A)).to be_empty
expect(hub.select_formula_or_cask(:D)).to be_empty
expect(hub.select_formula_or_cask(:R)).to eq([%w[foo/bar/xchat foo/bar/xchat2]])
end
specify "with simulated 'homebrew/php' restructuring" do
perform_update("update_git_diff_simulate_homebrew_php_restructuring")
expect(hub.select_formula(:A)).to be_empty
expect(hub.select_formula(:D)).to be_empty
expect(hub.select_formula(:R)).to be_empty
expect(hub.select_formula_or_cask(:A)).to be_empty
expect(hub.select_formula_or_cask(:D)).to be_empty
expect(hub.select_formula_or_cask(:R)).to be_empty
end
specify "with Formula changes" do
perform_update("update_git_diff_output_with_tap_formulae_changes")
expect(hub.select_formula(:A)).to eq(%w[foo/bar/lua])
expect(hub.select_formula(:M)).to eq(%w[foo/bar/git])
expect(hub.select_formula(:D)).to be_empty
expect(hub.select_formula_or_cask(:A)).to eq(%w[foo/bar/lua])
expect(hub.select_formula_or_cask(:M)).to eq(%w[foo/bar/git])
expect(hub.select_formula_or_cask(:D)).to be_empty
end
end
end

View File

@ -25,7 +25,7 @@ describe DescriptionCacheStore do
end
describe "#update_from_report!" do
let(:report) { double(select_formula: [], empty?: false) }
let(:report) { double(select_formula_or_cask: [], empty?: false) }
it "reads from the report" do
expect(database).to receive(:empty?).at_least(:once).and_return(false)
@ -60,7 +60,7 @@ describe DescriptionCacheStore do
let(:database) { double("database") }
describe "#update_from_report!" do
let(:report) { double(select_formula: [], empty?: false) }
let(:report) { double(select_formula_or_cask: [], empty?: false) }
it "reads from the report" do
expect(database).to receive(:empty?).at_least(:once).and_return(false)

View File

@ -248,6 +248,16 @@ module Kernel
end
end
def pretty_outdated(f)
if !$stdout.tty?
f.to_s
elsif Homebrew::EnvConfig.no_emoji?
Formatter.error("#{Tty.bold}#{f} (outdated)#{Tty.reset}")
else
"#{Tty.bold}#{f} #{Formatter.warning("")}#{Tty.reset}"
end
end
def pretty_uninstalled(f)
if !$stdout.tty?
f.to_s

View File

@ -2172,10 +2172,7 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
*Default:* macOS: `/private/tmp`, Linux: `/tmp`.
- `HOMEBREW_UPDATE_REPORT_ALL_FORMULAE`
<br>If set, `brew update` lists updates to all software.
- `HOMEBREW_UPDATE_REPORT_VERSION_CHANGED_FORMULAE`
<br>If set, `brew update` only lists updates to formulae with differing versions. Note this is slower than the default behaviour.
<br>If set, `brew update` lists changes to all formulae and cask files rather than only showing when they are installed or outdated.
- `HOMEBREW_UPDATE_TO_TAG`
<br>If set, always use the latest stable tag (even if developer commands have been run).

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BREW" "1" "May 2022" "Homebrew" "brew"
.TH "BREW" "1" "June 2022" "Homebrew" "brew"
.
.SH "NAME"
\fBbrew\fR \- The Missing Package Manager for macOS (or Linux)
@ -3186,13 +3186,7 @@ Use this path as the temporary directory for building packages\. Changing this m
\fBHOMEBREW_UPDATE_REPORT_ALL_FORMULAE\fR
.
.br
If set, \fBbrew update\fR lists updates to all software\.
.
.TP
\fBHOMEBREW_UPDATE_REPORT_VERSION_CHANGED_FORMULAE\fR
.
.br
If set, \fBbrew update\fR only lists updates to formulae with differing versions\. Note this is slower than the default behaviour\.
If set, \fBbrew update\fR lists changes to all formulae and cask files rather than only showing when they are installed or outdated\.
.
.TP
\fBHOMEBREW_UPDATE_TO_TAG\fR