Separate tag matching and checksum lookup
This commit is contained in:
parent
005f41c02a
commit
ab41071d2b
@ -69,8 +69,8 @@ class BottleCollector
|
|||||||
end
|
end
|
||||||
|
|
||||||
def fetch_checksum_for(tag)
|
def fetch_checksum_for(tag)
|
||||||
return self[tag], tag if key?(tag)
|
tag = find_matching_tag(tag)
|
||||||
find_altivec_tag(tag) || find_or_later_tag(tag)
|
return self[tag], tag if tag
|
||||||
end
|
end
|
||||||
|
|
||||||
def keys
|
def keys
|
||||||
@ -91,6 +91,14 @@ class BottleCollector
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def find_matching_tag(tag)
|
||||||
|
if key?(tag)
|
||||||
|
tag
|
||||||
|
else
|
||||||
|
find_altivec_tag(tag) || find_or_later_tag(tag)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# This allows generic Altivec PPC bottles to be supported in some
|
# This allows generic Altivec PPC bottles to be supported in some
|
||||||
# formulae, while also allowing specific bottles in others; e.g.,
|
# formulae, while also allowing specific bottles in others; e.g.,
|
||||||
# sometimes a formula has just :tiger_altivec, other times it has
|
# sometimes a formula has just :tiger_altivec, other times it has
|
||||||
@ -98,7 +106,7 @@ class BottleCollector
|
|||||||
def find_altivec_tag(tag)
|
def find_altivec_tag(tag)
|
||||||
if tag.to_s =~ /(\w+)_(g4|g4e|g5)$/
|
if tag.to_s =~ /(\w+)_(g4|g4e|g5)$/
|
||||||
altivec_tag = "#{$1}_altivec".to_sym
|
altivec_tag = "#{$1}_altivec".to_sym
|
||||||
return self[altivec_tag], altivec_tag if key?(altivec_tag)
|
altivec_tag if key?(altivec_tag)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -106,13 +114,11 @@ class BottleCollector
|
|||||||
# so the same bottle can target multiple OSs.
|
# so the same bottle can target multiple OSs.
|
||||||
# Not used in core, used in taps.
|
# Not used in core, used in taps.
|
||||||
def find_or_later_tag(tag)
|
def find_or_later_tag(tag)
|
||||||
results = @checksums.find_all {|k,v| k.to_s =~ /_or_later$/}
|
keys.find do |key|
|
||||||
results.each do |key, hsh|
|
if key.to_s.end_with?("_or_later")
|
||||||
later_tag = key.to_s[/(\w+)_or_later$/, 1].to_sym
|
later_tag = key.to_s[/(\w+)_or_later$/, 1].to_sym
|
||||||
bottle_version = MacOS::Version.from_symbol(later_tag)
|
MacOS::Version.from_symbol(later_tag) <= MacOS::Version.from_symbol(tag)
|
||||||
return [hsh, key] if bottle_version <= MacOS::Version.from_symbol(tag)
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user