formulary: fall back on missing bottle formula.

These aren't available on old macOS version bottles.
This commit is contained in:
Mike McQuaid 2021-04-01 16:52:58 +01:00
parent 95b44eab49
commit 1942e60a37
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -192,8 +192,8 @@ module Formulary
end end
def get_formula(spec, force_bottle: false, flags: [], **) def get_formula(spec, force_bottle: false, flags: [], **)
contents = Utils::Bottles.formula_contents @bottle_filename, name: name
formula = begin formula = begin
contents = Utils::Bottles.formula_contents @bottle_filename, name: name
Formulary.from_contents(name, path, contents, spec, force_bottle: force_bottle, flags: flags) Formulary.from_contents(name, path, contents, spec, force_bottle: force_bottle, flags: flags)
rescue FormulaUnreadableError => e rescue FormulaUnreadableError => e
opoo <<~EOS opoo <<~EOS
@ -201,6 +201,12 @@ module Formulary
#{e} #{e}
EOS EOS
super super
rescue BottleFormulaUnavailableError => e
opoo <<~EOS
#{e}
Falling back to non-bottle formula.
EOS
super
end end
formula.local_bottle_path = @bottle_filename formula.local_bottle_path = @bottle_filename
formula formula