mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
cask depends_on arch: remove everything but 64-bit intel
This commit is contained in:
parent
4ca2eaf8df
commit
294781cc9e
@ -13,30 +13,9 @@ module Hbc
|
|||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
VALID_ARCHES = {
|
VALID_ARCHES = {
|
||||||
intel: { type: :intel, bits: [32, 64] },
|
intel: { type: :intel, bits: 64 },
|
||||||
ppc: { type: :ppc, bits: [32, 64] },
|
|
||||||
# specific
|
# specific
|
||||||
i386: { type: :intel, bits: 32 },
|
|
||||||
x86_64: { type: :intel, bits: 64 },
|
x86_64: { type: :intel, bits: 64 },
|
||||||
ppc_7400: { type: :ppc, bits: 32 },
|
|
||||||
ppc_64: { type: :ppc, bits: 64 },
|
|
||||||
}.freeze
|
|
||||||
|
|
||||||
# Intentionally undocumented: catch variant spellings.
|
|
||||||
ARCH_SYNONYMS = {
|
|
||||||
x86_32: :i386,
|
|
||||||
x8632: :i386,
|
|
||||||
x8664: :x86_64,
|
|
||||||
intel_32: :i386,
|
|
||||||
intel32: :i386,
|
|
||||||
intel_64: :x86_64,
|
|
||||||
intel64: :x86_64,
|
|
||||||
amd_64: :x86_64,
|
|
||||||
amd64: :x86_64,
|
|
||||||
ppc7400: :ppc_7400,
|
|
||||||
ppc_32: :ppc_7400,
|
|
||||||
ppc32: :ppc_7400,
|
|
||||||
ppc64: :ppc_64,
|
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
attr_accessor :java
|
attr_accessor :java
|
||||||
@ -100,8 +79,7 @@ module Hbc
|
|||||||
def arch=(*args)
|
def arch=(*args)
|
||||||
@arch ||= []
|
@arch ||= []
|
||||||
arches = args.map do |elt|
|
arches = args.map do |elt|
|
||||||
elt = elt.to_s.downcase.sub(/^:/, "").tr("-", "_").to_sym
|
elt.to_s.downcase.sub(/^:/, "").tr("-", "_").to_sym
|
||||||
ARCH_SYNONYMS.key?(elt) ? ARCH_SYNONYMS[elt] : elt
|
|
||||||
end
|
end
|
||||||
invalid_arches = arches - VALID_ARCHES.keys
|
invalid_arches = arches - VALID_ARCHES.keys
|
||||||
raise "invalid 'depends_on arch' values: #{invalid_arches.inspect}" unless invalid_arches.empty?
|
raise "invalid 'depends_on arch' values: #{invalid_arches.inspect}" unless invalid_arches.empty?
|
||||||
|
@ -79,15 +79,6 @@ describe "Satisfy Dependencies and Requirements" do
|
|||||||
Hbc::Installer.new(arch_cask).install
|
Hbc::Installer.new(arch_cask).install
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises an exception when depends_on arch is not satisfied" do
|
|
||||||
arch_cask = Hbc.load("with-depends-on-arch-failure")
|
|
||||||
lambda {
|
|
||||||
shutup do
|
|
||||||
Hbc::Installer.new(arch_cask).install
|
|
||||||
end
|
|
||||||
}.must_raise(Hbc::CaskError)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "depends_on x11" do
|
describe "depends_on x11" do
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
test_cask 'with-depends-on-arch-failure' do
|
|
||||||
version '1.2.3'
|
|
||||||
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
|
|
||||||
|
|
||||||
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
|
|
||||||
homepage 'http://example.com/with-depends-on-arch-failure'
|
|
||||||
|
|
||||||
# guarantee mismatched hardware
|
|
||||||
depends_on arch: Hardware::CPU.intel? ? :ppc : :intel
|
|
||||||
|
|
||||||
app 'Caffeine.app'
|
|
||||||
end
|
|
@ -6,7 +6,7 @@ test_cask 'with-depends-on-arch' do
|
|||||||
homepage 'http://example.com/with-depends-on-arch'
|
homepage 'http://example.com/with-depends-on-arch'
|
||||||
|
|
||||||
# covers all known hardware; always succeeds
|
# covers all known hardware; always succeeds
|
||||||
depends_on arch: [:ppc, :intel]
|
depends_on arch: :intel
|
||||||
|
|
||||||
app 'Caffeine.app'
|
app 'Caffeine.app'
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user