Include aliases, renames, and tap migrations in minimal APIs

This commit is contained in:
Rylan Polster 2025-08-11 00:31:00 -04:00
parent 97d299728d
commit d3aac3fa5f
No known key found for this signature in database
2 changed files with 34 additions and 6 deletions

View File

@ -71,11 +71,24 @@ module Homebrew
File.write("_data/cask_canonical.json", "#{canonical_json}\n") unless args.dry_run? File.write("_data/cask_canonical.json", "#{canonical_json}\n") unless args.dry_run?
OnSystem::VALID_OS_ARCH_TAGS.each do |bottle_tag| OnSystem::VALID_OS_ARCH_TAGS.each do |bottle_tag|
variation_casks = all_casks.map do |_, cask| renames = {}
Homebrew::API.merge_variations(cask, bottle_tag:) variation_casks = all_casks.map do |token, cask|
cask = Homebrew::API.merge_variations(cask, bottle_tag:)
cask["old_tokens"]&.each do |old_token|
renames[old_token] = token
end
cask
end end
File.write("api/internal/cask.#{bottle_tag}.json", JSON.generate(variation_casks)) unless args.dry_run? json_contents = {
casks: variation_casks,
renames: renames,
tap_migrations: CoreCaskTap.instance.tap_migrations,
}
File.write("api/internal/cask.#{bottle_tag}.json", JSON.generate(json_contents)) unless args.dry_run?
end end
end end
end end

View File

@ -69,9 +69,19 @@ module Homebrew
File.write("_data/formula_canonical.json", "#{canonical_json}\n") unless args.dry_run? File.write("_data/formula_canonical.json", "#{canonical_json}\n") unless args.dry_run?
OnSystem::VALID_OS_ARCH_TAGS.each do |bottle_tag| OnSystem::VALID_OS_ARCH_TAGS.each do |bottle_tag|
aliases = {}
renames = {}
variation_formulae = all_formulae.to_h do |name, formula| variation_formulae = all_formulae.to_h do |name, formula|
formula = Homebrew::API.merge_variations(formula, bottle_tag:) formula = Homebrew::API.merge_variations(formula, bottle_tag:)
formula["aliases"]&.each do |alias_name|
aliases[alias_name] = name
end
formula["oldnames"]&.each do |oldname|
renames[oldname] = name
end
version = Version.new(formula.dig("versions", "stable")) version = Version.new(formula.dig("versions", "stable"))
pkg_version = PkgVersion.new(version, formula["revision"]) pkg_version = PkgVersion.new(version, formula["revision"])
rebuild = formula.dig("bottle", "stable", "rebuild") || 0 rebuild = formula.dig("bottle", "stable", "rebuild") || 0
@ -87,9 +97,14 @@ module Homebrew
[name, [pkg_version.to_s, rebuild, sha256]] [name, [pkg_version.to_s, rebuild, sha256]]
end end
unless args.dry_run? json_contents = {
File.write("api/internal/formula.#{bottle_tag}.json", JSON.generate(variation_formulae)) formulae: variation_formulae,
end aliases: aliases,
renames: renames,
tap_migrations: CoreTap.instance.tap_migrations,
}
File.write("api/internal/formula.#{bottle_tag}.json", JSON.generate(json_contents)) unless args.dry_run?
end end
end end
end end