Class: Homebrew::Cmd::PortablePackageCmd Private

Inherits:
AbstractCommand show all
Defined in:
dev-cmd/portable-package.rb,
sorbet/rbi/dsl/homebrew/cmd/portable_package_cmd.rbi

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: Args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?

Methods included from Utils::Output::Mixin

#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::Cmd::PortablePackageCmd::Args

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/homebrew/cmd/portable_package_cmd.rbi', line 10

def args; end

#runvoid

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.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
# File 'dev-cmd/portable-package.rb', line 28

def run
  ENV["HOMEBREW_DEVELOPER"] = "1"

  verbose = []
  verbose << "--verbose" if args.verbose?
  verbose << "--debug" if args.debug?

  # If test-bot cleanup is performed and auto-updates are disabled, this might not already be installed.
  unless DevelopmentTools.ca_file_handles_most_https_certificates?
    safe_system HOMEBREW_BREW_FILE, "install", "ca-certificates"
  end

  args.named.each do |name|
    name = "portable-#{name}" unless name.start_with? "portable-"
    begin
      # On Linux, install glibc and linux-headers from bottles and don't install their build dependencies.
      bottled_dep_allowlist = /\A(?:glibc|linux-headers)@/
      deps = Dependency.expand(Formula[name], cache_key: "portable-package-#{name}") do |_dependent, dep|
        Dependency.prune if dep.test? || dep.optional?

        next unless bottled_dep_allowlist.match?(dep.name)

        Dependency.keep_but_prune_recursive_deps
      end.map(&:name)

      bottled_deps, deps = deps.partition { |dep| bottled_dep_allowlist.match?(dep) }

      safe_system HOMEBREW_BREW_FILE, "install", *verbose, *bottled_deps if bottled_deps.present?

      # Build bottles for all other dependencies.
      safe_system HOMEBREW_BREW_FILE, "install", "--build-bottle", *verbose, *deps

      safe_system HOMEBREW_BREW_FILE, "install", "--build-bottle", *verbose, name
      unless args.no_uninstall_deps?
        safe_system HOMEBREW_BREW_FILE, "uninstall", "--force", "--ignore-dependencies", *verbose, *deps
      end
      safe_system HOMEBREW_BREW_FILE, "test", *verbose, name
      puts "Linkage information:"
      safe_system HOMEBREW_BREW_FILE, "linkage", *verbose, name
      bottle_args = %w[
        --skip-relocation
        --json
        --no-rebuild
      ]
      safe_system HOMEBREW_BREW_FILE, "bottle", *verbose, *bottle_args, name
    rescue => e
      ofail e
    end
  end
end