Class: Resource::BottleManifest Private
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.
A resource for a bottle manifest.
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
- #bottle ⇒ Bottle readonly private
- #manifest_annotations ⇒ void writeonly private
Instance Method Summary collapse
- #bottle_size ⇒ Integer? private
- #clear_cache ⇒ void private
- #download_queue_name ⇒ String private
- #download_queue_type ⇒ String private
- #downloaded_and_valid? ⇒ Boolean private
- #initialize(bottle) ⇒ void constructor private
- #installed_size ⇒ Integer? private
- #path_exec_files ⇒ Array<String>? private
- #sbom_supplement ⇒ Hash{String => Object}? private
- #tab ⇒ Hash{String => T.untyped} private
- #verify_download_integrity(_filename) ⇒ void private
Constructor Details
#initialize(bottle) ⇒ 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.
365 366 367 368 369 |
# File 'resource.rb', line 365 def initialize(bottle) super("#{bottle.name}_bottle_manifest") @bottle = bottle @manifest_annotations = T.let(nil, T.nilable(T::Hash[String, String])) end |
Instance Attribute Details
#bottle ⇒ Bottle (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.
359 360 361 |
# File 'resource.rb', line 359 def bottle @bottle end |
#manifest_annotations=(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.
362 363 364 |
# File 'resource.rb', line 362 def manifest_annotations=(value) @manifest_annotations = value 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.
407 408 409 |
# File 'resource.rb', line 407 def bottle_size manifest_annotations["sh.brew.bottle.size"]&.to_i 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.
372 373 374 375 |
# File 'resource.rb', line 372 def clear_cache super @manifest_annotations = nil 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.
445 |
# File 'resource.rb', line 445 def download_queue_name = "#{bottle.name} (#{bottle.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.
442 |
# File 'resource.rb', line 442 def download_queue_type = "Bottle Manifest" |
#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.
384 385 386 387 388 389 390 391 392 |
# File 'resource.rb', line 384 def downloaded_and_valid? return false unless downloaded? with_context(quiet: true) { verify_download_integrity(cached_download) } true rescue Error clear_cache false 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.
412 413 414 |
# File 'resource.rb', line 412 def installed_size manifest_annotations["sh.brew.bottle.installed_size"]&.to_i 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.
417 418 419 |
# File 'resource.rb', line 417 def path_exec_files manifest_annotations["sh.brew.path_exec_files"]&.split(",") end |
#sbom_supplement ⇒ Hash{String => 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.
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'resource.rb', line 422 def sbom_supplement supplement = manifest_annotations["sh.brew.sbom.supplement"] return if supplement.blank? parsed_supplement = JSON.parse(supplement) return unless parsed_supplement.is_a?(Hash) if ( = parsed_supplement["tags"]).is_a?(Hash) tag_supplement = [Utils::Bottles.tag.to_s] return tag_supplement if tag_supplement.is_a?(Hash) return end parsed_supplement rescue JSON::ParserError nil end |
#tab ⇒ 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.
395 396 397 398 399 400 401 402 403 404 |
# File 'resource.rb', line 395 def tab tab = manifest_annotations["sh.brew.tab"] raise Error, "Couldn't find tab from manifest." if tab.blank? begin JSON.parse(tab) rescue JSON::ParserError raise Error, "Couldn't parse tab JSON." end end |
#verify_download_integrity(_filename) ⇒ 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.
378 379 380 381 |
# File 'resource.rb', line 378 def verify_download_integrity(_filename) # We don't have a checksum, but we can at least try parsing it. tab end |