Class: FormulaVersions::LegacyBottleSpecification Private

Inherits:
BottleSpecification show all
Defined in:
formula_versions.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Parses bottle syntax that was removed in February 2021 without exposing it to normal formula loading.

Constant Summary

Constants inherited from BottleSpecification

BottleSpecification::ANY_CELLAR, BottleSpecification::ANY_SKIP_RELOCATION_CELLAR, BottleSpecification::RELOCATABLE_CELLARS

Instance Attribute Summary

Attributes inherited from BottleSpecification

#collector, #repository, #root_url_specs, #tap

Instance Method Summary collapse

Methods inherited from BottleSpecification

#checksums, #compatible_locations?, #rebuild, #root_url, #skip_relocation?, #tag?, #tag_specification_for, #tag_to_cellar

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning

Methods included from OS::Linux::BottleSpecification

#skip_relocation?

Constructor Details

#initializevoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



18
19
20
21
# File 'formula_versions.rb', line 18

def initialize
  super
  @legacy_cellar = T.let(nil, T.nilable(T.any(Symbol, String)))
end

Instance Method Details

#cellar(value) ⇒ Symbol, String

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:



38
39
40
# File 'formula_versions.rb', line 38

def cellar(value)
  @legacy_cellar = value
end

#sha256(hash) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.

Parameters:



24
25
26
27
28
29
30
31
32
33
34
35
# File 'formula_versions.rb', line 24

def sha256(hash)
  legacy = hash.find do |key, value|
    key.is_a?(String) && key.match?(/^[a-f0-9]{64}$/i) && value.is_a?(Symbol)
  end
  return super if legacy.nil?

  digest, tag = legacy
  converted = T.let({ tag => digest }, T::Hash[T.any(Symbol, String), T.any(String, Symbol)])
  cellar = hash[:cellar] || @legacy_cellar
  converted[:cellar] = cellar unless cellar.nil?
  super(converted)
end