bottle: add homepage and desc into regex

Some formulae put `desc` field behind `url` which can make bottle block go to strange place.
So let's add `homepage` and `desc` into bottle regex.

Closes Homebrew/homebrew#40469.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-06-07 16:44:03 +08:00
parent f8efea0cf3
commit 3c418cfb4e

View File

@ -250,18 +250,19 @@ module Homebrew
indent = s.slice(/^ +stable do/).length - "stable do".length indent = s.slice(/^ +stable do/).length - "stable do".length
string = s.sub!(/^ {#{indent}}stable do(.|\n)+?^ {#{indent}}end\n/m, '\0' + output + "\n") string = s.sub!(/^ {#{indent}}stable do(.|\n)+?^ {#{indent}}end\n/m, '\0' + output + "\n")
else else
string = s.sub!(/( string = s.sub!(
\ {2}( # two spaces at the beginning /(
url\ ['"][\S\ ]+['"] # url with a string \ {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 ,[\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 (homepage|desc|sha1|sha256|head|version|mirror)\ ['"][\S\ ]+['"]| # specs with a string
)\n+ # multiple empty lines revision\ \d+ # revision with a number
)+ )\n+ # multiple empty lines
/mx, '\0' + output + "\n") )+
/mx, '\0' + output + "\n")
end end
odie 'Bottle block addition failed!' unless string odie 'Bottle block addition failed!' unless string
end end