bump-formula-pr: expedite check for missing mirror argument

This commit is contained in:
Seeker 2020-09-04 12:53:37 -07:00
parent 2314ddf9f5
commit a4d4fb574c

View File

@ -145,6 +145,21 @@ module Homebrew
formula_spec = formula.stable formula_spec = formula.stable
odie "#{formula}: no #{requested_spec} specification found!" unless formula_spec odie "#{formula}: no #{requested_spec} specification found!" unless formula_spec
new_mirrors ||= args.mirror
new_mirror ||= determine_mirror(new_url)
new_mirrors ||= [new_mirror] unless new_mirror.nil?
if !new_mirrors && !formula_spec.mirrors.empty?
if args.force?
opoo "#{formula}: Removing all mirrors because a --mirror= argument was not specified."
else
odie <<~EOS
#{formula}: a --mirror= argument for updating the mirror URL was not specified.
Use --force to remove all mirrors.
EOS
end
end
hash_type, old_hash = if (checksum = formula_spec.checksum) hash_type, old_hash = if (checksum = formula_spec.checksum)
[checksum.hash_type, checksum.hexdigest] [checksum.hash_type, checksum.hexdigest]
end end
@ -152,9 +167,6 @@ module Homebrew
new_hash = args[hash_type] if hash_type new_hash = args[hash_type] if hash_type
new_tag = args.tag new_tag = args.tag
new_revision = args.revision new_revision = args.revision
new_mirrors ||= args.mirror
new_mirror ||= determine_mirror(new_url)
new_mirrors ||= [new_mirror] unless new_mirror.nil?
old_url = formula_spec.url old_url = formula_spec.url
old_tag = formula_spec.specs[:tag] old_tag = formula_spec.specs[:tag]
old_formula_version = formula_version(formula, requested_spec) old_formula_version = formula_version(formula, requested_spec)
@ -303,17 +315,6 @@ module Homebrew
new_formula_version = formula_version(formula, requested_spec, new_contents) new_formula_version = formula_version(formula, requested_spec, new_contents)
if !new_mirrors && !formula_spec.mirrors.empty?
if args.force?
opoo "#{formula}: Removing all mirrors because a --mirror= argument was not specified."
else
odie <<~EOS
#{formula}: a --mirror= argument for updating the mirror URL was not specified.
Use --force to remove all mirrors.
EOS
end
end
if new_formula_version < old_formula_version if new_formula_version < old_formula_version
formula.path.atomic_write(old_contents) unless args.dry_run? formula.path.atomic_write(old_contents) unless args.dry_run?
odie <<~EOS odie <<~EOS