aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2015-04-28 15:52:39 +0800
committerXu Cheng2015-04-28 18:59:40 +0800
commita9725657394ee985e7fd4107dcbd253fe1253452 (patch)
tree0a0f36c0132dfa2ec56104f03e5336e3b8b5f57d /Library
parentc07da9485f836f438762b6347ab21b55fd6d9c4e (diff)
downloadbrew-a9725657394ee985e7fd4107dcbd253fe1253452.tar.bz2
bottle: matching url with options
Closes Homebrew/homebrew-versions#791. Closes Homebrew/homebrew#39137. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/bottle.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 203010dc7..713c8ca40 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -257,7 +257,18 @@ module Homebrew
indent = s.slice(/^ +stable do/).length - "stable do".length
string = s.sub!(/^ {#{indent}}stable do(.|\n)+?^ {#{indent}}end\n/m, '\0' + output + "\n")
else
- string = s.sub!(/( ((url|sha1|sha256|head|version|mirror) ['"][\S ]+['"]|revision \d+)\n+)+/m, '\0' + output + "\n")
+ string = s.sub!(/(
+ \ {2}( # two spaces at the beginning
+ url\ ['"][\S\ ]+['"] # url with a string
+ (
+ ,[\S\ ]*$ # url may have options
+ (\n^\ {3}[\S\ ]+$)* # options can be in multiple lines
+ )?|
+ (sha1|sha256|head|version|mirror)\ ['"][\S\ ]+['"]| # specs with a string
+ revision\ \d+ # revision with a number
+ )\n+ # multiple empty lines
+ )+
+ /mx, '\0' + output + "\n")
end
odie 'Bottle block addition failed!' unless string
end