Class: FormulaVersions::LegacyBottleSpecification Private

Inherits:
BottleSpecification show all
Includes:
LegacyChecksums
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 included from LegacyChecksums

#md5, #sha1

Methods inherited from BottleSpecification

#checksums, compatible_locations?, #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_once, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_cannot_install, #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

#initialize ⇒ 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.



76
77
78
79
# File 'formula_versions.rb', line 76

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:



99
100
101
# File 'formula_versions.rb', line 99

def cellar(value)
  @legacy_cellar = value
end

#revision(_value) ⇒ 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:



96
# File 'formula_versions.rb', line 96

def revision(_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:



82
83
84
85
86
87
88
89
90
91
92
93
# File 'formula_versions.rb', line 82

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