os: add kernel_version
This commit is contained in:
parent
dd8e6f42a2
commit
3379e3b5cf
@ -100,7 +100,7 @@ module Homebrew
|
|||||||
return unless OS::Linux::Kernel.below_minimum_version?
|
return unless OS::Linux::Kernel.below_minimum_version?
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Your Linux kernel #{OS::Linux::Kernel.version} is too old.
|
Your Linux kernel #{OS.kernel_version} is too old.
|
||||||
We only support kernel #{OS::Linux::Kernel.minimum_version} or later.
|
We only support kernel #{OS::Linux::Kernel.minimum_version} or later.
|
||||||
You will be unable to use binary packages (bottles).
|
You will be unable to use binary packages (bottles).
|
||||||
#{please_create_pull_requests}
|
#{please_create_pull_requests}
|
||||||
|
|||||||
@ -13,6 +13,10 @@ module OS
|
|||||||
RbConfig::CONFIG["host_os"].include? "linux"
|
RbConfig::CONFIG["host_os"].include? "linux"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.kernel_version
|
||||||
|
@kernel_version ||= Version.new(Utils.safe_popen_read("uname", "-r").chomp)
|
||||||
|
end
|
||||||
|
|
||||||
::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
|
::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
|
||||||
|
|
||||||
if OS.mac?
|
if OS.mac?
|
||||||
|
|||||||
@ -5,21 +5,12 @@ module OS
|
|||||||
module Kernel
|
module Kernel
|
||||||
module_function
|
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
|
def minimum_version
|
||||||
Version.new "2.6.32"
|
Version.new "2.6.32"
|
||||||
end
|
end
|
||||||
|
|
||||||
def below_minimum_version?
|
def below_minimum_version?
|
||||||
version < minimum_version
|
OS.kernel_version < minimum_version
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
9
Library/Homebrew/test/os/os_spec.rb
Normal file
9
Library/Homebrew/test/os/os_spec.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
describe OS do
|
||||||
|
describe ".kernel_version" do
|
||||||
|
it "is not empty" do
|
||||||
|
expect(described_class.kernel_version).not_to be_empty
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user