-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revamp installed_on_request handling #18768
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previous logic may be preferred so that e.g. the installed-on-request status of $ brew install ruby
$ brew install openssl@3 And result would be different by changing order: $ brew install openssl@3
$ brew install ruby |
||
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:, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
Comment on lines
147
to
+148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't have to be in this PR, but one way of preserving original tab in case of migration via alias (not rename) is adding a fallback for brew(main):001> Formula["pkg-config"].opt_prefix
=> #<Pathname:/usr/local/opt/pkgconf>
brew(main):002> Formula["pkg-config"].optlinked?
=> false
brew(main):003> Formula["pkg-config"].installed_kegs.find(&:optlinked?)
=> #<Keg:/usr/local/Cellar/pkg-config/0.29.2_3>
brew(main):004> Formula["pkg-config"].installed_kegs.find(&:optlinked?).tab.installed_as_dependency
=> true
brew(main):005> Formula["pkg-config"].installed_kegs.find(&:optlinked?).tab.installed_on_request
=> false So maybe: keg = if formula.optlinked?
Keg.new(formula.opt_prefix.resolved_path)
else
formula.installed_kegs.find(&:optlinked?)
end |
||
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, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a scenario of
brew reinstall <not-installed-formula>
. Previously, this would behave likebrew install
. With change, the installed formula will be neither installed on request nor a dependency, so will be deleted on nextbrew autoremove