Merge pull request #11963 from FnControlOption/install

install: fetch all formulae before install
This commit is contained in:
Mike McQuaid 2021-09-02 12:52:17 +01:00 committed by GitHub
commit e3f851d0ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 50 deletions

View File

@ -202,28 +202,24 @@ module Homebrew
Install.perform_preinstall_checks(cc: args.cc) Install.perform_preinstall_checks(cc: args.cc)
installed_formulae.each do |f| Install.install_formulae(
Migrator.migrate_if_needed(f, force: args.force?) installed_formulae,
Install.install_formula( build_bottle: args.build_bottle?,
f, force_bottle: args.force_bottle?,
build_bottle: args.build_bottle?, bottle_arch: args.bottle_arch,
force_bottle: args.force_bottle?, ignore_deps: args.ignore_dependencies?,
bottle_arch: args.bottle_arch, only_deps: args.only_dependencies?,
ignore_deps: args.ignore_dependencies?, include_test_formulae: args.include_test_formulae,
only_deps: args.only_dependencies?, build_from_source_formulae: args.build_from_source_formulae,
include_test_formulae: args.include_test_formulae, cc: args.cc,
build_from_source_formulae: args.build_from_source_formulae, git: args.git?,
cc: args.cc, interactive: args.interactive?,
git: args.git?, keep_tmp: args.keep_tmp?,
interactive: args.interactive?, force: args.force?,
keep_tmp: args.keep_tmp?, debug: args.debug?,
force: args.force?, quiet: args.quiet?,
debug: args.debug?, verbose: args.verbose?,
quiet: args.quiet?, )
verbose: args.verbose?,
)
Cleanup.install_formula_clean!(f)
end
Upgrade.check_installed_dependents( Upgrade.check_installed_dependents(
installed_formulae, installed_formulae,

View File

@ -229,8 +229,8 @@ module Homebrew
false false
end end
def install_formula( def install_formulae(
f, formulae_to_install,
build_bottle: false, build_bottle: false,
force_bottle: false, force_bottle: false,
bottle_arch: nil, bottle_arch: nil,
@ -247,28 +247,49 @@ module Homebrew
quiet: false, quiet: false,
verbose: false verbose: false
) )
f.print_tap_action formula_installers = formulae_to_install.map do |f|
build_options = f.build Migrator.migrate_if_needed(f, force: force)
build_options = f.build
fi = FormulaInstaller.new( fi = FormulaInstaller.new(
f, f,
options: build_options.used_options, options: build_options.used_options,
build_bottle: build_bottle, build_bottle: build_bottle,
force_bottle: force_bottle, force_bottle: force_bottle,
bottle_arch: bottle_arch, bottle_arch: bottle_arch,
ignore_deps: ignore_deps, ignore_deps: ignore_deps,
only_deps: only_deps, only_deps: only_deps,
include_test_formulae: include_test_formulae, include_test_formulae: include_test_formulae,
build_from_source_formulae: build_from_source_formulae, build_from_source_formulae: build_from_source_formulae,
cc: cc, cc: cc,
git: git, git: git,
interactive: interactive, interactive: interactive,
keep_tmp: keep_tmp, keep_tmp: keep_tmp,
force: force, force: force,
debug: debug, debug: debug,
quiet: quiet, quiet: quiet,
verbose: verbose, verbose: verbose,
) )
begin
fi.fetch
fi
rescue UnsatisfiedRequirements, DownloadError, ChecksumMismatchError => e
ofail "#{f}: #{e}"
nil
end
end.compact
formula_installers.each do |fi|
install_formula(fi, only_deps: only_deps)
Cleanup.install_formula_clean!(fi.formula)
end
end
def install_formula(formula_installer, only_deps: false)
f = formula_installer.formula
f.print_tap_action
if f.linked_keg.directory? if f.linked_keg.directory?
if Homebrew::EnvConfig.no_install_upgrade? if Homebrew::EnvConfig.no_install_upgrade?
@ -291,17 +312,16 @@ module Homebrew
puts "#{f.name} #{f.linked_version} is installed but outdated" puts "#{f.name} #{f.linked_version} is installed but outdated"
kegs = Upgrade.outdated_kegs(f) kegs = Upgrade.outdated_kegs(f)
linked_kegs = kegs.select(&:linked?) linked_kegs = kegs.select(&:linked?)
Upgrade.print_upgrade_message(f, fi.options) Upgrade.print_upgrade_message(f, formula_installer.options)
end end
end end
fi.prelude formula_installer.prelude
fi.fetch
kegs.each(&:unlink) if kegs.present? kegs.each(&:unlink) if kegs.present?
fi.install formula_installer.install
fi.finish formula_installer.finish
rescue FormulaInstallationAlreadyAttemptedError rescue FormulaInstallationAlreadyAttemptedError
# We already attempted to install f as part of the dependency tree of # We already attempted to install f as part of the dependency tree of
# another formula. In that case, don't generate an error, just move on. # another formula. In that case, don't generate an error, just move on.
@ -316,6 +336,7 @@ module Homebrew
nil nil
end end
end end
private_class_method :install_formula
end end
end end