Merge pull request #12933 from Homebrew/revert-12910-update_report_only_installed_default
Revert "update-report: default HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED to on."
This commit is contained in:
commit
ffc76654da
@ -331,6 +331,9 @@ class Reporter
|
|||||||
|
|
||||||
if paths.any? { |p| tap.cask_file?(p) }
|
if paths.any? { |p| tap.cask_file?(p) }
|
||||||
case status
|
case status
|
||||||
|
when "A"
|
||||||
|
# Have a dedicated report array for new casks.
|
||||||
|
@report[:AC] << tap.formula_file_to_name(src)
|
||||||
when "D"
|
when "D"
|
||||||
# Have a dedicated report array for deleted casks.
|
# Have a dedicated report array for deleted casks.
|
||||||
@report[:DC] << tap.formula_file_to_name(src)
|
@report[:DC] << tap.formula_file_to_name(src)
|
||||||
@ -413,11 +416,9 @@ class Reporter
|
|||||||
if renamed_formulae.present?
|
if renamed_formulae.present?
|
||||||
@report[:A] -= renamed_formulae.map(&:last)
|
@report[:A] -= renamed_formulae.map(&:last)
|
||||||
@report[:D] -= renamed_formulae.map(&:first)
|
@report[:D] -= renamed_formulae.map(&:first)
|
||||||
|
@report[:R] = renamed_formulae.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
# Only needed additions for calculating deletions correctly based on renames.
|
|
||||||
@report.delete(:A)
|
|
||||||
|
|
||||||
@report
|
@report
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -568,18 +569,18 @@ class ReporterHub
|
|||||||
delegate empty?: :@hash
|
delegate empty?: :@hash
|
||||||
|
|
||||||
def dump(updated_formula_report: true)
|
def dump(updated_formula_report: true)
|
||||||
if ENV["HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED"]
|
|
||||||
opoo "HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED can be unset, it is now the default!"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Key Legend: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R)
|
# Key Legend: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R)
|
||||||
|
|
||||||
|
dump_formula_report :A, "New Formulae"
|
||||||
if updated_formula_report
|
if updated_formula_report
|
||||||
dump_formula_report :M, "Updated Formulae"
|
dump_formula_report :M, "Updated Formulae"
|
||||||
else
|
else
|
||||||
updated = select_formula(:M).count
|
updated = select_formula(:M).count
|
||||||
ohai "Updated Formulae", "Updated #{updated} #{"formula".pluralize(updated)}." if updated.positive?
|
ohai "Updated Formulae", "Updated #{updated} #{"formula".pluralize(updated)}." if updated.positive?
|
||||||
end
|
end
|
||||||
|
dump_formula_report :R, "Renamed Formulae"
|
||||||
dump_formula_report :D, "Deleted Formulae"
|
dump_formula_report :D, "Deleted Formulae"
|
||||||
|
dump_formula_report :AC, "New Casks"
|
||||||
if updated_formula_report
|
if updated_formula_report
|
||||||
dump_formula_report :MC, "Updated Casks"
|
dump_formula_report :MC, "Updated Casks"
|
||||||
else
|
else
|
||||||
@ -592,13 +593,34 @@ class ReporterHub
|
|||||||
private
|
private
|
||||||
|
|
||||||
def dump_formula_report(key, title)
|
def dump_formula_report(key, title)
|
||||||
formulae = select_formula(key).sort.map do |name, _new_name|
|
only_installed = Homebrew::EnvConfig.update_report_only_installed?
|
||||||
|
|
||||||
|
formulae = select_formula(key).sort.map do |name, new_name|
|
||||||
|
# Format list items of renamed formulae
|
||||||
case key
|
case key
|
||||||
|
when :R
|
||||||
|
unless only_installed
|
||||||
|
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)
|
||||||
|
when :AC
|
||||||
|
name.split("/").last if !only_installed && !cask_installed?(name)
|
||||||
when :MC, :DC
|
when :MC, :DC
|
||||||
name = name.split("/").last
|
name = name.split("/").last
|
||||||
pretty_installed(name) if cask_installed?(name)
|
if cask_installed?(name)
|
||||||
when :M, :D
|
pretty_installed(name)
|
||||||
pretty_installed(name) if installed?(name)
|
elsif !only_installed
|
||||||
|
name
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if installed?(name)
|
||||||
|
pretty_installed(name)
|
||||||
|
elsif !only_installed
|
||||||
|
name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end.compact
|
end.compact
|
||||||
|
|
||||||
|
|||||||
@ -325,6 +325,10 @@ module Homebrew
|
|||||||
default_text: "macOS: `/private/tmp`, Linux: `/tmp`.",
|
default_text: "macOS: `/private/tmp`, Linux: `/tmp`.",
|
||||||
default: HOMEBREW_DEFAULT_TEMP,
|
default: HOMEBREW_DEFAULT_TEMP,
|
||||||
},
|
},
|
||||||
|
HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED: {
|
||||||
|
description: "If set, `brew update` only lists updates to installed software.",
|
||||||
|
boolean: true,
|
||||||
|
},
|
||||||
HOMEBREW_UPDATE_TO_TAG: {
|
HOMEBREW_UPDATE_TO_TAG: {
|
||||||
description: "If set, always use the latest stable tag (even if developer commands " \
|
description: "If set, always use the latest stable tag (even if developer commands " \
|
||||||
"have been run).",
|
"have been run).",
|
||||||
|
|||||||
@ -2626,6 +2626,8 @@ module Homebrew::EnvConfig
|
|||||||
|
|
||||||
def self.temp(); end
|
def self.temp(); end
|
||||||
|
|
||||||
|
def self.update_report_only_installed?(); end
|
||||||
|
|
||||||
def self.update_to_tag?(); end
|
def self.update_to_tag?(); end
|
||||||
|
|
||||||
def self.verbose?(); end
|
def self.verbose?(); end
|
||||||
|
|||||||
@ -53,6 +53,7 @@ describe "brew update-report" do
|
|||||||
perform_update("update_git_diff_output_without_formulae_changes")
|
perform_update("update_git_diff_output_without_formulae_changes")
|
||||||
|
|
||||||
expect(hub.select_formula(:M)).to be_empty
|
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(:D)).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -60,6 +61,7 @@ describe "brew update-report" do
|
|||||||
perform_update("update_git_diff_output_with_formulae_changes")
|
perform_update("update_git_diff_output_with_formulae_changes")
|
||||||
|
|
||||||
expect(hub.select_formula(:M)).to eq(%w[xar yajl])
|
expect(hub.select_formula(:M)).to eq(%w[xar yajl])
|
||||||
|
expect(hub.select_formula(:A)).to eq(%w[antiword bash-completion ddrescue dict lua])
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "with removed Formulae" do
|
specify "with removed Formulae" do
|
||||||
@ -72,6 +74,7 @@ describe "brew update-report" do
|
|||||||
perform_update("update_git_diff_output_with_changed_filetype")
|
perform_update("update_git_diff_output_with_changed_filetype")
|
||||||
|
|
||||||
expect(hub.select_formula(:M)).to eq(%w[elixir])
|
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(:D)).to eq(%w[libgsasl])
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -79,7 +82,9 @@ describe "brew update-report" do
|
|||||||
allow(tap).to receive(:formula_renames).and_return("cv" => "progress")
|
allow(tap).to receive(:formula_renames).and_return("cv" => "progress")
|
||||||
perform_update("update_git_diff_output_with_formula_rename")
|
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(:D)).to be_empty
|
||||||
|
expect(hub.select_formula(:R)).to eq([["cv", "progress"]])
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when updating a Tap other than the core Tap" do
|
context "when updating a Tap other than the core Tap" do
|
||||||
@ -96,25 +101,32 @@ describe "brew update-report" do
|
|||||||
specify "with restructured Tap" do
|
specify "with restructured Tap" do
|
||||||
perform_update("update_git_diff_output_with_restructured_tap")
|
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(:D)).to be_empty
|
||||||
|
expect(hub.select_formula(:R)).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "with renamed Formula and restructured Tap" do
|
specify "with renamed Formula and restructured Tap" do
|
||||||
allow(tap).to receive(:formula_renames).and_return("xchat" => "xchat2")
|
allow(tap).to receive(:formula_renames).and_return("xchat" => "xchat2")
|
||||||
perform_update("update_git_diff_output_with_formula_rename_and_restructuring")
|
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(:D)).to be_empty
|
||||||
|
expect(hub.select_formula(:R)).to eq([%w[foo/bar/xchat foo/bar/xchat2]])
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "with simulated 'homebrew/php' restructuring" do
|
specify "with simulated 'homebrew/php' restructuring" do
|
||||||
perform_update("update_git_diff_simulate_homebrew_php_restructuring")
|
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(:D)).to be_empty
|
||||||
|
expect(hub.select_formula(:R)).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "with Formula changes" do
|
specify "with Formula changes" do
|
||||||
perform_update("update_git_diff_output_with_tap_formulae_changes")
|
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(:M)).to eq(%w[foo/bar/git])
|
||||||
expect(hub.select_formula(:D)).to be_empty
|
expect(hub.select_formula(:D)).to be_empty
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user