| 
									
										
										
										
											2023-03-06 09:49:53 -08:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  | require "formula" | 
					
						
							| 
									
										
										
										
											2018-06-05 23:19:18 -04:00
										 |  |  | require "fetch" | 
					
						
							| 
									
										
										
										
											2019-04-17 18:25:08 +09:00
										 |  |  | require "cli/parser" | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  | require "cask/download" | 
					
						
							| 
									
										
										
										
											2011-03-12 09:40:10 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2020-07-23 02:43:22 +02:00
										 |  |  |   extend Fetch | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-06 01:25:34 +08:00
										 |  |  |   FETCH_MAX_TRIES = 5
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   sig { returns(CLI::Parser) } | 
					
						
							| 
									
										
										
										
											2023-03-06 09:49:53 -08:00
										 |  |  |   def self.fetch_args | 
					
						
							| 
									
										
										
										
											2018-10-27 23:44:32 +05:30
										 |  |  |     Homebrew::CLI::Parser.new do | 
					
						
							| 
									
										
										
										
											2021-01-15 15:04:02 -05:00
										 |  |  |       description <<~EOS | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |         Download a bottle (if available) or source packages for <formula>e | 
					
						
							|  |  |  |         and binaries for <cask>s. For files, also print SHA-256 checksums. | 
					
						
							| 
									
										
										
										
											2018-10-27 23:44:32 +05:30
										 |  |  |       EOS | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |       flag   "--os=", | 
					
						
							|  |  |  |              description: "Download for the given operating system." \ | 
					
						
							|  |  |  |                           "(Pass `all` to download for all operating systems.)" | 
					
						
							|  |  |  |       flag   "--arch=", | 
					
						
							|  |  |  |              description: "Download for the given CPU architecture." \ | 
					
						
							|  |  |  |                           "(Pass `all` to download for all architectures.)" | 
					
						
							|  |  |  |       flag   "--bottle-tag=", | 
					
						
							|  |  |  |              description: "Download a bottle for given tag." | 
					
						
							| 
									
										
										
										
											2018-10-27 23:44:32 +05:30
										 |  |  |       switch "--HEAD", | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |              description: "Fetch HEAD version instead of stable version." | 
					
						
							| 
									
										
										
										
											2020-07-27 03:59:52 +02:00
										 |  |  |       switch "-f", "--force", | 
					
						
							| 
									
										
										
										
											2019-08-09 14:23:04 -04:00
										 |  |  |              description: "Remove a previously cached version and re-fetch." | 
					
						
							| 
									
										
										
										
											2020-07-30 18:40:10 +02:00
										 |  |  |       switch "-v", "--verbose", | 
					
						
							| 
									
										
										
										
											2022-06-28 10:09:59 +01:00
										 |  |  |              description: "Do a verbose VCS checkout, if the URL represents a VCS. This is useful for " \ | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |                           "seeing if an existing VCS cache has been updated." | 
					
						
							| 
									
										
										
										
											2018-10-27 23:44:32 +05:30
										 |  |  |       switch "--retry", | 
					
						
							| 
									
										
										
										
											2022-06-28 10:09:59 +01:00
										 |  |  |              description: "Retry if downloading fails or re-download if the checksum of a previously cached " \ | 
					
						
							| 
									
										
										
										
											2022-09-06 01:25:34 +08:00
										 |  |  |                           "version no longer matches. Tries at most #{FETCH_MAX_TRIES} times with " \ | 
					
						
							|  |  |  |                           "exponential backoff." | 
					
						
							| 
									
										
										
										
											2018-10-27 23:44:32 +05:30
										 |  |  |       switch "--deps", | 
					
						
							| 
									
										
										
										
											2019-08-20 00:04:14 -04:00
										 |  |  |              description: "Also download dependencies for any listed <formula>." | 
					
						
							| 
									
										
										
										
											2018-10-27 23:44:32 +05:30
										 |  |  |       switch "-s", "--build-from-source", | 
					
						
							| 
									
										
										
										
											2019-08-19 22:44:50 -04:00
										 |  |  |              description: "Download source packages rather than a bottle." | 
					
						
							| 
									
										
										
										
											2019-01-29 11:35:04 +00:00
										 |  |  |       switch "--build-bottle", | 
					
						
							| 
									
										
										
										
											2019-08-19 22:44:50 -04:00
										 |  |  |              description: "Download source packages (for eventual bottling) rather than a bottle." | 
					
						
							| 
									
										
										
										
											2018-10-27 23:44:32 +05:30
										 |  |  |       switch "--force-bottle", | 
					
						
							| 
									
										
										
										
											2022-06-28 10:09:59 +01:00
										 |  |  |              description: "Download a bottle if it exists for the current or newest version of macOS, " \ | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |                           "even if it would not be used during installation." | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |       switch "--[no-]quarantine", | 
					
						
							|  |  |  |              description: "Disable/enable quarantining of downloads (default: enabled).", | 
					
						
							|  |  |  |              env:         :cask_opts_quarantine | 
					
						
							|  |  |  |       switch "--formula", "--formulae", | 
					
						
							|  |  |  |              description: "Treat all named arguments as formulae." | 
					
						
							|  |  |  |       switch "--cask", "--casks", | 
					
						
							|  |  |  |              description: "Treat all named arguments as casks." | 
					
						
							| 
									
										
										
										
											2020-07-30 18:40:10 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-10 21:17:33 +02:00
										 |  |  |       conflicts "--build-from-source", "--build-bottle", "--force-bottle", "--bottle-tag" | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |       conflicts "--cask", "--HEAD" | 
					
						
							|  |  |  |       conflicts "--cask", "--deps" | 
					
						
							|  |  |  |       conflicts "--cask", "-s" | 
					
						
							|  |  |  |       conflicts "--cask", "--build-bottle" | 
					
						
							|  |  |  |       conflicts "--cask", "--force-bottle" | 
					
						
							| 
									
										
										
										
											2021-07-10 21:17:33 +02:00
										 |  |  |       conflicts "--cask", "--bottle-tag" | 
					
						
							| 
									
										
										
										
											2020-11-27 11:41:08 -05:00
										 |  |  |       conflicts "--formula", "--cask" | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |       conflicts "--os", "--bottle-tag" | 
					
						
							|  |  |  |       conflicts "--arch", "--bottle-tag" | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-10 14:26:40 -05:00
										 |  |  |       named_args [:formula, :cask], min: 1
 | 
					
						
							| 
									
										
										
										
											2018-10-27 23:44:32 +05:30
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-06 09:49:53 -08:00
										 |  |  |   def self.fetch | 
					
						
							| 
									
										
										
										
											2020-07-26 22:00:38 +02:00
										 |  |  |     args = fetch_args.parse | 
					
						
							| 
									
										
										
										
											2018-10-27 23:44:32 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |     Formulary.enable_factory_cache! | 
					
						
							| 
									
										
										
										
											2023-03-25 11:56:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |     bucket = if args.deps? | 
					
						
							| 
									
										
										
										
											2022-06-15 16:32:14 -04:00
										 |  |  |       args.named.to_formulae_and_casks.flat_map do |formula_or_cask| | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |         case formula_or_cask | 
					
						
							|  |  |  |         when Formula | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |           formula = formula_or_cask | 
					
						
							|  |  |  |           [formula, *formula.recursive_dependencies.map(&:to_formula)] | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |         else | 
					
						
							|  |  |  |           formula_or_cask | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
										
										
											2011-04-14 14:57:21 -07:00
										 |  |  |       end | 
					
						
							|  |  |  |     else | 
					
						
							| 
									
										
										
										
											2022-06-15 16:32:14 -04:00
										 |  |  |       args.named.to_formulae_and_casks | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |     end.uniq | 
					
						
							| 
									
										
										
										
											2011-04-14 14:57:21 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |     os_arch_combinations = args.os_arch_combinations | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |     puts "Fetching: #{bucket * ", "}" if bucket.size > 1
 | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |     bucket.each do |formula_or_cask| | 
					
						
							|  |  |  |       case formula_or_cask | 
					
						
							|  |  |  |       when Formula | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |         formula = T.cast(formula_or_cask, Formula) | 
					
						
							|  |  |  |         ref = formula.loaded_from_api? ? formula.full_name : formula.path | 
					
						
							| 
									
										
										
										
											2015-12-03 11:00:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |         os_arch_combinations.each do |os, arch| | 
					
						
							|  |  |  |           SimulateSystem.with os: os, arch: arch do | 
					
						
							|  |  |  |             Formulary.clear_cache | 
					
						
							| 
									
										
										
										
											2023-10-07 10:50:03 -04:00
										 |  |  |             formula = Formulary.factory(ref, args.HEAD? ? :head : :stable) | 
					
						
							| 
									
										
										
										
											2018-09-17 02:45:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |             formula.print_tap_action verb: "Fetching" | 
					
						
							| 
									
										
										
										
											2018-01-21 23:41:54 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |             fetched_bottle = false | 
					
						
							|  |  |  |             if fetch_bottle?( | 
					
						
							|  |  |  |               formula, | 
					
						
							|  |  |  |               force_bottle:               args.force_bottle?, | 
					
						
							|  |  |  |               bottle_tag:                 args.bottle_tag&.to_sym, | 
					
						
							|  |  |  |               build_from_source_formulae: args.build_from_source_formulae, | 
					
						
							|  |  |  |               os:                         args.os&.to_sym, | 
					
						
							|  |  |  |               arch:                       args.arch&.to_sym, | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  |               begin | 
					
						
							|  |  |  |                 formula.clear_cache if args.force? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 bottle_tag = if (bottle_tag = args.bottle_tag&.to_sym) | 
					
						
							|  |  |  |                   Utils::Bottles::Tag.from_symbol(bottle_tag) | 
					
						
							|  |  |  |                 else | 
					
						
							|  |  |  |                   Utils::Bottles::Tag.new(system: os, arch: arch) | 
					
						
							|  |  |  |                 end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 bottle = formula.bottle_for_tag(bottle_tag) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 if bottle.nil? | 
					
						
							|  |  |  |                   opoo "Bottle for tag #{bottle_tag.to_sym.inspect} is unavailable." | 
					
						
							|  |  |  |                   next | 
					
						
							|  |  |  |                 end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 formula.fetch_bottle_tab | 
					
						
							|  |  |  |                 fetch_formula(bottle, args: args) | 
					
						
							|  |  |  |               rescue Interrupt | 
					
						
							|  |  |  |                 raise | 
					
						
							|  |  |  |               rescue => e | 
					
						
							|  |  |  |                 raise if Homebrew::EnvConfig.developer? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 fetched_bottle = false | 
					
						
							|  |  |  |                 onoe e.message | 
					
						
							|  |  |  |                 opoo "Bottle fetch failed, fetching the source instead." | 
					
						
							|  |  |  |               else | 
					
						
							|  |  |  |                 fetched_bottle = true | 
					
						
							|  |  |  |               end | 
					
						
							|  |  |  |             end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             next if fetched_bottle | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             fetch_formula(formula, args: args) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             formula.resources.each do |r| | 
					
						
							|  |  |  |               fetch_resource(r, args: args) | 
					
						
							|  |  |  |               r.patches.each { |p| fetch_patch(p, args: args) if p.external? } | 
					
						
							|  |  |  |             end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             formula.patchlist.each { |p| fetch_patch(p, args: args) if p.external? } | 
					
						
							|  |  |  |           end | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |         end | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |         cask = formula_or_cask | 
					
						
							| 
									
										
										
										
											2023-05-22 22:08:31 +02:00
										 |  |  |         ref = cask.loaded_from_api? ? cask.full_name : cask.sourcefile_path | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         os_arch_combinations.each do |os, arch| | 
					
						
							|  |  |  |           next if os == :linux | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |           SimulateSystem.with os: os, arch: arch do | 
					
						
							|  |  |  |             cask = Cask::CaskLoader.load(ref) | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-06 22:30:43 -07:00
										 |  |  |             if cask.url.nil? || cask.sha256.nil? | 
					
						
							| 
									
										
										
										
											2023-09-04 14:46:05 -07:00
										 |  |  |               opoo "Cask #{cask} is not supported on os #{os} and arch #{arch}" | 
					
						
							| 
									
										
										
										
											2023-09-02 01:33:39 -07:00
										 |  |  |               next | 
					
						
							|  |  |  |             end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-14 15:33:40 +02:00
										 |  |  |             quarantine = args.quarantine? | 
					
						
							|  |  |  |             quarantine = true if quarantine.nil? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             download = Cask::Download.new(cask, quarantine: quarantine) | 
					
						
							|  |  |  |             fetch_cask(download, args: args) | 
					
						
							|  |  |  |           end | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2013-08-06 19:53:43 -07:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2013-01-11 18:03:51 -06:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2011-04-14 14:57:21 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-08 00:14:10 +00:00
										 |  |  |   def self.fetch_resource(resource, args:) | 
					
						
							|  |  |  |     puts "Resource: #{resource.name}" | 
					
						
							|  |  |  |     fetch_fetchable resource, args: args | 
					
						
							| 
									
										
										
										
											2013-08-06 19:53:43 -07:00
										 |  |  |   rescue ChecksumMismatchError => e | 
					
						
							| 
									
										
										
										
											2023-03-08 00:14:10 +00:00
										 |  |  |     retry if retry_fetch?(resource, args: args) | 
					
						
							|  |  |  |     opoo "Resource #{resource.name} reports different sha256: #{e.expected}" | 
					
						
							| 
									
										
										
										
											2013-08-06 19:53:43 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |   def self.fetch_formula(formula, args:) | 
					
						
							|  |  |  |     fetch_fetchable formula, args: args | 
					
						
							| 
									
										
										
										
											2013-08-06 19:53:43 -07:00
										 |  |  |   rescue ChecksumMismatchError => e | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |     retry if retry_fetch?(formula, args: args) | 
					
						
							| 
									
										
										
										
											2021-01-07 08:33:57 +01:00
										 |  |  |     opoo "Formula reports different sha256: #{e.expected}" | 
					
						
							| 
									
										
										
										
											2013-08-06 19:53:43 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-06 09:49:53 -08:00
										 |  |  |   def self.fetch_cask(cask_download, args:) | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |     fetch_fetchable cask_download, args: args | 
					
						
							|  |  |  |   rescue ChecksumMismatchError => e | 
					
						
							|  |  |  |     retry if retry_fetch?(cask_download, args: args) | 
					
						
							| 
									
										
										
										
											2021-01-07 08:33:57 +01:00
										 |  |  |     opoo "Cask reports different sha256: #{e.expected}" | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-08 00:15:17 +00:00
										 |  |  |   def self.fetch_patch(patch, args:) | 
					
						
							|  |  |  |     fetch_fetchable patch, args: args | 
					
						
							| 
									
										
										
										
											2014-03-13 19:51:23 -05:00
										 |  |  |   rescue ChecksumMismatchError => e | 
					
						
							| 
									
										
										
										
											2021-01-07 08:33:57 +01:00
										 |  |  |     opoo "Patch reports different sha256: #{e.expected}" | 
					
						
							| 
									
										
										
										
											2020-07-29 19:41:39 -04:00
										 |  |  |     Homebrew.failed = true | 
					
						
							| 
									
										
										
										
											2014-03-13 19:51:23 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |   def self.retry_fetch?(formula, args:) | 
					
						
							| 
									
										
										
										
											2022-09-06 18:35:34 +08:00
										 |  |  |     @fetch_tries ||= Hash.new { |h, k| h[k] = 1 } | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |     if args.retry? && (@fetch_tries[formula] < FETCH_MAX_TRIES) | 
					
						
							|  |  |  |       wait = 2 ** @fetch_tries[formula] | 
					
						
							|  |  |  |       remaining = FETCH_MAX_TRIES - @fetch_tries[formula] | 
					
						
							| 
									
										
										
										
											2023-02-27 20:16:34 -08:00
										 |  |  |       what = Utils.pluralize("tr", remaining, plural: "ies", singular: "y") | 
					
						
							| 
									
										
										
										
											2022-09-06 01:25:34 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       ohai "Retrying download in #{wait}s... (#{remaining} #{what} left)" | 
					
						
							|  |  |  |       sleep wait | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |       formula.clear_cache | 
					
						
							|  |  |  |       @fetch_tries[formula] += 1
 | 
					
						
							| 
									
										
										
										
											2014-08-22 22:55:10 -05:00
										 |  |  |       true | 
					
						
							|  |  |  |     else | 
					
						
							| 
									
										
										
										
											2014-03-01 12:28:45 +00:00
										 |  |  |       Homebrew.failed = true | 
					
						
							| 
									
										
										
										
											2014-08-22 22:55:10 -05:00
										 |  |  |       false | 
					
						
							| 
									
										
										
										
											2014-03-01 12:28:45 +00:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |   def self.fetch_fetchable(formula, args:) | 
					
						
							|  |  |  |     formula.clear_cache if args.force? | 
					
						
							| 
									
										
										
										
											2013-10-31 14:28:49 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |     already_fetched = formula.cached_download.exist? | 
					
						
							| 
									
										
										
										
											2014-08-16 08:48:28 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     begin | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |       download = formula.fetch(verify_download_integrity: false) | 
					
						
							| 
									
										
										
										
											2014-08-22 22:55:10 -05:00
										 |  |  |     rescue DownloadError | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |       retry if retry_fetch?(formula, args: args) | 
					
						
							| 
									
										
										
										
											2014-08-22 22:55:10 -05:00
										 |  |  |       raise | 
					
						
							| 
									
										
										
										
											2014-08-16 08:48:28 +01:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2011-03-12 09:40:10 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-16 14:06:26 -05:00
										 |  |  |     return unless download.file? | 
					
						
							| 
									
										
										
										
											2011-03-12 09:40:10 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-31 14:28:49 -05:00
										 |  |  |     puts "Downloaded to: #{download}" unless already_fetched | 
					
						
							| 
									
										
										
										
											2021-01-07 08:33:57 +01:00
										 |  |  |     puts "SHA256: #{download.sha256}" | 
					
						
							| 
									
										
										
										
											2013-01-11 18:03:51 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |     formula.verify_download_integrity(download) | 
					
						
							| 
									
										
										
										
											2011-03-12 09:40:10 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | end |