From f0c7e944bb4d958084840942cbd89cb96abd177f Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sun, 23 Aug 2009 17:57:45 +0100 Subject: [PATCH] Support optional HEAD builds for any formula A formula can have just a @head url or the user can specify to install HEAD with --head. We support subversion and git checkouts. The version is set to HEAD for head builds. Next step is making brew update handle these installs correctly. --- Library/Homebrew/formula.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 90ae10eeed..cc940ab79e 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -34,6 +34,13 @@ class Formula # Homebrew determines the name def initialize name='__UNKNOWN__' @url=self.class.url unless @url + + @head=self.class.head unless @head + if @head and (not @url or ARGV.flag? '--HEAD') + @url=@head + @version='HEAD' + end + raise if @url.nil? @name=name validate_variable :name @@ -116,7 +123,6 @@ class Formula puts "Type `exit' and Homebrew will attempt to finalize the installation" puts "If nothing is installed to #{prefix}, then Homebrew will abort" interactive_shell - raise "Non-zero exit status, installation aborted" if $? != 0 end end end @@ -175,8 +181,11 @@ private # creates a temporary directory then yields, when the block returns it # recursively deletes the temporary directory def mktemp - tmp=Pathname.new `mktemp -dt #{name}-#{version}`.strip - raise if not tmp.directory? or $? != 0 + # I used /tmp rather than mktemp -td because that generates a directory + # name with exotic characters like + in it, and these break badly written + # scripts that don't escape strings before trying to regexp them :( + tmp=Pathname.new `mktemp -d /tmp/homebrew-#{name}-#{version}-XXXX`.strip + raise "Couldn't create build sandbox" if not tmp.directory? or $? != 0 begin wd=Dir.pwd Dir.chdir tmp @@ -252,7 +261,7 @@ private end class <