Class: Homebrew::InstallSteps::Runner Private
- Includes:
- SystemCommand::Mixin, Utils::Output::Mixin
- Defined in:
- install_steps.rb,
install_steps/formula_actions.rb
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.
Constant Summary collapse
- CONTENT_PATH_TOKENS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
Path tokens reuse the step base resolution; formula metadata tokens are resolved separately. Anything else is left verbatim so literal braces in templates are never rewritten.
%w[ prefix opt_prefix bin sbin lib libexec share pkgshare var etc pkgetc staged_path appdir caskroom_path temp rack bash_completion zsh_completion fish_completion pwsh_completion ].freeze
- IMPLICIT_SUDO_STEP_TYPES =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
%w[delete_keychain_certificate set_ownership].freeze
Instance Method Summary collapse
- #initialize(context:, command: SystemCommand) ⇒ void constructor private
- #make_cpython_venv_activation_scripts_writable(lib_cellar) ⇒ void private
- #run(steps, phase: :install) ⇒ void private
- #sandbox_write_paths(steps, phase: :install) ⇒ Array<Pathname> private
- #sudo_required?(steps) ⇒ Boolean 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, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning
Methods included from SystemCommand::Mixin
#system_command, #system_command!
Constructor Details
#initialize(context:, command: SystemCommand) ⇒ 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.
884 885 886 887 888 |
# File 'install_steps.rb', line 884 def initialize(context:, command: SystemCommand) @context = context @command = command @guard_results = T.let({}, T::Hash[PathSpec, T::Boolean]) end |
Instance Method Details
#make_cpython_venv_activation_scripts_writable(lib_cellar) ⇒ 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.
273 274 275 |
# File 'install_steps/formula_actions.rb', line 273 def make_cpython_venv_activation_scripts_writable(lib_cellar) FileUtils.chmod "u+w", lib_cellar.glob("venv/scripts/**/*").select(&:file?) end |
#run(steps, phase: :install) ⇒ 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.
891 892 893 894 895 896 897 898 899 900 |
# File 'install_steps.rb', line 891 def run(steps, phase: :install) @guard_results.clear DSL.normalise_steps(steps).each do |step| if phase == :uninstall run_uninstall_step(step) else run_install_step(step) end end end |
#sandbox_write_paths(steps, phase: :install) ⇒ Array<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.
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 |
# File 'install_steps.rb', line 903 def sandbox_write_paths(steps, phase: :install) DSL.normalise_steps(steps).flat_map do |step| if phase == :uninstall next [] if step["type"] != "symlink" || step["uninstall"] != true next [resolve_path(step_path(step, "target")).parent] end case step.fetch("type") when "mkdir", "mkdir_p", "touch", "write" [resolve_path(step_path(step, "path")).parent] when "move" [resolve_path(step_path(step, "source")).parent, resolve_path(step_path(step, "target")).parent] when "move_children", "move_contents" [resolve_path(step_path(step, "source")), resolve_path(step_path(step, "target"))] when "copy", "symlink" [resolve_path(step_path(step, "target")).parent] when "remove" step_paths(step, "paths").flat_map { |path| (path) }.map(&:parent) when "inreplace", "change_dylib_id" key = (step["type"] == "inreplace") ? "path" : "source" [resolve_path(step_path(step, key))] when "link_dir", "link_children" [resolve_path(step_path(step, "target"))] when "run" paths = step.key?("stdout_path") ? [resolve_path(step_path(step, "stdout_path")).parent] : [] if step.key?("writable_paths") paths.concat(step_paths(step, "writable_paths").map do |path| resolve_path(path) end) end paths when "set_permissions", "set_ownership" existing_step_paths(step) else [] end end.uniq end |
#sudo_required?(steps) ⇒ 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.
944 945 946 947 948 949 |
# File 'install_steps.rb', line 944 def sudo_required?(steps) DSL.normalise_steps(steps).any? do |step| step["sudo"] == true || step["sudo"] == "if_needed" || IMPLICIT_SUDO_STEP_TYPES.include?(step["type"]) end end |