From a2066af2fda27223c25b3a91ff2ea5fa5017f8b0 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Tue, 11 Aug 2009 18:16:12 +0100 Subject: [PATCH] Allow user to specify patch level The default is p0, but if you return a Hash instead of an array from patches you can specify patch level. See the comment documentation. Closes Homebrew/homebrew#10 --- Library/Homebrew/formula.rb | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index dfa70438c6..3ba29563e3 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -30,6 +30,7 @@ class FormulaUnavailableError ['http://foo.com/patch1', 'http://foo.com/patch2'], + # :p1 => 'http://bar.com/patch2', + # :p2 => ['http://moo.com/patch5', 'http://moo.com/patch6'] + # } def patches; [] end # reimplement and specify dependencies def deps; end @@ -179,14 +187,33 @@ private end def patch - unless patches.empty? - ohai "Patching" + return if patches.empty? + ohai "Patching" + if patches.kind_of? Hash + patch_args=[] + curl_args=[] + n=0 + patches.each do |arg, urls| + urls.each do |url| + dst='%03d-homebrew.patch' % n+=1 + curl_args<