Merge pull request #5447 from jonchang/linux-doctor
doctor: check supported versions of glibc and kernel [Linux]
This commit is contained in:
commit
e10d61b81b
@ -95,6 +95,16 @@ module Homebrew
|
|||||||
]).freeze
|
]).freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def please_create_pull_requests(what = "unsupported configuration")
|
||||||
|
<<~EOS
|
||||||
|
You may encounter build failures and other breakages.
|
||||||
|
Please create pull requests instead of asking for help on
|
||||||
|
Homebrew's GitHub, Discourse, Twitter or IRC. You are
|
||||||
|
responsible for resolving any issues you experience, as
|
||||||
|
you are running this #{what}.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
def check_for_installed_developer_tools
|
def check_for_installed_developer_tools
|
||||||
return if DevelopmentTools.installed?
|
return if DevelopmentTools.installed?
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
require "tempfile"
|
require "tempfile"
|
||||||
require "utils/shell"
|
require "utils/shell"
|
||||||
require "os/linux/diagnostic"
|
require "os/linux/diagnostic"
|
||||||
|
require "os/linux/glibc"
|
||||||
|
require "os/linux/kernel"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module Diagnostic
|
module Diagnostic
|
||||||
@ -59,6 +61,33 @@ module Homebrew
|
|||||||
echo 'umask 002' >> #{shell_profile}
|
echo 'umask 002' >> #{shell_profile}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_glibc_minimum_version
|
||||||
|
return unless OS::Linux::Glibc.below_minimum_version?
|
||||||
|
|
||||||
|
<<~EOS
|
||||||
|
Your system glibc #{OS::Linux::Glibc.system_version} is too old.
|
||||||
|
We only support glibc #{OS::Linux::Glibc.minimum_version} or later.
|
||||||
|
#{please_create_pull_requests}
|
||||||
|
We recommend updating to a newer version via your distribution's
|
||||||
|
package manager, upgrading your distribution to the latest version,
|
||||||
|
or changing distributions.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_kernel_minimum_version
|
||||||
|
return unless OS::Linux::Kernel.below_minimum_version?
|
||||||
|
|
||||||
|
<<~EOS
|
||||||
|
Your Linux kernel #{OS::Linux::Kernel.version} is too old.
|
||||||
|
We only support kernel #{OS::Linux::Kernel.minimum_version} or later.
|
||||||
|
You will be unable to use binary packages (bottles).
|
||||||
|
#{please_create_pull_requests}
|
||||||
|
We recommend updating to a newer version via your distribution's
|
||||||
|
package manager, upgrading your distribution to the latest version,
|
||||||
|
or changing distributions.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -60,10 +60,7 @@ module Homebrew
|
|||||||
<<~EOS
|
<<~EOS
|
||||||
You are using macOS #{MacOS.version}.
|
You are using macOS #{MacOS.version}.
|
||||||
#{who} do not provide support for this #{what}.
|
#{who} do not provide support for this #{what}.
|
||||||
You will encounter build failures and other breakages.
|
#{please_create_pull_requests(what)}
|
||||||
Please create pull requests instead of asking for help on Homebrew's
|
|
||||||
GitHub, Discourse, Twitter or IRC. As you are running this #{what},
|
|
||||||
you are responsible for resolving any issues you experience.
|
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -11,6 +11,14 @@ module OS
|
|||||||
|
|
||||||
@system_version = Version.new version
|
@system_version = Version.new version
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def minimum_version
|
||||||
|
Version.new "2.12"
|
||||||
|
end
|
||||||
|
|
||||||
|
def below_minimum_version?
|
||||||
|
system_version < minimum_version
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
24
Library/Homebrew/os/linux/kernel.rb
Normal file
24
Library/Homebrew/os/linux/kernel.rb
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
module OS
|
||||||
|
module Linux
|
||||||
|
module Kernel
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def version
|
||||||
|
return @version if @version
|
||||||
|
|
||||||
|
version = Utils.popen_read("uname", "-r").chomp
|
||||||
|
return Version::NULL unless version
|
||||||
|
|
||||||
|
@version = Version.new version
|
||||||
|
end
|
||||||
|
|
||||||
|
def minimum_version
|
||||||
|
Version.new "2.6.32"
|
||||||
|
end
|
||||||
|
|
||||||
|
def below_minimum_version?
|
||||||
|
version < minimum_version
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
17
Library/Homebrew/test/os/linux/diagnostic_spec.rb
Normal file
17
Library/Homebrew/test/os/linux/diagnostic_spec.rb
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
require "diagnostic"
|
||||||
|
|
||||||
|
describe Homebrew::Diagnostic::Checks do
|
||||||
|
specify "#check_glibc_minimum_version" do
|
||||||
|
allow(OS::Linux::Glibc).to receive(:below_minimum_version?).and_return(true)
|
||||||
|
|
||||||
|
expect(subject.check_glibc_minimum_version)
|
||||||
|
.to match(/Your system glibc .+ is too old/)
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "#check_kernel_minimum_version" do
|
||||||
|
allow(OS::Linux::Kernel).to receive(:below_minimum_version?).and_return(true)
|
||||||
|
|
||||||
|
expect(subject.check_kernel_minimum_version)
|
||||||
|
.to match(/Your Linux kernel .+ is too old/)
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user