From a28b57d3fb84a618d07cb636c387423d1ebbb850 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Oct 2013 16:15:31 -0700 Subject: [PATCH] git-etc: remove all code. I've given up on this; too many edge cases. If someone else wants to pick it up then send me a message and I'll walk you through the approach. --- Library/Homebrew/formula.rb | 5 +- Library/Homebrew/formula_installer.rb | 74 --------------------------- Library/Homebrew/install_renamed.rb | 2 +- 3 files changed, 2 insertions(+), 79 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 9190371ddb..12da44c18e 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -169,10 +169,7 @@ class Formula # generally we don't want var stuff inside the keg def var; HOMEBREW_PREFIX+'var' end - def bash_completion - etc = ENV['HOMEBREW_GIT_ETC'] ? self.etc : prefix+'etc' - etc+'bash_completion.d' - end + def bash_completion; prefix+'etc/bash_completion.d' end def zsh_completion; share+'zsh/site-functions' end # for storing etc, var files for later copying from bottles diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 562232b167..5870ceeff0 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -73,76 +73,6 @@ class FormulaInstaller raise end - def git_etc_preinstall - return unless quiet_system 'git', '--version' - - etc = HOMEBREW_PREFIX+'etc' - etc.cd do - quiet_system 'git', 'init' unless (etc+'.git').directory? - quiet_system 'git', 'checkout', '-B', "#{f.name}-preinstall" - unless quiet_system 'git', 'diff', '--exit-code', 'HEAD' - system 'git', 'add', '--all', '.' - system 'git', 'commit', '-m', "#{f.name}-#{f.version}: preinstall" - end - - unless quiet_system 'git', 'rev-parse', 'master' - quiet_system 'git', 'branch', 'master' - end - end - end - - def git_etc_postinstall - return unless quiet_system 'git', '--version' - - preinstall_branch = "#{f.name}-preinstall" - default_branch = "#{f.name}-default" - merged = false - f.etc.mkpath - f.etc.cd do - if quiet_system 'git', 'diff', '--exit-code', preinstall_branch - quiet_system 'git', 'branch', default_branch - quiet_system 'git', 'branch', '-D', preinstall_branch - elsif not quiet_system 'git', 'rev-parse', default_branch - quiet_system 'git', 'checkout', '-B', default_branch - quiet_system 'git', 'add', '--all', '.' - system 'git', 'commit', '-m', "#{f.name}-#{f.version}: default" - quiet_system 'git', 'branch', '-D', preinstall_branch - else - previous_default_branch = `git rev-parse #{default_branch}`.strip - quiet_system 'git', 'checkout', '-B', default_branch - quiet_system 'git', 'add', '--all', '.' - system 'git', 'commit', '-m', "#{f.name}-#{f.version}: default" - - default_unchanged = quiet_system('git', 'diff', '--exit-code', \ - previous_default_branch) - - if default_unchanged - system 'git', 'reset', '--hard', previous_default_branch - end - - quiet_system 'git', 'checkout', 'master' - quiet_system 'git', 'reset', '--hard', preinstall_branch - - unless default_unchanged - merge_ff = quiet_system 'git', 'merge', '--ff-only', '--no-edit', - '-X', 'ours', default_branch - unless merge_ff - merged = true - system 'git', 'merge', '--no-ff', '--no-edit', - '-X', 'ours', default_branch - end - end - end - - if merged - ohai "Configuration Files" - puts "Your configuration files for #{f.name} in etc were merged:" - puts "To reverse this merge: git reset --hard #{preinstall_branch}" - puts "To restore defaults: git reset --hard #{default_branch}" - end - end - end - def build_bottle_preinstall @etc_var_glob ||= "#{HOMEBREW_PREFIX}/{etc,var}/**/*" @etc_var_preinstall = Dir[@etc_var_glob] @@ -183,8 +113,6 @@ class FormulaInstaller @@attempted << f - git_etc_preinstall if ENV['HOMEBREW_GIT_ETC'] - @poured_bottle = false begin @@ -221,8 +149,6 @@ class FormulaInstaller opoo "#{f.name} post_install failed. Rerun with `brew postinstall #{f.name}`." end - git_etc_postinstall if ENV['HOMEBREW_GIT_ETC'] - opoo "Nothing was installed to #{f.prefix}" unless f.installed? end diff --git a/Library/Homebrew/install_renamed.rb b/Library/Homebrew/install_renamed.rb index 105791d2bd..42d0fee8f8 100644 --- a/Library/Homebrew/install_renamed.rb +++ b/Library/Homebrew/install_renamed.rb @@ -15,7 +15,7 @@ module InstallRenamed private def append_default_if_different src, dst - if File.file? dst and !FileUtils.identical?(src, dst) and !ENV['HOMEBREW_GIT_ETC'] + if File.file? dst and !FileUtils.identical?(src, dst) dst += ".default" end dst