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
commitd8b093f279048d955eca9a2658678964b06dca99 (patch)
tree2b4a23e4dbb1d083d5d093772cb447ca774e4e41 /Library
parent6d06b9a1796383e9daf40670a0995da6eefd330b (diff)
downloadbrew-d8b093f279048d955eca9a2658678964b06dca99.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