diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 203010dc75..713c8ca40c 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