utils/bottles: fix outdated bottle check

This commit is contained in:
Bo Anderson 2024-03-30 03:29:51 +00:00
parent 02a0ea8449
commit bb0252875e
No known key found for this signature in database
2 changed files with 6 additions and 7 deletions

View File

@ -340,7 +340,7 @@ class Bottle
extend Forwardable extend Forwardable
attr_reader :name, :resource, :cellar, :rebuild attr_reader :name, :resource, :tag, :cellar, :rebuild
def_delegators :resource, :url, :verify_download_integrity def_delegators :resource, :url, :verify_download_integrity
def_delegators :resource, :cached_download def_delegators :resource, :cached_download

View File

@ -33,16 +33,15 @@ module Utils
end end
def file_outdated?(formula, file) def file_outdated?(formula, file)
file = file.resolved_path
filename = file.basename.to_s filename = file.basename.to_s
return false if formula.bottle.blank? return false if formula.bottle.blank?
bottle_ext, bottle_tag, = extname_tag_rebuild(filename) _, bottle_tag, bottle_rebuild = extname_tag_rebuild(filename)
return false if bottle_ext.blank? return false if bottle_tag.blank?
return false if bottle_tag != tag.to_s
bottle_url_ext, = extname_tag_rebuild(formula.bottle.url) bottle_tag != formula.bottle.tag.to_s || bottle_rebuild.to_i != formula.bottle.rebuild
bottle_ext && bottle_url_ext && bottle_ext != bottle_url_ext
end end
def extname_tag_rebuild(filename) def extname_tag_rebuild(filename)