File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ def self.fetch(name)
2828 Homebrew ::API . fetch "formula/#{ name } .json"
2929 end
3030
31- sig { params ( formula : ::Formula ) . returns ( :: Formula ) }
32- def self . source_download ( formula )
31+ sig { params ( formula : ::Formula , download_queue : T . nilable ( Homebrew :: DownloadQueue ) ) . returns ( Homebrew :: API :: SourceDownload ) }
32+ def self . source_download ( formula , download_queue : nil )
3333 path = formula . ruby_source_path || "Formula/#{ formula . name } .rb"
3434 git_head = formula . tap_git_head || "HEAD"
3535 tap = formula . tap &.full_name || "Homebrew/homebrew-core"
@@ -39,7 +39,19 @@ def self.source_download(formula)
3939 formula . ruby_source_checksum ,
4040 cache : HOMEBREW_CACHE_API_SOURCE /"#{ tap } /#{ git_head } /Formula" ,
4141 )
42- download . fetch
42+
43+ if download_queue
44+ download_queue . enqueue ( download )
45+ elsif !download . cache . exist?
46+ download . fetch
47+ end
48+
49+ download
50+ end
51+
52+ sig { params ( formula : ::Formula ) . returns ( ::Formula ) }
53+ def self . source_download_formula ( formula )
54+ download = source_download ( formula )
4355
4456 with_env ( HOMEBREW_FORBID_PACKAGES_FROM_PATHS : nil ) do
4557 Formulary . factory ( download . symlink_location ,
Original file line number Diff line number Diff line change @@ -317,8 +317,12 @@ def prelude_fetch
317317 end
318318 end
319319
320- # Needs to be done before expand_dependencies for compute_dependencies
321- fetch_bottle_tab if pour_bottle?
320+ if pour_bottle?
321+ # Needs to be done before expand_dependencies for compute_dependencies
322+ fetch_bottle_tab
323+ elsif formula . loaded_from_api?
324+ Homebrew ::API ::Formula . source_download ( formula , download_queue :)
325+ end
322326
323327 fetch_fetch_deps unless ignore_deps?
324328
@@ -1446,7 +1450,7 @@ def fetch
14461450
14471451 !downloadable_object . cached_download . exist?
14481452 else
1449- @formula = Homebrew ::API ::Formula . source_download ( formula ) if formula . loaded_from_api?
1453+ @formula = Homebrew ::API ::Formula . source_download_formula ( formula ) if formula . loaded_from_api?
14501454
14511455 if ( download_queue = self . download_queue )
14521456 formula . enqueue_resources_and_patches ( download_queue :)
You can’t perform that action at this time.
0 commit comments