| 
									
										
										
										
											2024-08-15 07:59:49 -07:00
										 |  |  | # typed: strict | 
					
						
							| 
									
										
										
										
											2023-04-10 16:18:56 -04:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-18 15:33:49 -07:00
										 |  |  | module OS | 
					
						
							|  |  |  |   module Mac | 
					
						
							|  |  |  |     module DevCmd | 
					
						
							|  |  |  |       module Bottle | 
					
						
							|  |  |  |         sig { returns(T::Array[String]) } | 
					
						
							|  |  |  |         def tar_args | 
					
						
							|  |  |  |           if MacOS.version >= :catalina | 
					
						
							|  |  |  |             ["--no-mac-metadata", "--no-acls", "--no-xattrs"].freeze | 
					
						
							|  |  |  |           else | 
					
						
							|  |  |  |             [].freeze | 
					
						
							| 
									
										
										
										
											2024-09-13 12:22:52 -07:00
										 |  |  |           end | 
					
						
							| 
									
										
										
										
											2024-09-18 15:33:49 -07:00
										 |  |  |         end | 
					
						
							| 
									
										
										
										
											2023-08-04 10:02:44 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-18 15:33:49 -07:00
										 |  |  |         sig { params(gnu_tar_formula: Formula).returns(String) } | 
					
						
							|  |  |  |         def gnu_tar(gnu_tar_formula) | 
					
						
							|  |  |  |           "#{gnu_tar_formula.opt_bin}/gtar" | 
					
						
							| 
									
										
										
										
											2024-09-13 12:22:52 -07:00
										 |  |  |         end | 
					
						
							| 
									
										
										
										
											2025-06-09 19:06:16 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         sig { params(formula: Formula).returns(T::Array[Regexp]) } | 
					
						
							|  |  |  |         def formula_ignores(formula) | 
					
						
							|  |  |  |           ignores = super | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           cellar_regex = Regexp.escape(HOMEBREW_CELLAR) | 
					
						
							|  |  |  |           prefix_regex = Regexp.escape(HOMEBREW_PREFIX) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           ignores << case formula.name | 
					
						
							|  |  |  |           # On Linux, GCC installation can be moved so long as the whole directory tree is moved together: | 
					
						
							|  |  |  |           # https://gcc-help.gcc.gnu.narkive.com/GnwuCA7l/moving-gcc-from-the-installation-path-is-it-allowed. | 
					
						
							|  |  |  |           when Version.formula_optionally_versioned_regex(:gcc) | 
					
						
							|  |  |  |             Regexp.union(%r{#{cellar_regex}/gcc}, %r{#{prefix_regex}/opt/gcc}) if OS.linux? | 
					
						
							|  |  |  |           # binutils is relocatable for the same reason: https://github.com/Homebrew/brew/pull/11899#issuecomment-906804451. | 
					
						
							|  |  |  |           when Version.formula_optionally_versioned_regex(:binutils) | 
					
						
							|  |  |  |             %r{#{cellar_regex}/binutils} if OS.linux? | 
					
						
							|  |  |  |           end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           ignores.compact | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
										
										
											2024-03-18 12:31:44 -07:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2024-02-18 15:03:00 -08:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2023-08-04 10:02:44 +01:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2023-04-10 16:18:56 -04:00
										 |  |  | end | 
					
						
							| 
									
										
										
										
											2024-09-05 19:56:32 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-18 15:33:49 -07:00
										 |  |  | Homebrew::DevCmd::Bottle.prepend(OS::Mac::DevCmd::Bottle) |