aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2013-10-05 20:32:05 +0100
committerMike McQuaid2013-10-10 16:46:47 +0100
commit2dc871b3b764613c632c94c6a3f49aba3836bdab (patch)
treea5dda00c885a4887e29516f3acbe855cffe3b6ae
parentecdbd424e88bac448ba44bfb6572efc03f9f5c9d (diff)
downloadhomebrew-2dc871b3b764613c632c94c6a3f49aba3836bdab.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.
-rw-r--r--Library/Homebrew/formula_installer.rb28
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