| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-25 00:01:15 +02:00
										 |  |  | # Helper functions for querying operating system information. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # @api private | 
					
						
							| 
									
										
										
										
											2013-10-18 12:56:51 -05:00
										 |  |  | module OS | 
					
						
							| 
									
										
										
										
											2020-11-23 17:31:17 +01:00
										 |  |  |   extend T::Sig | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-25 00:01:15 +02:00
										 |  |  |   # Check if the operating system is macOS. | 
					
						
							|  |  |  |   # | 
					
						
							|  |  |  |   # @api public | 
					
						
							| 
									
										
										
										
											2020-11-23 17:31:17 +01:00
										 |  |  |   sig { returns(T::Boolean) } | 
					
						
							| 
									
										
										
										
											2013-10-18 12:56:51 -05:00
										 |  |  |   def self.mac? | 
					
						
							| 
									
										
										
										
											2016-07-26 20:30:30 -06:00
										 |  |  |     return false if ENV["HOMEBREW_TEST_GENERIC_OS"] | 
					
						
							| 
									
										
										
										
											2018-09-17 02:45:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-26 22:26:29 +02:00
										 |  |  |     RbConfig::CONFIG["host_os"].include? "darwin" | 
					
						
							| 
									
										
										
										
											2013-10-18 12:56:51 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-25 00:01:15 +02:00
										 |  |  |   # Check if the operating system is Linux. | 
					
						
							|  |  |  |   # | 
					
						
							|  |  |  |   # @api public | 
					
						
							| 
									
										
										
										
											2020-11-23 17:31:17 +01:00
										 |  |  |   sig { returns(T::Boolean) } | 
					
						
							| 
									
										
										
										
											2013-10-18 12:56:51 -05:00
										 |  |  |   def self.linux? | 
					
						
							| 
									
										
										
										
											2016-07-27 22:10:34 -06:00
										 |  |  |     return false if ENV["HOMEBREW_TEST_GENERIC_OS"] | 
					
						
							| 
									
										
										
										
											2018-09-17 02:45:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-26 22:26:29 +02:00
										 |  |  |     RbConfig::CONFIG["host_os"].include? "linux" | 
					
						
							| 
									
										
										
										
											2013-10-18 12:56:51 -05:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2014-06-03 16:59:50 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-25 00:01:15 +02:00
										 |  |  |   # Get the kernel version. | 
					
						
							|  |  |  |   # | 
					
						
							|  |  |  |   # @api public | 
					
						
							| 
									
										
										
										
											2020-11-23 17:31:17 +01:00
										 |  |  |   sig { returns(Version) } | 
					
						
							| 
									
										
										
										
											2020-08-17 12:24:53 -07:00
										 |  |  |   def self.kernel_version | 
					
						
							|  |  |  |     @kernel_version ||= Version.new(Utils.safe_popen_read("uname", "-r").chomp) | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-09 22:39:35 +08:00
										 |  |  |   # Get the kernel name. | 
					
						
							|  |  |  |   # | 
					
						
							|  |  |  |   # @api public | 
					
						
							|  |  |  |   sig { returns(String) } | 
					
						
							| 
									
										
										
										
											2021-09-10 21:25:38 +08:00
										 |  |  |   def self.kernel_name | 
					
						
							|  |  |  |     @kernel_name ||= Utils.safe_popen_read("uname", "-s").chomp | 
					
						
							| 
									
										
										
										
											2021-09-09 22:39:35 +08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 11:46:33 +01:00
										 |  |  |   ::OS_VERSION = ENV["HOMEBREW_OS_VERSION"] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-05 09:54:54 -07:00
										 |  |  |   CI_GLIBC_VERSION = "2.23" | 
					
						
							|  |  |  |   CI_OS_VERSION = "Ubuntu 16.04" | 
					
						
							| 
									
										
										
										
											2021-04-05 14:58:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-03 16:59:50 +02:00
										 |  |  |   if OS.mac? | 
					
						
							| 
									
										
										
										
											2015-10-16 16:41:14 +08:00
										 |  |  |     require "os/mac" | 
					
						
							| 
									
										
										
										
											2019-01-21 12:39:08 +00:00
										 |  |  |     # Don't tell people to report issues on unsupported configurations. | 
					
						
							| 
									
										
										
										
											2021-06-22 13:06:46 -04:00
										 |  |  |     if !OS::Mac.version.prerelease? && | 
					
						
							|  |  |  |        !OS::Mac.version.outdated_release? && | 
					
						
							| 
									
										
										
										
											2019-01-21 12:39:08 +00:00
										 |  |  |        ARGV.none? { |v| v.start_with?("--cc=") } && | 
					
						
							| 
									
										
										
										
											2021-11-13 14:49:40 -05:00
										 |  |  |        (ENV["HOMEBREW_PREFIX"] == HOMEBREW_DEFAULT_PREFIX || | 
					
						
							|  |  |  |        (ENV["HOMEBREW_PREFIX"] == HOMEBREW_MACOS_ARM_DEFAULT_PREFIX && Hardware::CPU.arm?)) | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  |       ISSUES_URL = "https://docs.brew.sh/Troubleshooting" | 
					
						
							| 
									
										
										
										
											2016-11-05 10:58:19 -04:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  |     PATH_OPEN = "/usr/bin/open" | 
					
						
							| 
									
										
										
										
											2014-06-03 16:59:50 +02:00
										 |  |  |   elsif OS.linux? | 
					
						
							| 
									
										
										
										
											2018-02-20 11:13:13 -08:00
										 |  |  |     require "os/linux" | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  |     ISSUES_URL = "https://docs.brew.sh/Troubleshooting" | 
					
						
							|  |  |  |     PATH_OPEN = "xdg-open" | 
					
						
							| 
									
										
										
										
											2014-06-03 16:59:50 +02:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-10-18 12:56:51 -05:00
										 |  |  | end |