aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2013-06-08 16:41:23 +0100
committerMike McQuaid2013-06-08 16:41:23 +0100
commit95f9c6227a99a2cfa3f9768ab867d3c775693b56 (patch)
tree1b926636ee937b19352e1ec2d2c2f9983fa733e3 /Library
parentff65923531f2642d5998251100f4ed1615003983 (diff)
downloadbrew-95f9c6227a99a2cfa3f9768ab867d3c775693b56.tar.bz2
Use new download strategy for local bottles.
Fixes installation of e.g. ScriptFileFormula/denominator bottles.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb18
-rw-r--r--Library/Homebrew/formula_installer.rb10
2 files changed, 18 insertions, 10 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index e2ce122de..5bdc7ebd0 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -2,6 +2,8 @@ require 'open-uri'
require 'vendor/multi_json'
class AbstractDownloadStrategy
+ attr_accessor :local_bottle_path
+
def initialize name, package
@url = package.url
specs = package.specs
@@ -36,8 +38,6 @@ class AbstractDownloadStrategy
end
class CurlDownloadStrategy < AbstractDownloadStrategy
- attr_accessor :local_bottle_path
-
def initialize name, package
super
@@ -49,7 +49,6 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
@mirrors = package.mirrors
@temporary_path = Pathname.new("#@tarball_path.incomplete")
- @local_bottle_path = nil
end
def cached_location
@@ -66,11 +65,6 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
end
def fetch
- if @local_bottle_path
- @tarball_path = @local_bottle_path
- return @local_bottle_path
- end
-
ohai "Downloading #{@url}"
unless @tarball_path.exist?
had_incomplete_download = @temporary_path.exist?
@@ -230,6 +224,14 @@ class CurlBottleDownloadStrategy < CurlDownloadStrategy
end
end
+# This strategy extracts local binary packages.
+class LocalBottleDownloadStrategy < CurlDownloadStrategy
+ def initialize formula, local_bottle_path
+ super formula.name, formula.active_spec
+ @tarball_path = local_bottle_path
+ end
+end
+
class SubversionDownloadStrategy < AbstractDownloadStrategy
def initialize name, package
super
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 755716dfc..6f8667c8e 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -403,8 +403,14 @@ class FormulaInstaller
end
def pour
- fetched, downloader = f.fetch, f.downloader
- f.verify_download_integrity(fetched) unless downloader.local_bottle_path
+ downloader = f.downloader
+ if downloader.local_bottle_path
+ downloader = LocalBottleDownloadStrategy.new f,
+ downloader.local_bottle_path
+ else
+ fetched = f.fetch
+ f.verify_download_integrity fetched
+ end
HOMEBREW_CELLAR.cd do
downloader.stage
end