diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 33f073708c..016c80382e 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -535,6 +535,12 @@ class BottleSpecification end end + def ==(other) + self.class == other.class && rebuild == other.rebuild && collector == other.collector && + root_url == other.root_url && root_url_specs == other.root_url_specs && tap == other.tap + end + alias eql? == + sig { params(tag: Utils::Bottles::Tag).returns(T.any(Symbol, String)) } def tag_to_cellar(tag = Utils::Bottles.tag) spec = collector.specification_for(tag) diff --git a/Library/Homebrew/utils/bottles.rb b/Library/Homebrew/utils/bottles.rb index ea7a55ba03..1c11ecf630 100644 --- a/Library/Homebrew/utils/bottles.rb +++ b/Library/Homebrew/utils/bottles.rb @@ -260,6 +260,11 @@ module Utils @checksum = checksum @cellar = cellar end + + def ==(other) + self.class == other.class && tag == other.tag && checksum == other.checksum && cellar == other.cellar + end + alias eql? == end # Collector for bottle specifications. @@ -274,6 +279,11 @@ module Utils @tag_specs.keys end + def ==(other) + self.class == other.class && @tag_specs == other.instance_variable_get(:@tag_specs) + end + alias eql? == + sig { params(tag: Utils::Bottles::Tag, checksum: Checksum, cellar: T.any(Symbol, String)).void } def add(tag, checksum:, cellar:) spec = Utils::Bottles::TagSpecification.new(tag: tag, checksum: checksum, cellar: cellar)