From 57c41bbb90dc4e230bae30086b7d5a93edaac239 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 13 Nov 2024 17:31:11 +0000 Subject: [PATCH] Revamp installed_on_request handling - `reinstall` and `upgrade` no longer mark as installed on request, with or without names specified, but preserve the version from the tab instead - default `install_on_request` to `false` rather than `true` - only set installed in request in a tab if it's missing rather than false --- Library/Homebrew/cmd/reinstall.rb | 2 -- Library/Homebrew/cmd/upgrade.rb | 2 -- Library/Homebrew/formula_installer.rb | 2 +- Library/Homebrew/install.rb | 4 +++- Library/Homebrew/reinstall.rb | 3 +-- Library/Homebrew/upgrade.rb | 6 +----- 6 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index bacf33beaac90..6c660560076d3 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -138,7 +138,6 @@ def run Homebrew::Reinstall.reinstall_formula( formula, flags: args.flags_only, - installed_on_request: args.named.present?, force_bottle: args.force_bottle?, build_from_source_formulae: args.build_from_source_formulae, interactive: args.interactive?, @@ -156,7 +155,6 @@ def run Upgrade.check_installed_dependents( formulae, flags: args.flags_only, - installed_on_request: args.named.present?, force_bottle: args.force_bottle?, build_from_source_formulae: args.build_from_source_formulae, interactive: args.interactive?, diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index cf17914f10d53..5511cd71e0d4d 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -220,7 +220,6 @@ def upgrade_outdated_formulae(formulae) formulae_to_install, flags: args.flags_only, dry_run: args.dry_run?, - installed_on_request: args.named.present?, force_bottle: args.force_bottle?, build_from_source_formulae: args.build_from_source_formulae, interactive: args.interactive?, @@ -237,7 +236,6 @@ def upgrade_outdated_formulae(formulae) formulae_to_install, flags: args.flags_only, dry_run: args.dry_run?, - installed_on_request: args.named.present?, force_bottle: args.force_bottle?, build_from_source_formulae: args.build_from_source_formulae, interactive: args.interactive?, diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index c26e12b424013..e28e83d0bd94c 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -84,7 +84,7 @@ def initialize( formula, link_keg: false, installed_as_dependency: false, - installed_on_request: true, + installed_on_request: false, show_header: false, build_bottle: false, skip_post_install: false, diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index bf03c18c070fb..99e037ada6498 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -222,7 +222,7 @@ def install_formula?( keg = Keg.new(formula.opt_prefix.resolved_path) tab = keg.tab - unless tab.installed_on_request + if tab.installed_on_request.nil? tab.installed_on_request = true tab.write end @@ -259,6 +259,8 @@ def install_formulae( formula_installer = FormulaInstaller.new( formula, options: build_options.used_options, + installed_on_request: true, + installed_as_dependency: false, build_bottle:, force_bottle:, bottle_arch:, diff --git a/Library/Homebrew/reinstall.rb b/Library/Homebrew/reinstall.rb index 6e5ba2613144e..9cac4ec65301c 100644 --- a/Library/Homebrew/reinstall.rb +++ b/Library/Homebrew/reinstall.rb @@ -10,7 +10,6 @@ module Reinstall def self.reinstall_formula( formula, flags:, - installed_on_request: false, force_bottle: false, build_from_source_formulae: [], interactive: false, @@ -41,7 +40,7 @@ def self.reinstall_formula( options:, link_keg: keg_had_linked_opt ? keg_was_linked : nil, installed_as_dependency: tab&.installed_as_dependency, - installed_on_request: installed_on_request || tab&.installed_on_request, + installed_on_request: tab&.installed_on_request, build_bottle: tab&.built_bottle?, force_bottle:, build_from_source_formulae:, diff --git a/Library/Homebrew/upgrade.rb b/Library/Homebrew/upgrade.rb index 8fa8df49adfaa..1243714683d8a 100644 --- a/Library/Homebrew/upgrade.rb +++ b/Library/Homebrew/upgrade.rb @@ -15,7 +15,6 @@ def self.upgrade_formulae( formulae_to_install, flags:, dry_run: false, - installed_on_request: false, force_bottle: false, build_from_source_formulae: [], dependents: false, @@ -55,7 +54,6 @@ def self.upgrade_formulae( fi = create_formula_installer( formula, flags:, - installed_on_request:, force_bottle:, build_from_source_formulae:, interactive:, @@ -114,7 +112,6 @@ def self.upgrade_formulae( private_class_method def self.create_formula_installer( formula, flags:, - installed_on_request: false, force_bottle: false, build_from_source_formulae: [], interactive: false, @@ -148,7 +145,7 @@ def self.upgrade_formulae( options:, link_keg: keg_had_linked_opt ? keg_was_linked : nil, installed_as_dependency: tab&.installed_as_dependency, - installed_on_request: installed_on_request || tab&.installed_on_request, + installed_on_request: tab&.installed_on_request, build_bottle: tab&.built_bottle?, force_bottle:, build_from_source_formulae:, @@ -338,7 +335,6 @@ def self.check_installed_dependents( upgrade_formulae( upgradeable_dependents, flags:, - installed_on_request:, force_bottle:, build_from_source_formulae:, dependents: true,