diff options
| author | ilovezfs | 2016-09-04 11:21:08 -0700 |
|---|---|---|
| committer | ilovezfs | 2016-09-27 02:46:08 -0700 |
| commit | 394b0884ebd037ac69e44a6bab23d6e2341fb49c (patch) | |
| tree | b0628db64235c8e2be667d8d74751ab40a13c813 /Library/Homebrew | |
| parent | a9a62972bdce95a2b94db1be2e732480d88e17eb (diff) | |
| download | brew-394b0884ebd037ac69e44a6bab23d6e2341fb49c.tar.bz2 | |
bump-formula-pr: handle gnu mirrors
and add explicit version when not preexisting
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/dev-cmd/bump-formula-pr.rb | 18 |
1 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 2d89d85e8..a38d6edb5 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -109,7 +109,13 @@ module Homebrew elsif !hash_type odie "#{formula}: no tag/revision specified!" else - rsrc = Resource.new { @url = new_url } + rsrc_url = if requested_spec != :devel && new_url =~ /.*ftpmirror.gnu.*/ + new_mirror = new_url.sub "ftpmirror.gnu.org", "ftp.gnu.org/gnu" + new_mirror + else + new_url + end + rsrc = Resource.new { @url = rsrc_url } rsrc.download_strategy = CurlDownloadStrategy rsrc.owner = Resource.new(formula.name) rsrc_path = rsrc.fetch @@ -157,7 +163,15 @@ module Homebrew end if forced_version && forced_version != "0" - replacement_pairs << [old_formula_version, forced_version] + if File.read(formula.path).include?("version \"#{old_formula_version}\"") + replacement_pairs << [old_formula_version.to_s, forced_version] + else + if new_mirror + replacement_pairs << [/^( +)(mirror \"#{new_mirror}\"\n)/m, "\\1\\2\\1version \"#{forced_version}\"\n"] + else + replacement_pairs << [/^( +)(url \"#{new_url}\"\n)/m, "\\1\\2\\1version \"#{forced_version}\"\n"] + end + end elsif forced_version && forced_version == "0" replacement_pairs << [/^ version \"[a-z\d+\.]+\"\n/m, ""] end |
