Class: RubyInstaller::Build::Components::PacmanUpdate
- Defined in:
- lib/ruby_installer/build/components/02_pacman_update.rb
Constant Summary
Constants included from RubyInstaller::Build::Colors
RubyInstaller::Build::Colors::ColorMap, RubyInstaller::Build::Colors::ESC, RubyInstaller::Build::Colors::NND
Instance Attribute Summary
Attributes inherited from Base
#builtin_packages_dir, #msys, #pacman_args, #task_index
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#autorebase, #check_hash, #download, #initialize, #kill_all_msys2_processes, #puts, #run_verbose, #shell_escape, #shell_join
Methods included from RubyInstaller::Build::Colors
colored, disable_colors, enable_colors, initialize
Constructor Details
This class inherits a constructor from RubyInstaller::Build::Components::Base
Class Method Details
.depends ⇒ Object
5 6 7 |
# File 'lib/ruby_installer/build/components/02_pacman_update.rb', line 5 def self.depends %w[msys2] end |
Instance Method Details
#description ⇒ Object
9 10 11 |
# File 'lib/ruby_installer/build/components/02_pacman_update.rb', line 9 def description "MSYS2 system update (optional)" end |
#execute(args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ruby_installer/build/components/02_pacman_update.rb', line 13 def execute(args) require "tempfile" msys.with_msys_apps_enabled do puts "Check msys2-keyring version:" IO.popen(%w[pacman -Q msys2-keyring>=1~20240410-1], err: :out, &:read) if $?.success? puts green(" -> up-to-date") else puts yellow(" -> Update keyring according to https://www.msys2.org/news/#2020-06-29-new-packagers") tar_path = File.join(builtin_packages_dir, "msys2-keyring-1~20240410-1-any.pkg.tar.zst") tf = Tempfile.new run_verbose("pacman", "-U", "--noconfirm", "--config", tf.path, tar_path) end puts "#{description} part 1 ..." # Update the package database and core system packages res = run_verbose("pacman", "-Syu", *pacman_args) puts "#{description} #{res ? green("succeeded") : red("failed")}" raise "pacman failed" unless res kill_all_msys2_processes autorebase # Update the rest puts "#{description} part 2 ..." res = run_verbose("pacman", "-Syu", *pacman_args) puts "#{description} #{res ? green("succeeded") : red("failed")}" raise "pacman failed" unless res autorebase end end |