Skip to content
Snippets Groups Projects
Commit b1fff320 authored by Xu Cheng's avatar Xu Cheng
Browse files

BottleLoader: check version mismatch


Closes Homebrew/homebrew#42049.

Signed-off-by: default avatarXu Cheng <xucheng@me.com>
parent 602ea66a
No related branches found
No related tags found
No related merge requests found
......@@ -301,3 +301,13 @@ class DuplicateResourceError < ArgumentError
super "Resource #{resource.inspect} is defined more than once"
end
end
class BottleVersionMismatchError < RuntimeError
def initialize bottle_file, bottle_version, formula, formula_version
super <<-EOS.undent
Bottle version mismatch
Bottle: #{bottle_file} (#{bottle_version})
Formula: #{formula.full_name} (#{formula_version})
EOS
end
end
......@@ -90,6 +90,11 @@ class Formulary
def get_formula(spec)
formula = super
formula.local_bottle_path = @bottle_filename
formula_version = formula.pkg_version
bottle_version = bottle_resolve_version(@bottle_filename)
unless formula_version == bottle_version
raise BottleVersionMismatchError.new(@bottle_filename, bottle_version, formula, formula_version)
end
formula
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment