Class: Bottle Private

Inherits:
Object show all
Extended by:
Forwardable
Includes:
Downloadable
Defined in:
bottle.rb,
sorbet/rbi/dsl/bottle.rbi

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.

Defined Under Namespace

Classes: Filename

Instance Attribute Summary collapse

Attributes included from Downloadable

#checksum, #mirrors

Instance Method Summary collapse

Methods included from Downloadable

#download_strategy, #downloaded?, #freeze, #initialize_dup, #version

Methods included from Utils::Output::Mixin

#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled

Methods included from Context

current, current=, #debug?, #quiet?, #verbose?, #with_context

Constructor Details

#initialize(formula, spec, tag = nil) ⇒ Bottle

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.

Returns a new instance of Bottle.

 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
# File 'bottle.rb', line 62 def initialize(formula, spec, tag = nil) super() @name = formula.name @resource = Resource.new @resource.owner = formula @spec = spec tag_spec = spec.tag_specification_for(Utils::Bottles.tag(tag)) @tag = tag_spec.tag @cellar = tag_spec.cellar @rebuild = spec.rebuild @resource.version(formula.pkg_version.to_s) @resource.checksum = tag_spec.checksum @fetch_tab_retried = false root_url(spec.root_url, spec.root_url_specs) end

Instance Attribute Details

#cellarObject (readonly)

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.

 57 58 59
# File 'bottle.rb', line 57 def cellar @cellar end

#nameObject (readonly)

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.

 57 58 59
# File 'bottle.rb', line 57 def name @name end

#rebuildObject (readonly)

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.

 57 58 59
# File 'bottle.rb', line 57 def rebuild @rebuild end

#resourceObject (readonly)

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.

 57 58 59
# File 'bottle.rb', line 57 def resource @resource end

#tagObject (readonly)

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.

 57 58 59
# File 'bottle.rb', line 57 def tag @tag end

Instance Method Details

#bottle_sizeInteger?

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.

Returns:

  • (Integer, nil)
 145 146 147 148 149 150
# File 'bottle.rb', line 145 def bottle_size resource = github_packages_manifest_resource return unless resource&.downloaded? resource.bottle_size end

#cached_download(*args, &block) ⇒ T.untyped

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:

  • args (T.untyped)
  • block (T.untyped)

Returns:

  • (T.untyped)
 10
# File 'sorbet/rbi/dsl/bottle.rbi', line 10 def cached_download(*args, &block); end

#clear_cachevoid

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.

 101 102 103 104 105
# File 'bottle.rb', line 101 def clear_cache @resource.clear_cache github_packages_manifest_resource&.clear_cache @fetch_tab_retried = false end

#compatible_locations?Boolean

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.

Returns:

  • (Boolean)
 107 108 109
# File 'bottle.rb', line 107 def compatible_locations? @spec.compatible_locations?(tag: @tag) end

#download_queue_nameString

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.

Returns:

 192
# File 'bottle.rb', line 192 def download_queue_name = "#{name} (#{resource.version})"

#download_queue_typeString

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.

Returns:

 189
# File 'bottle.rb', line 189 def download_queue_type = "Bottle"

#downloader(*args, &block) ⇒ T.untyped

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:

  • args (T.untyped)
  • block (T.untyped)

Returns:

  • (T.untyped)
 13
# File 'sorbet/rbi/dsl/bottle.rbi', line 13 def downloader(*args, &block); end

#fetch(verify_download_integrity: true, timeout: nil, quiet: false) ⇒ Pathname

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:

  • verify_download_integrity (Boolean) (defaults to: true)
  • timeout (Integer, Float, nil) (defaults to: nil)
  • quiet (Boolean, nil) (defaults to: false)

Returns:

 91 92 93 94 95 96 97 98
# File 'bottle.rb', line 91 def fetch(verify_download_integrity: true, timeout: nil, quiet: false) resource.fetch(verify_download_integrity:, timeout:, quiet:) rescue DownloadError raise unless fallback_on_error? fetch_tab retry end

#fetch_tab(timeout: nil, quiet: false) ⇒ Object

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.

 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
# File 'bottle.rb', line 118 def fetch_tab(timeout: nil, quiet: false) return unless (resource = github_packages_manifest_resource) begin resource.fetch(timeout:, quiet:) rescue DownloadError raise unless fallback_on_error? retry rescue Resource::BottleManifest::Error raise if @fetch_tab_retried @fetch_tab_retried = true resource.clear_cache retry end end

#filenameFilename

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.

Returns:

 161 162 163
# File 'bottle.rb', line 161 def filename Filename.create(resource.owner, @tag, @spec.rebuild) end

#github_packages_manifest_resourceResource::BottleManifest?

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.

Returns:

 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
# File 'bottle.rb', line 166 def github_packages_manifest_resource return if @resource.download_strategy != CurlGitHubPackagesDownloadStrategy @github_packages_manifest_resource ||= begin resource = Resource::BottleManifest.new(self) version_rebuild = GitHubPackages.version_rebuild(@resource.version, rebuild) resource.version(version_rebuild) image_name = GitHubPackages.image_formula_name(@name) image_tag = GitHubPackages.image_version_rebuild(version_rebuild) resource.url( "#{root_url}/#{image_name}/manifests/#{image_tag}", using: CurlGitHubPackagesDownloadStrategy, headers: ["Accept: application/vnd.oci.image.index.v1+json"], ) T.cast(resource.downloader, CurlGitHubPackagesDownloadStrategy).resolved_basename = "#{name}-#{version_rebuild}.bottle_manifest.json" resource end end

#installed_sizeInteger?

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.

Returns:

  • (Integer, nil)
 153 154 155 156 157 158
# File 'bottle.rb', line 153 def installed_size resource = github_packages_manifest_resource return unless resource&.downloaded? resource.installed_size end

#skip_relocation?Boolean

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.

Does the bottle need to be relocated?

Returns:

  • (Boolean)
 112 113 114
# File 'bottle.rb', line 112 def skip_relocation? @spec.skip_relocation?(tag: @tag) end

#stageObject

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.

 116
# File 'bottle.rb', line 116 def stage = downloader.stage

#tab_attributesObject

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.

 136 137 138 139 140 141 142
# File 'bottle.rb', line 136 def tab_attributes if (resource = github_packages_manifest_resource) && resource.downloaded? return resource.tab end {} end

#url(*args, &block) ⇒ T.untyped

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:

  • args (T.untyped)
  • block (T.untyped)

Returns:

  • (T.untyped)
 16
# File 'sorbet/rbi/dsl/bottle.rbi', line 16 def url(*args, &block); end

#verify_download_integrity(*args, &block) ⇒ T.untyped

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:

  • args (T.untyped)
  • block (T.untyped)

Returns:

  • (T.untyped)
 19
# File 'sorbet/rbi/dsl/bottle.rbi', line 19 def verify_download_integrity(*args, &block); end