diagnostic: check kernel, glibc versions [Linux]
This commit is contained in:
parent
03597404af
commit
76d7b586ce
@ -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
|
||||||
|
|||||||
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