bottle: merging problem when head conatins commas

If `head` sections contains commas (e.g. `url "https://github.com/tarantool/tarantool.git", :branch => "1.6", :shallow => false`)
then re thinks that it reached the end and inserts `bottle do <-> end`
block before it, that leads to problems in ` brew audit --devel tarantool --strict --online`:

```
==> audit problems
tarantool:
 * `head` (line 11) should be put before `bottle block` (line 7)
```

It blocks Homebrew/homebrew#47495

Closes Homebrew/homebrew#47931.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
This commit is contained in:
bigbes 2016-01-11 00:26:48 +07:00 committed by Dominyk Tiller
parent 6c380f0e85
commit 5e25b08fe4

View File

@ -371,15 +371,15 @@ module Homebrew
else
string = s.sub!(
/(
\ {2}( # two spaces at the beginning
url\ ['"][\S\ ]+['"] # url with a string
\ {2}( # two spaces at the beginning
(url|head)\ ['"][\S\ ]+['"] # url or head with a string
(
,[\S\ ]*$ # url may have options
(\n^\ {3}[\S\ ]+$)* # options can be in multiple lines
,[\S\ ]*$ # url may have options
(\n^\ {3}[\S\ ]+$)* # options can be in multiple lines
)?|
(homepage|desc|sha1|sha256|head|version|mirror)\ ['"][\S\ ]+['"]| # specs with a string
revision\ \d+ # revision with a number
)\n+ # multiple empty lines
(homepage|desc|sha1|sha256|version|mirror)\ ['"][\S\ ]+['"]| # specs with a string
revision\ \d+ # revision with a number
)\n+ # multiple empty lines
)+
/mx, '\0' + output + "\n")
end