diff options
| author | Mike McQuaid | 2013-10-05 20:32:05 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2013-10-10 16:46:47 +0100 |
| commit | a9764503b29a754762bfbfb4d4759a321cd29af1 (patch) | |
| tree | 71685c78049b3370954b3832127a8abe0117dea7 /Library | |
| parent | af4247429b7b1352592bca28238d8bb61194454a (diff) | |
| download | brew-a9764503b29a754762bfbfb4d4759a321cd29af1.tar.bz2 | |
formula_installer: handle etc/var in bottles.
Copy these files/folders to a .bottle directory under the Cellar for installation
elsewhere at pouring time.
Temporarily disable HOMEBREW_GIT_ETC methods until fixed.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 4ac078d8d..e27f636f3 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -9,6 +9,7 @@ require 'bottles' require 'caveats' require 'cleaner' require 'formula_cellar_checks' +require 'install_renamed' class FormulaInstaller include FormulaCellarChecks @@ -124,6 +125,18 @@ class FormulaInstaller end end + def build_bottle_preinstall + @etc_var_glob ||= "#{HOMEBREW_PREFIX}/{etc,var}/**/*" + @etc_var_preinstall = Dir[@etc_var_glob] + end + + def build_bottle_postinstall + @etc_var_postinstall = Dir[@etc_var_glob] + (@etc_var_postinstall - @etc_var_preinstall).each do |file| + Pathname.new(file).cp_path_sub(HOMEBREW_PREFIX, f.bottle_prefix) + end + end + def install # not in initialize so upgrade can unlink the active keg before calling this # function but after instantiating this class so that it can avoid having to @@ -162,7 +175,7 @@ class FormulaInstaller @@attempted << f - git_etc_preinstall if HOMEBREW_GIT_ETC + #git_etc_preinstall if HOMEBREW_GIT_ETC @poured_bottle = false @@ -180,18 +193,22 @@ class FormulaInstaller opoo "Bottle installation failed: building from source." end + build_bottle_preinstall if ARGV.build_bottle? + unless @poured_bottle build clean end + build_bottle_postinstall if ARGV.build_bottle? + begin f.post_install rescue opoo "#{f.name} post_install failed. Rerun with `brew postinstall #{f.name}`." end - git_etc_postinstall if HOMEBREW_GIT_ETC + #git_etc_postinstall if HOMEBREW_GIT_ETC opoo "Nothing was installed to #{f.prefix}" unless f.installed? end @@ -532,6 +549,13 @@ class FormulaInstaller HOMEBREW_CELLAR.cd do downloader.stage end + + Dir["#{f.bottle_prefix}/{etc,var}/**/*"].each do |file| + path = Pathname.new(file) + path.extend(InstallRenamed) + path.cp_path_sub(f.bottle_prefix, HOMEBREW_PREFIX) + end + FileUtils.rm_rf f.bottle_prefix end ## checks |
