Class: Bottle Private
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
- #cellar ⇒ String, Symbol readonly private
- #name ⇒ String readonly private
- #rebuild ⇒ Integer readonly private
- #resource ⇒ Resource readonly private
- #tag ⇒ Utils::Bottles::Tag readonly private
Attributes included from Downloadable
Instance Method Summary collapse
- #bottle_size ⇒ Integer? private
- #cached_download(*args, &block) ⇒ T.untyped private
- #clear_cache ⇒ void private
- #compatible_locations? ⇒ Boolean private
- #download_queue_name ⇒ String private
- #download_queue_type ⇒ String private
- #downloaded_and_valid? ⇒ Boolean private
- #downloader(*args, &block) ⇒ T.untyped private
- #fetch(verify_download_integrity: true, timeout: nil, quiet: false) ⇒ Pathname private
- #fetch_tab(timeout: nil, quiet: false) ⇒ void private
- #filename ⇒ Filename private
- #github_packages_manifest_resource ⇒ Resource::BottleManifest? private
- #initialize(formula, spec, tag = nil, name: nil, pkg_version: nil) ⇒ void constructor private
- #installed_size ⇒ Integer? private
- #path_exec_files ⇒ Array<String>? private
-
#skip_relocation? ⇒ Boolean
private
Does the bottle need to be relocated?.
- #stage ⇒ void private
- #tab_attributes ⇒ Hash{String => T.untyped} private
- #total_size ⇒ Integer? private
- #url(*args, &block) ⇒ T.untyped private
- #verify_download_integrity(*args, &block) ⇒ T.untyped private
Methods included from Downloadable
#download_queue_message, #download_strategy, #downloaded!, #downloaded?, #downloading!, #extracting!, #fetched_size, #freeze, #initialize_dup, #verified!, #verifying!, #version
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_upgradable
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(formula, spec, tag = nil, name: nil, pkg_version: nil) ⇒ 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.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'bottle.rb', line 93 def initialize(formula, spec, tag = nil, name: nil, pkg_version: nil) super() resource_name = T.let(nil, T.nilable(String)) if formula name = formula.name pkg_version = formula.pkg_version else raise ArgumentError, "Bottle name is required" if name.nil? raise ArgumentError, "Bottle version is required" if pkg_version.nil? resource_name = name end @name = T.let(name, String) @pkg_version = T.let(pkg_version, PkgVersion) @resource = T.let(Resource.new(resource_name), Resource) @resource.owner = formula if formula @spec = spec tag_spec = spec.tag_specification_for(Utils::Bottles.tag(tag)) odie "#{@name} tag specification for tag #{tag} is nil" if tag_spec.nil? @tag = T.let(tag_spec.tag, Utils::Bottles::Tag) @cellar = T.let(tag_spec.cellar, T.any(String, Symbol)) @rebuild = T.let(spec.rebuild, Integer) @resource.version(@pkg_version.to_s) @resource.checksum = tag_spec.checksum @fetch_tab_retried = T.let(false, T::Boolean) root_url(spec.root_url, spec.root_url_specs) end |
Instance Attribute Details
#cellar ⇒ String, Symbol (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.
76 77 78 |
# File 'bottle.rb', line 76 def cellar @cellar end |
#name ⇒ String (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.
67 68 69 |
# File 'bottle.rb', line 67 def name @name end |
#rebuild ⇒ Integer (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.
79 80 81 |
# File 'bottle.rb', line 79 def rebuild @rebuild end |
#resource ⇒ Resource (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.
70 71 72 |
# File 'bottle.rb', line 70 def resource @resource end |
#tag ⇒ Utils::Bottles::Tag (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.
73 74 75 |
# File 'bottle.rb', line 73 def tag @tag end |
Instance Method Details
#bottle_size ⇒ Integer?
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.
216 217 218 219 220 221 |
# File 'bottle.rb', line 216 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.
10 |
# File 'sorbet/rbi/dsl/bottle.rbi', line 10 def cached_download(*args, &block); end |
#clear_cache ⇒ 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.
165 166 167 168 169 |
# File 'bottle.rb', line 165 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.
172 173 174 |
# File 'bottle.rb', line 172 def compatible_locations? @spec.compatible_locations?(tag: @tag) end |
#download_queue_name ⇒ 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.
275 |
# File 'bottle.rb', line 275 def download_queue_name = "#{name} (#{resource.version})" |
#download_queue_type ⇒ 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.
272 |
# File 'bottle.rb', line 272 def download_queue_type = "Bottle" |
#downloaded_and_valid? ⇒ 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.
146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'bottle.rb', line 146 def downloaded_and_valid? return false unless cached_download.file? resource_checksum = resource.checksum return false if resource_checksum.nil? downloader = resource.downloader return false unless downloader.is_a?(CurlGitHubPackagesDownloadStrategy) return false unless downloader.immutable_bottle_blob? downloader.bottle_blob_sha256 == resource_checksum.hexdigest end |
#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.
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.
136 137 138 139 140 141 142 143 |
# File 'bottle.rb', line 136 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) ⇒ 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.
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'bottle.rb', line 188 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 |
#filename ⇒ Filename
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.
240 |
# File 'bottle.rb', line 240 def filename = Filename.new(@name, @pkg_version, @tag, @spec.rebuild) |
#github_packages_manifest_resource ⇒ Resource::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.
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'bottle.rb', line 243 def github_packages_manifest_resource return if @resource.download_strategy != CurlGitHubPackagesDownloadStrategy @github_packages_manifest_resource ||= T.let( begin resource = Resource::BottleManifest.new(self) resource_version = @resource.version odie "resource version is nil" if resource_version.nil? 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, T.nilable(Resource::BottleManifest), ) end |
#installed_size ⇒ Integer?
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.
224 225 226 227 228 229 |
# File 'bottle.rb', line 224 def installed_size resource = github_packages_manifest_resource return unless resource&.downloaded? resource.installed_size end |
#path_exec_files ⇒ Array<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.
232 233 234 235 236 237 |
# File 'bottle.rb', line 232 def path_exec_files resource = github_packages_manifest_resource return unless resource&.downloaded? resource.path_exec_files 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?
178 179 180 181 182 |
# File 'bottle.rb', line 178 def skip_relocation? attrs = tab_attributes tab = Tab.new(attrs) unless attrs.empty? @spec.skip_relocation?(tag: @tag, tab:) end |
#stage ⇒ 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.
185 |
# File 'bottle.rb', line 185 def stage = downloader.stage |
#tab_attributes ⇒ Hash{String => 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.
207 208 209 210 211 212 213 |
# File 'bottle.rb', line 207 def tab_attributes if (resource = github_packages_manifest_resource) && resource.downloaded? return resource.tab end {} end |
#total_size ⇒ Integer?
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.
160 161 162 |
# File 'bottle.rb', line 160 def total_size bottle_size || super 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.
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.
19 |
# File 'sorbet/rbi/dsl/bottle.rbi', line 19 def verify_download_integrity(*args, &block); end |