Reduce the internal formula API to contain the bare minimum data

This commit is contained in:
Rylan Polster 2025-06-05 02:08:29 -04:00
parent 0b67caf718
commit b44ec56267
No known key found for this signature in database
2 changed files with 11 additions and 5 deletions

View File

@ -75,9 +75,7 @@ module Homebrew
Homebrew::API.merge_variations(cask, bottle_tag:) Homebrew::API.merge_variations(cask, bottle_tag:)
end end
unless args.dry_run? File.write("api/internal/cask.#{bottle_tag}.json", JSON.generate(variation_casks)) unless args.dry_run?
File.write("api/internal/cask.#{bottle_tag}.json", JSON.pretty_generate(variation_casks))
end
end end
end end
end end

View File

@ -70,11 +70,19 @@ module Homebrew
OnSystem::VALID_OS_ARCH_TAGS.each do |bottle_tag| OnSystem::VALID_OS_ARCH_TAGS.each do |bottle_tag|
variation_formulae = all_formulae.map do |_, formula| variation_formulae = all_formulae.map do |_, formula|
Homebrew::API.merge_variations(formula, bottle_tag:) formula = Homebrew::API.merge_variations(formula, bottle_tag:)
version = Version.new(formula.dig("versions", "stable"))
pkg_version = PkgVersion.new(version, formula["revision"])
rebuild = formula.dig("bottle", "stable", "rebuild") || 0
sha256 = formula.dig("bottle", "stable", "files", :all, "sha256")
sha256 ||= formula.dig("bottle", "stable", "files", bottle_tag.to_sym, "sha256")
[formula["name"], pkg_version.to_s, rebuild, sha256]
end end
unless args.dry_run? unless args.dry_run?
File.write("api/internal/formula.#{bottle_tag}.json", JSON.pretty_generate(variation_formulae)) File.write("api/internal/formula.#{bottle_tag}.json", JSON.generate(variation_formulae))
end end
end end
end end