arch_requirement: update and add to JSON representation of formulae

This commit is contained in:
EricFromCanada 2020-11-01 11:57:00 -05:00
parent 6a2331b7e0
commit f4aeb3e956
2 changed files with 5 additions and 3 deletions

View File

@ -1772,7 +1772,7 @@ class Formula
"name" => req.name,
"cask" => req.cask,
"download" => req.download,
"version" => req.try(:version),
"version" => req.try(:version) || req.try(:arch),
"contexts" => req.tags,
}
end

View File

@ -9,6 +9,8 @@ require "requirement"
class ArchRequirement < Requirement
fatal true
attr_reader :arch
def initialize(tags)
@arch = tags.shift
super(tags)
@ -16,8 +18,8 @@ class ArchRequirement < Requirement
satisfy(build_env: false) do
case @arch
when :x86_64 then Hardware::CPU.is_64_bit?
when :intel, :ppc then Hardware::CPU.type == @arch
when :x86_64 then Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
when :arm, :intel, :ppc then Hardware::CPU.type == @arch
end
end