From e686a392c500888f85a069b625fc70495a920af5 Mon Sep 17 00:00:00 2001 From: Rylan Polster <rslpolster@gmail.com> Date: Thu, 17 Sep 2020 21:35:01 -0400 Subject: [PATCH] bump-formula-pr: add message to check resources --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 15 +++++++++++++-- Library/Homebrew/utils/pypi.rb | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index f7a796bb89..4fec1e3112 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -330,11 +330,22 @@ module Homebrew end unless args.dry_run? - PyPI.update_python_resources! formula, new_formula_version, silent: args.quiet?, ignore_non_pypi_packages: true + resources_checked = PyPI.update_python_resources! formula, new_formula_version, + silent: args.quiet?, ignore_non_pypi_packages: true end run_audit(formula, alias_rename, old_contents, args: args) + pr_message = "Created with `brew bump-formula-pr`." + if resources_checked.nil? && formula.resources.present? && + formula.resources.any? { |resource| resource.name != "homebrew-virtualenv" } + pr_message += <<~EOS + + + `resource` blocks may require updates. + EOS + end + pr_info = { sourcefile_path: formula.path, old_contents: old_contents, @@ -345,7 +356,7 @@ module Homebrew previous_branch: previous_branch, tap: formula.tap, tap_full_name: tap_full_name, - pr_message: "Created with `brew bump-formula-pr`.", + pr_message: pr_message, } GitHub.create_bump_pr(pr_info, args: args) end diff --git a/Library/Homebrew/utils/pypi.rb b/Library/Homebrew/utils/pypi.rb index 073f4748cb..a2acc0bda0 100644 --- a/Library/Homebrew/utils/pypi.rb +++ b/Library/Homebrew/utils/pypi.rb @@ -56,6 +56,7 @@ module PyPI [json["info"]["name"], sdist["url"], sdist["digests"]["sha256"]] end + # Return true if resources were checked (even if no change) def update_python_resources!(formula, version = nil, print_only: false, silent: false, ignore_non_pypi_packages: false) @@ -160,5 +161,7 @@ module PyPI end s.sub! inreplace_regex, new_resource_blocks end + + true end end -- GitLab