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, BottleSpecification::SHA256_REGEX

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_removed, #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:



106
107
108
# File 'formula_versions.rb', line 106

def cellar(value)
  @legacy_cellar = value
end

#prefix(_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:



100
# File 'formula_versions.rb', line 100

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



103
# File 'formula_versions.rb', line 103

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
94
95
96
97
# File 'formula_versions.rb', line 82

def sha256(hash)
  legacy = hash.find do |key, value|
    key.is_a?(String) && key.match?(SHA256_REGEX) && value.is_a?(Symbol)
  end
  if legacy
    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)
  elsif hash.any? { |key, value| key.is_a?(Symbol) && value.is_a?(String) && value.match?(SHA256_REGEX) }
    # Only delegate valid digests: `super` would `odie` on invalid historical ones,
    # e.g. SHA-1 bottle digests labelled `sha256`, so those are ignored.
    super
  end
end