bump-formula-pr: fix case when only url is provided

This commit is contained in:
Bevan Kay 2025-05-19 00:04:16 +10:00
parent 28eab5c9a0
commit effb07ee76
No known key found for this signature in database
GPG Key ID: C55CB024B5314B57

View File

@ -159,6 +159,7 @@ module Homebrew
new_url = args.url new_url = args.url
new_version = args.version new_version = args.version
check_new_version(commit_formula, tap_remote_repo, version: new_version) if new_version.present? check_new_version(commit_formula, tap_remote_repo, version: new_version) if new_version.present?
opoo "This formula has patches that may be resolved upstream." if commit_formula.patchlist.present? opoo "This formula has patches that may be resolved upstream." if commit_formula.patchlist.present?
@ -174,6 +175,7 @@ module Homebrew
end end
old_hash = commit_formula_spec.checksum&.hexdigest old_hash = commit_formula_spec.checksum&.hexdigest
new_hash = args.sha256 new_hash = args.sha256
new_tag = args.tag new_tag = args.tag
new_revision = args.revision new_revision = args.revision
@ -213,10 +215,9 @@ module Homebrew
elsif new_url.blank? && new_version.blank? elsif new_url.blank? && new_version.blank?
raise UsageError, "#{commit_formula}: no `--url` or `--version` argument specified!" raise UsageError, "#{commit_formula}: no `--url` or `--version` argument specified!"
else else
next unless new_version.present? new_url ||= PyPI.update_pypi_url(old_url, new_version) if new_version.present?
new_url ||= PyPI.update_pypi_url(old_url, new_version) if new_url.blank? && new_version.present?
if new_url.blank?
new_url = update_url(old_url, old_version, new_version) new_url = update_url(old_url, old_version, new_version)
if new_mirrors.blank? && old_mirrors.present? if new_mirrors.blank? && old_mirrors.present?
new_mirrors = old_mirrors.map do |old_mirror| new_mirrors = old_mirrors.map do |old_mirror|
@ -231,6 +232,9 @@ module Homebrew
#{new_url} #{new_url}
EOS EOS
end end
if new_url.blank?
odie "There was an issue generating the updated url, you may need to create the PR manually"
end
check_new_version(commit_formula, tap_remote_repo, url: new_url) if new_version.blank? check_new_version(commit_formula, tap_remote_repo, url: new_url) if new_version.blank?
resource_path, forced_version = fetch_resource_and_forced_version(commit_formula, new_version, new_url) resource_path, forced_version = fetch_resource_and_forced_version(commit_formula, new_version, new_url)
Utils::Tar.validate_file(resource_path) Utils::Tar.validate_file(resource_path)
@ -407,7 +411,7 @@ module Homebrew
{ {
sourcefile_path: commit_formula.path, sourcefile_path: commit_formula.path,
old_contents:, old_contents:,
commit_message: "#{commit_formula.name} #{args.version}", commit_message: "#{commit_formula.name} #{new_formula_version}",
additional_files: alias_rename, additional_files: alias_rename,
formula_pr_message:, formula_pr_message:,
formula_name: commit_formula.name, formula_name: commit_formula.name,
@ -437,6 +441,7 @@ module Homebrew
end end
new_formula_version = T.must(commits.first)[:new_version] new_formula_version = T.must(commits.first)[:new_version]
pr_title = if args.bump_synced.nil? pr_title = if args.bump_synced.nil?
"#{formula.name} #{new_formula_version}" "#{formula.name} #{new_formula_version}"
else else