diff options
| author | Max Howell | 2009-08-23 17:57:45 +0100 |
|---|---|---|
| committer | Max Howell | 2009-08-24 01:04:54 +0100 |
| commit | f0c7e944bb4d958084840942cbd89cb96abd177f (patch) | |
| tree | 0a2ba9bf6d06510b8407c2dfc72fd594e257348f /Library | |
| parent | 4c2d4c8560aff4011dde08a0585c72e2b9f8a2c1 (diff) | |
| download | brew-f0c7e944bb4d958084840942cbd89cb96abd177f.tar.bz2 | |
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.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 90ae10eee..cc940ab79 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 <<self - attr_reader :url, :svnurl, :version, :homepage, :md5, :sha1 + attr_reader :url, :version, :homepage, :md5, :sha1, :head end end |
