bump-formula-pr: fix removal of old mirrors

Previously, old mirrors are only removed if the requested spec is
stable, and if the mirror lines only have two leading spaces. This leads
to stale mirror line(s) when the formula a stable block like

    stable do
      url "http://example.com/v1.0.tar.gz"
      mirror "http://example.net/v1.0.tar.gz"
    end

where the mirror line is lead by four spaces.

In this commit, we discard the /(^ mirror .*\n)?/ pattern, and instead
create a pattern with the exact url and flexible leading spaces for each
mirror of the requested spec.
This commit is contained in:
Zhiming Wang
2016-12-22 00:54:08 -05:00
parent 8f85eb64c4
commit 3ebd7df62d
+3 -1
View File
@@ -156,7 +156,9 @@ module Homebrew
replacement_pairs << [/^ revision \d+\n(\n( head "))?/m, "\\2"]
end
replacement_pairs << [/(^ mirror .*\n)?/, ""] if requested_spec == :stable
replacement_pairs += formula_spec.mirrors.map do |mirror|
[/ +mirror \"#{mirror}\"\n/m, ""]
end
replacement_pairs += if new_url_hash
[