Class: ExternalPatch Private
- Extended by:
- Forwardable
- Includes:
- Utils::Output::Mixin
- Defined in:
- external_patch.rb,
sorbet/rbi/dsl/external_patch.rbi
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 file containing a patch.
Instance Attribute Summary collapse
- #resource ⇒ Resource::Patch readonly private
- #strip ⇒ String, Symbol readonly private
Instance Method Summary collapse
- #apply ⇒ void private
- #cached_download(*args, &block) ⇒ T.untyped private
- #clear_cache(*args, &block) ⇒ T.untyped private
- #downloaded?(*args, &block) ⇒ Boolean private
- #external? ⇒ Boolean private
- #fetch(*args, &block) ⇒ T.untyped private
- #initialize(strip, &block) ⇒ void constructor private
- #owner=(owner) ⇒ void private
- #patch_files(*args, &block) ⇒ T.untyped private
- #url(*args, &block) ⇒ T.untyped private
- #verify_download_integrity(*args, &block) ⇒ T.untyped private
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, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_outdated, #pretty_uninstalled, #pretty_upgradable
Constructor Details
#initialize(strip, &block) ⇒ 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.
26 27 28 29 |
# File 'external_patch.rb', line 26 def initialize(strip, &block) @strip = strip @resource = T.let(Resource::Patch.new(&block), Resource::Patch) end |
Instance Attribute Details
#resource ⇒ Resource::Patch (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.
16 17 18 |
# File 'external_patch.rb', line 16 def resource @resource end |
#strip ⇒ 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.
19 20 21 |
# File 'external_patch.rb', line 19 def strip @strip end |
Instance Method Details
#apply ⇒ 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.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'external_patch.rb', line 43 def apply base_dir = Pathname.pwd resource.unpack do patch_dir = Pathname.pwd if patch_files.empty? children = patch_dir.children if children.length != 1 || !children.fetch(0).file? raise MissingApplyError, <<~EOS There should be exactly one patch file in the staging directory unless the "apply" method was used one or more times in the patch-do block. EOS end patch_files << children.fetch(0).basename end dir = base_dir dir /= T.must(resource.directory) if resource.directory.present? dir.cd do patch_files.each do |patch_file| ohai "Applying #{patch_file}" patch_file = patch_dir/patch_file Utils.safe_popen_write("patch", "-g", "0", "-f", "-#{strip}") do |p| File.foreach(patch_file) do |line| data = line.gsub("@@HOMEBREW_PREFIX@@", HOMEBREW_PREFIX) p.write(data) end end end end end rescue ErrorDuringExecution => e onoe e spec_owner = T.cast(T.must(resource.owner), SoftwareSpec).owner f = spec_owner.is_a?(::Formula) ? spec_owner : nil cmd, *args = e.cmd raise BuildError.new(f, cmd, args, ENV.to_hash) 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/external_patch.rbi', line 10 def cached_download(*args, &block); end |
#clear_cache(*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/external_patch.rbi', line 13 def clear_cache(*args, &block); end |
#downloaded?(*args, &block) ⇒ 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.
16 |
# File 'sorbet/rbi/dsl/external_patch.rbi', line 16 def downloaded?(*args, &block); end |
#external? ⇒ 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.
32 33 34 |
# File 'external_patch.rb', line 32 def external? true end |
#fetch(*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/external_patch.rbi', line 19 def fetch(*args, &block); end |
#owner=(owner) ⇒ 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.
37 38 39 40 |
# File 'external_patch.rb', line 37 def owner=(owner) resource.owner = owner resource.version(resource.checksum&.hexdigest || ERB::Util.url_encode(resource.url)) end |
#patch_files(*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.
22 |
# File 'sorbet/rbi/dsl/external_patch.rbi', line 22 def patch_files(*args, &block); 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.
25 |
# File 'sorbet/rbi/dsl/external_patch.rbi', line 25 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.
28 |
# File 'sorbet/rbi/dsl/external_patch.rbi', line 28 def verify_download_integrity(*args, &block); end |