brew/Library/Homebrew/extend/os/linux/cmd/update-report.rb
Mike McQuaid 9de0b619f3
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
2023-03-27 17:24:32 +01:00

39 lines
952 B
Ruby

# typed: true
# frozen_string_literal: true
module Homebrew
extend T::Sig
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"
Formula.installed.each do |formula|
next unless formula.tap&.core_tap?
recursive_runtime_dependencies = Dependency.expand(
formula,
cache_key: "update-report",
) do |_, dependency|
Dependency.prune if dependency.build? || dependency.test?
end
next unless recursive_runtime_dependencies.map(&:name).include? "gcc"
keg = formula.installed_kegs.last
tab = Tab.for_keg(keg)
# Force reinstallation upon `brew upgrade` to fix the bottle RPATH.
tab.source["versions"]["version_scheme"] = -1
tab.write
rescue TapFormulaUnavailableError
nil
end
Settings.write "gcc-rpaths.fixed", true
end
end