diff options
| author | Mike McQuaid | 2013-06-08 16:41:23 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2013-06-08 16:41:23 +0100 |
| commit | b0974b61e7da4c4c0679683225decfcaff5574f0 (patch) | |
| tree | ee230412c187424dc18e0ce394056a9f09527b6b /Library | |
| parent | 0817d4e3a99ce2defde2ce9b190fbd6069d66628 (diff) | |
| download | homebrew-b0974b61e7da4c4c0679683225decfcaff5574f0.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.rb | 18 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 10 |
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 |
