Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diagnostic: add doctor check for CPU arch on Linux #7162

Merged
merged 1 commit into from Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions Library/Homebrew/extend/os/linux/diagnostic.rb
Expand Up @@ -2,6 +2,7 @@

require "tempfile"
require "utils/shell"
require "hardware"
require "os/linux/diagnostic"
require "os/linux/glibc"
require "os/linux/kernel"
Expand All @@ -13,6 +14,7 @@ def supported_configuration_checks
%w[
check_glibc_minimum_version
check_kernel_minimum_version
check_supported_architecture
].freeze
end

Expand Down Expand Up @@ -71,6 +73,16 @@ def check_umask_not_zero
EOS
end

def check_supported_architecture
return if Hardware::CPU.arch == :x86_64

<<~EOS
Your CPU architecture (#{Hardware::CPU.arch}) is not supported. We only support
x86_64 CPU architectures. You will be unable to use binary packages (bottles).
#{please_create_pull_requests}
EOS
end

def check_glibc_minimum_version
return unless OS::Linux::Glibc.below_minimum_version?

Expand Down
7 changes: 7 additions & 0 deletions Library/Homebrew/test/os/linux/diagnostic_spec.rb
Expand Up @@ -3,6 +3,13 @@
require "diagnostic"

describe Homebrew::Diagnostic::Checks do
specify "#check_supported_architecture" do
allow(Hardware::CPU).to receive(:type).and_return(:arm64)

expect(subject.check_supported_architecture)
.to match(/Your CPU architecture .+ is not supported/)
end

specify "#check_glibc_minimum_version" do
allow(OS::Linux::Glibc).to receive(:below_minimum_version?).and_return(true)

Expand Down