Skip to content

Commit

Permalink
formula_installer: preinstall any pre-fetch dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
EricFromCanada committed Nov 9, 2021
1 parent d0de6ac commit 508b48d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Library/Homebrew/dependency_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def fetch(spec)
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
Expand Down Expand Up @@ -148,7 +148,7 @@ def resource_dep(spec, tags)
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)
Expand Down
14 changes: 14 additions & 0 deletions Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def prelude
forbidden_license_check

check_install_sanity
install_fetch_deps unless ignore_deps?
end

sig { void }
Expand Down Expand Up @@ -343,6 +344,19 @@ def check_install_sanity
"#{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
Expand Down

0 comments on commit 508b48d

Please sign in to comment.