aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorDavid Höppner2010-02-02 13:43:44 +0100
committerDavid Höppner2010-02-02 13:43:44 +0100
commit38e1ee4b2fdadb7a6f23ac32b31834747e514e2b (patch)
tree38d45d7d9f78832059395ac5cb0d69220a2055ac /Library
parent9e5695ad432b9b68f7e507c45d0bcac5769645ba (diff)
downloadhomebrew-38e1ee4b2fdadb7a6f23ac32b31834747e514e2b.tar.bz2
Bazaar download strategy
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb34
-rw-r--r--Library/Homebrew/formula.rb1
2 files changed, 35 insertions, 0 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index c15ea4bd6..9a74ff59d 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -274,3 +274,37 @@ class MercurialDownloadStrategy <AbstractDownloadStrategy
end
end
end
+
+class BazaarDownloadStrategy <AbstractDownloadStrategy
+ def fetch
+ raise "You must install bazaar first" \
+ unless system "/usr/bin/which bzr"
+
+ ohai "Cloning #{@url}"
+ @clone=HOMEBREW_CACHE+@unique_token
+
+ url=@url.sub(%r[^bzr://], '')
+
+ unless @clone.exist?
+ # 'lightweight' means history-less
+ safe_system 'bzr', 'checkout', '--lightweight', url, @clone
+ else
+ puts "Updating #{@clone}"
+ Dir.chdir(@clone) { safe_system 'bzr', 'update' }
+ end
+ end
+
+ def stage
+ dst=Dir.getwd
+ Dir.chdir @clone do
+ if @spec and @ref
+ ohai "Checking out #{@spec} #{@ref}"
+ Dir.chdir @clone do
+ safe_system 'bzr', 'export', '-r', @ref, dst
+ end
+ else
+ safe_system 'bzr', 'export', dst
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 9485553cf..0af5651e3 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -159,6 +159,7 @@ class Formula
when %r[^svn://] then SubversionDownloadStrategy
when %r[^svn+http://] then SubversionDownloadStrategy
when %r[^git://] then GitDownloadStrategy
+ when %r[^bzr://] then BazaarDownloadStrategy
when %r[^https?://(.+?\.)?googlecode\.com/hg] then MercurialDownloadStrategy
when %r[^https?://(.+?\.)?googlecode\.com/svn] then SubversionDownloadStrategy
when %r[^https?://(.+?\.)?sourceforge\.net/svnroot/] then SubversionDownloadStrategy