Class: Homebrew::DevCmd::Verify Private

Inherits:
AbstractCommand show all
Defined in:
dev-cmd/verify.rb,
sorbet/rbi/dsl/homebrew/dev_cmd/verify.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?

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::DevCmd::Verify::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/dev_cmd/verify.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.



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
78
79
80
81
82
# File 'dev-cmd/verify.rb', line 38

def run
  bucket = if args.deps?
    args.named.to_formulae.flat_map do |formula|
      [formula, *formula.recursive_dependencies.map(&:to_formula)]
    end
  else
    args.named.to_formulae
  end.uniq

  os_arch_combinations = args.os_arch_combinations
  json_results = []
  bucket.each do |formula|
    os_arch_combinations.each do |os, arch|
      SimulateSystem.with(os:, arch:) do
        bottle_tag = if (bottle_tag = args.bottle_tag&.to_sym)
          Utils::Bottles::Tag.from_symbol(bottle_tag)
        else
          Utils::Bottles::Tag.new(system: os, arch:)
        end

        bottle = formula.bottle_for_tag(bottle_tag)

        if bottle
          bottle.clear_cache if args.force?
          bottle.fetch
          begin
            attestation = Homebrew::Attestation.check_core_attestation bottle
            oh1 "#{bottle.filename} has a valid attestation"
            json_results.push(attestation)
          rescue Homebrew::Attestation::InvalidAttestationError => e
            ofail <<~ERR
              Failed to verify #{bottle.filename} with tag #{bottle_tag} due to error:

              #{e}
            ERR
          end
        else
          opoo "Bottle for tag #{bottle_tag.to_sym.inspect} is unavailable."
        end
      end
    end
  end

  puts json_results.to_json if args.json?
end