arch_requirement: update and add to JSON representation of formulae
This commit is contained in:
parent
6a2331b7e0
commit
f4aeb3e956
@ -1772,7 +1772,7 @@ class Formula
|
|||||||
"name" => req.name,
|
"name" => req.name,
|
||||||
"cask" => req.cask,
|
"cask" => req.cask,
|
||||||
"download" => req.download,
|
"download" => req.download,
|
||||||
"version" => req.try(:version),
|
"version" => req.try(:version) || req.try(:arch),
|
||||||
"contexts" => req.tags,
|
"contexts" => req.tags,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@ -9,6 +9,8 @@ require "requirement"
|
|||||||
class ArchRequirement < Requirement
|
class ArchRequirement < Requirement
|
||||||
fatal true
|
fatal true
|
||||||
|
|
||||||
|
attr_reader :arch
|
||||||
|
|
||||||
def initialize(tags)
|
def initialize(tags)
|
||||||
@arch = tags.shift
|
@arch = tags.shift
|
||||||
super(tags)
|
super(tags)
|
||||||
@ -16,8 +18,8 @@ class ArchRequirement < Requirement
|
|||||||
|
|
||||||
satisfy(build_env: false) do
|
satisfy(build_env: false) do
|
||||||
case @arch
|
case @arch
|
||||||
when :x86_64 then Hardware::CPU.is_64_bit?
|
when :x86_64 then Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
|
||||||
when :intel, :ppc then Hardware::CPU.type == @arch
|
when :arm, :intel, :ppc then Hardware::CPU.type == @arch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user