formula_installer: preinstall any pre-fetch dependencies

This commit is contained in:
EricFromCanada 2021-11-03 18:26:11 -04:00
parent d0de6ac249
commit 508b48d19e
No known key found for this signature in database
GPG Key ID: 179D9CDDDB814168
2 changed files with 16 additions and 2 deletions

View File

@ -45,7 +45,7 @@ class DependencyCollector
end
def cache_key(spec)
if spec.is_a?(Resource) && spec.download_strategy == CurlDownloadStrategy
if spec.is_a?(Resource) && spec.download_strategy <= CurlDownloadStrategy
File.extname(spec.url)
else
spec
@ -148,7 +148,7 @@ class DependencyCollector
strategy = spec.download_strategy
if strategy <= HomebrewCurlDownloadStrategy
brewed_curl_dep_if_needed(tags)
@deps << brewed_curl_dep_if_needed(tags)
parse_url_spec(spec.url, tags)
elsif strategy <= CurlDownloadStrategy
parse_url_spec(spec.url, tags)

View File

@ -215,6 +215,7 @@ class FormulaInstaller
forbidden_license_check
check_install_sanity
install_fetch_deps unless ignore_deps?
end
sig { void }
@ -343,6 +344,19 @@ class FormulaInstaller
"#{formula.full_name} requires the latest version of pinned dependencies"
end
sig { void }
def install_fetch_deps
return if @compute_dependencies.blank?
compute_dependencies(use_cache: false) if @compute_dependencies.any? do |dep, options|
next false unless dep.tags == [:build, :test]
fetch_dependencies
install_dependency(dep, options)
true
end
end
def build_bottle_preinstall
@etc_var_dirs ||= [HOMEBREW_PREFIX/"etc", HOMEBREW_PREFIX/"var"]
@etc_var_preinstall = Find.find(*@etc_var_dirs.select(&:directory?)).to_a