From 3ebd7df62d0b05a8a010bec74793cc4e688a2fc8 Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Thu, 22 Dec 2016 00:54:08 -0500 Subject: [PATCH] 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. --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index b1f851b8db..8fdbd97b6f 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -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 [