More update tweaks
- Make copying to `*_names.before.txt` the responsibility of `update.sh` (unless the file doesn't exist at all). This provides the added benefit of allowing the inspection of the before/after state after running a `brew update` rather than both files always being identical at this point. - State `No changes to formulae or casks.` on macOS. - Rename and flip `updated_formula_report` to `auto_update`; this naming was confusing every time. - Only display the `You can upgrade with...` messaging if we're not auto-updating as sometimes it will be displayed before the commands it references (e.g. `upgrade`, `outdated` or an `install` that proceeds to upgrade these formulae). Fixes https://github.com/Homebrew/brew/issues/15065
This commit is contained in:
parent
cf6614b50e
commit
9de0b619f3
@ -225,9 +225,9 @@ module Homebrew
|
||||
updated_taps << tap.name
|
||||
hub.add(reporter, auto_update: args.auto_update?)
|
||||
end
|
||||
else
|
||||
FileUtils.cp names_txt, names_before_txt
|
||||
end
|
||||
|
||||
FileUtils.cp names_txt, names_before_txt
|
||||
end
|
||||
end
|
||||
|
||||
@ -239,14 +239,14 @@ module Homebrew
|
||||
|
||||
if updated
|
||||
if hub.empty?
|
||||
puts "No changes to formulae." unless args.quiet?
|
||||
puts no_changes_message unless args.quiet?
|
||||
else
|
||||
if ENV.fetch("HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED", false)
|
||||
opoo "HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED is now the default behaviour, " \
|
||||
"so you can unset it from your environment."
|
||||
end
|
||||
|
||||
hub.dump(updated_formula_report: !args.auto_update?) unless args.quiet?
|
||||
hub.dump(auto_update: 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?) }
|
||||
|
||||
@ -303,6 +303,10 @@ module Homebrew
|
||||
EOS
|
||||
end
|
||||
|
||||
def no_changes_message
|
||||
"No changes to formulae or casks."
|
||||
end
|
||||
|
||||
def shorten_revision(revision)
|
||||
Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "rev-parse", "--short", revision).chomp
|
||||
end
|
||||
@ -627,7 +631,7 @@ class ReporterHub
|
||||
|
||||
delegate empty?: :@hash
|
||||
|
||||
def dump(updated_formula_report: true)
|
||||
def dump(auto_update: false)
|
||||
report_all = ENV["HOMEBREW_UPDATE_REPORT_ALL_FORMULAE"].present?
|
||||
if report_all && !Homebrew::EnvConfig.no_install_from_api?
|
||||
odeprecated "HOMEBREW_UPDATE_REPORT_ALL_FORMULAE"
|
||||
@ -644,10 +648,10 @@ class ReporterHub
|
||||
outdated_formulae = []
|
||||
outdated_casks = []
|
||||
|
||||
if updated_formula_report && report_all
|
||||
if !auto_update && report_all
|
||||
dump_modified_formula_report
|
||||
dump_modified_cask_report
|
||||
elsif updated_formula_report
|
||||
elsif !auto_update
|
||||
outdated_formulae = Formula.installed.select(&:outdated?).map(&:name)
|
||||
output_dump_formula_or_cask_report "Outdated Formulae", outdated_formulae
|
||||
|
||||
@ -695,6 +699,12 @@ class ReporterHub
|
||||
puts
|
||||
puts <<~EOS
|
||||
You have #{msg} installed.
|
||||
EOS
|
||||
# If we're auto-updating, don't need to suggest commands that we're perhaps
|
||||
# already running.
|
||||
return if auto_update
|
||||
|
||||
puts <<~EOS
|
||||
You can upgrade #{update_pronoun} with #{Tty.bold}brew upgrade#{Tty.reset}
|
||||
or list #{update_pronoun} with #{Tty.bold}brew outdated#{Tty.reset}.
|
||||
EOS
|
||||
|
||||
@ -811,7 +811,12 @@ EOS
|
||||
CURRENT_JSON_BYTESIZE="$(wc -c "${HOMEBREW_CACHE}"/api/"${formula_or_cask}".jws.json)"
|
||||
if [[ "${INITIAL_JSON_BYTESIZE}" != "${CURRENT_JSON_BYTESIZE}" ]]
|
||||
then
|
||||
rm -f "${HOMEBREW_CACHE}/api/${formula_or_cask}_names.txt"
|
||||
if [[ -f "${HOMEBREW_CACHE}/api/${formula_or_cask}_names.txt" ]]
|
||||
then
|
||||
mv -f "${HOMEBREW_CACHE}/api/${formula_or_cask}_names.txt" \
|
||||
"${HOMEBREW_CACHE}/api/${formula_or_cask}_names.before.txt"
|
||||
fi
|
||||
|
||||
if [[ "${formula_or_cask}" == "formula" ]]
|
||||
then
|
||||
rm -f "${HOMEBREW_CACHE}/api/formula_aliases.txt"
|
||||
|
||||
@ -6,6 +6,10 @@ module Homebrew
|
||||
|
||||
module_function
|
||||
|
||||
def no_changes_message
|
||||
"No changes to formulae."
|
||||
end
|
||||
|
||||
def migrate_gcc_dependents_if_needed
|
||||
return if Settings.read("gcc-rpaths.fixed") == "true"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user