From a9725657394ee985e7fd4107dcbd253fe1253452 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Tue, 28 Apr 2015 15:52:39 +0800 Subject: bottle: matching url with options Closes Homebrew/homebrew-versions#791. Closes Homebrew/homebrew#39137. Signed-off-by: Xu Cheng --- Library/Homebrew/cmd/bottle.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3