From 3c366a56d7af3e51daac0c530a8b43ab005f31d1 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 16 Jul 2014 18:54:19 -0500 Subject: [PATCH] Add key? to BottleCollector --- Library/Homebrew/bottles.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index 413c615dfd..ee779cb3ea 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -69,7 +69,7 @@ class BottleCollector end def fetch_checksum_for(tag) - return [@bottles[tag], tag] if @bottles[tag] + return [@bottles[tag], tag] if key?(tag) find_altivec_tag(tag) || find_or_later_tag(tag) end @@ -86,14 +86,18 @@ class BottleCollector @bottles[key] = value end + def key?(key) + @bottles.key?(key) + end + # This allows generic Altivec PPC bottles to be supported in some # formulae, while also allowing specific bottles in others; e.g., # sometimes a formula has just :tiger_altivec, other times it has # :tiger_g4, :tiger_g5, etc. def find_altivec_tag(tag) if tag.to_s =~ /(\w+)_(g4|g4e|g5)$/ - altitag = "#{$1}_altivec".to_sym - return [@bottles[altitag], altitag] if @bottles[altitag] + altivec_tag = "#{$1}_altivec".to_sym + return [@bottles[altivec_tag], altivec_tag] if key?(altivec_tag) end end