Commit 4bb5b596 authored by Seth Chisamore's avatar Seth Chisamore
Browse files

Merge pull request #537 from chef/schisamo/ohai-based-arch

`Metadata#arch` should return a valid Ohai architecture
parents 7232cbcb f64679e3
......@@ -108,8 +108,8 @@ module Omnibus
# @return [String]
#
def arch
if Ohai['platform'] == 'windows'
Config.windows_arch
if (Ohai['platform'] == 'windows') && (Config.windows_arch.to_sym == :x86)
'i386'
else
Ohai['kernel']['machine']
end
......
......@@ -502,7 +502,7 @@ module Omnibus
#
def wix_candle_flags
# we support x86 or x64. No Itanium support (ia64).
@wix_candle_flags ||= "-arch " + (Config.windows_arch == :x86 ? "x86" : "x64")
@wix_candle_flags ||= "-arch " + (Config.windows_arch.to_sym == :x86 ? "x86" : "x64")
end
#
......
......@@ -64,7 +64,7 @@ module Omnibus
# Returns whether the Windows build target is 32-bit (x86).
# If this returns false, the target is x64. Itanium is not supported.
def windows_arch_i386?
Config.windows_arch == :x86
Config.windows_arch.to_sym == :x86
end
end
end
......@@ -30,12 +30,12 @@ module Omnibus
end
context 'on windows' do
it 'returns the value of Config.windows_arch' do
it 'returns a 32-bit value based on Config.windows_arch being set to x86' do
stub_ohai(platform: 'windows', version: '2012R2') do |data|
data['kernel']['machine'] = 'x86_64'
end
allow(Config).to receive(:windows_arch).and_return('some_arch')
expect(described_class.arch).to eq('some_arch')
expect(Config).to receive(:windows_arch).and_return(:x86)
expect(described_class.arch).to eq('i386')
end
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment