| 
									
										
										
										
											2013-03-02 17:42:21 -06:00
										 |  |  | # encoding: UTF-8 | 
					
						
							| 
									
										
										
										
											2013-02-19 14:27:17 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-27 02:07:29 -07:00
										 |  |  | require 'cxxstdlib' | 
					
						
							| 
									
										
										
										
											2010-11-09 12:57:41 +00:00
										 |  |  | require 'exceptions' | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  | require 'formula' | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  | require 'keg' | 
					
						
							| 
									
										
										
										
											2011-09-22 20:07:39 -07:00
										 |  |  | require 'tab' | 
					
						
							| 
									
										
										
										
											2012-03-07 21:30:03 -05:00
										 |  |  | require 'bottles' | 
					
						
							| 
									
										
										
										
											2013-01-01 17:26:50 +00:00
										 |  |  | require 'caveats' | 
					
						
							| 
									
										
										
										
											2013-06-23 12:48:45 -07:00
										 |  |  | require 'cleaner' | 
					
						
							| 
									
										
										
										
											2013-07-15 19:28:10 -07:00
										 |  |  | require 'formula_cellar_checks' | 
					
						
							| 
									
										
										
										
											2013-10-05 20:32:05 +01:00
										 |  |  | require 'install_renamed' | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | class FormulaInstaller | 
					
						
							| 
									
										
										
										
											2013-07-15 19:28:10 -07:00
										 |  |  |   include FormulaCellarChecks | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-17 22:52:39 -06:00
										 |  |  |   attr_reader :f | 
					
						
							|  |  |  |   attr_accessor :tab, :options, :ignore_deps | 
					
						
							|  |  |  |   attr_accessor :show_summary_heading, :show_header | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:27 -06:00
										 |  |  |   def initialize ff | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |     @f = ff | 
					
						
							| 
									
										
										
										
											2012-08-22 19:49:17 -05:00
										 |  |  |     @show_header = false | 
					
						
							| 
									
										
										
										
											2012-08-18 18:12:12 -05:00
										 |  |  |     @ignore_deps = ARGV.ignore_deps? || ARGV.interactive? | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  |     @options = Options.new | 
					
						
							| 
									
										
										
										
											2013-04-05 22:00:36 -05:00
										 |  |  |     @tab = Tab.dummy_tab(ff) | 
					
						
							| 
									
										
										
										
											2012-03-07 11:16:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-13 15:39:50 -06:00
										 |  |  |     @@attempted ||= Set.new | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |     lock | 
					
						
							| 
									
										
										
										
											2012-03-07 11:16:27 +00:00
										 |  |  |     check_install_sanity | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-18 12:36:43 +01:00
										 |  |  |   def pour_bottle? install_bottle_options={:warn=>false} | 
					
						
							|  |  |  |     tab.used_options.empty? && options.empty? && \ | 
					
						
							|  |  |  |       install_bottle?(f, install_bottle_options) | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:27 -06:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-07 11:16:27 +00:00
										 |  |  |   def check_install_sanity | 
					
						
							| 
									
										
										
										
											2013-01-08 19:54:32 -06:00
										 |  |  |     raise FormulaInstallationAlreadyAttemptedError, f if @@attempted.include? f | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-07 11:16:27 +00:00
										 |  |  |     if f.installed? | 
					
						
							| 
									
										
										
										
											2012-08-23 09:02:24 -04:00
										 |  |  |       msg = "#{f}-#{f.installed_version} already installed" | 
					
						
							| 
									
										
										
										
											2013-09-07 11:08:51 -05:00
										 |  |  |       msg << ", it's just not linked" unless f.linked_keg.symlink? or f.keg_only? | 
					
						
							| 
									
										
										
										
											2013-04-03 18:26:40 -05:00
										 |  |  |       raise FormulaAlreadyInstalledError, msg | 
					
						
							| 
									
										
										
										
											2012-03-07 11:16:27 +00:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Building head-only without --HEAD is an error | 
					
						
							| 
									
										
										
										
											2012-04-05 21:09:24 -05:00
										 |  |  |     if not ARGV.build_head? and f.stable.nil? | 
					
						
							| 
									
										
										
										
											2012-03-07 11:16:27 +00:00
										 |  |  |       raise CannotInstallFormulaError, <<-EOS.undent
 | 
					
						
							|  |  |  |         #{f} is a head-only formula | 
					
						
							|  |  |  |         Install with `brew install --HEAD #{f.name}
 | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Building stable-only with --HEAD is an error | 
					
						
							| 
									
										
										
										
											2012-04-05 21:09:24 -05:00
										 |  |  |     if ARGV.build_head? and f.head.nil? | 
					
						
							| 
									
										
										
										
											2012-03-07 11:16:27 +00:00
										 |  |  |       raise CannotInstallFormulaError, "No head is defined for #{f.name}" | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-03-15 12:32:03 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-19 17:36:10 -04:00
										 |  |  |     unless ignore_deps | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:29 -06:00
										 |  |  |       unlinked_deps = f.recursive_dependencies.map(&:to_formula).select do |dep| | 
					
						
							| 
									
										
										
										
											2012-08-19 17:36:10 -04:00
										 |  |  |         dep.installed? and not dep.keg_only? and not dep.linked_keg.directory? | 
					
						
							| 
									
										
										
										
											2012-03-15 12:32:03 +00:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-08-19 17:36:10 -04:00
										 |  |  |       raise CannotInstallFormulaError, | 
					
						
							|  |  |  |         "You must `brew link #{unlinked_deps*' '}' before #{f} can be installed" unless unlinked_deps.empty? | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-03-16 11:55:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   rescue FormulaUnavailableError => e | 
					
						
							|  |  |  |     # this is sometimes wrong if the dependency chain is more than one deep | 
					
						
							|  |  |  |     # but can't easily fix this without a rewrite FIXME-brew2 | 
					
						
							|  |  |  |     e.dependent = f.name | 
					
						
							|  |  |  |     raise | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-05 20:32:05 +01:00
										 |  |  |   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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   def install | 
					
						
							| 
									
										
										
										
											2012-03-07 11:16:27 +00:00
										 |  |  |     # 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 | 
					
						
							|  |  |  |     # relink the active keg if possible (because it is slow). | 
					
						
							|  |  |  |     if f.linked_keg.directory? | 
					
						
							|  |  |  |       # some other version is already installed *and* linked | 
					
						
							|  |  |  |       raise CannotInstallFormulaError, <<-EOS.undent
 | 
					
						
							|  |  |  |         #{f}-#{f.linked_keg.realpath.basename} already installed | 
					
						
							|  |  |  |         To install this version, first `brew unlink #{f}'
 | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2011-03-09 21:01:23 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-09 13:44:59 -05:00
										 |  |  |     check_conflicts | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  |     unless ignore_deps | 
					
						
							| 
									
										
										
										
											2013-06-08 15:14:01 -05:00
										 |  |  |       perform_readline_hack | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |       check_requirements | 
					
						
							|  |  |  |       install_dependencies | 
					
						
							| 
									
										
										
										
											2010-04-08 14:50:06 -07:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2010-01-13 09:00:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-25 14:57:26 -07:00
										 |  |  |     if ARGV.build_bottle? && (arch = ARGV.bottle_arch) && !Hardware::CPU.optimization_flags.include?(arch) | 
					
						
							|  |  |  |       raise "Unrecognized architecture for --bottle-arch: #{arch}" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-13 12:50:24 +01:00
										 |  |  |     oh1 "Installing #{Tty.green}#{f}#{Tty.reset}" if show_header | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-13 15:39:50 -06:00
										 |  |  |     @@attempted << f | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-05 22:05:51 -05:00
										 |  |  |     @poured_bottle = false | 
					
						
							| 
									
										
										
										
											2013-09-01 16:03:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-18 07:28:06 +00:00
										 |  |  |     begin | 
					
						
							| 
									
										
										
										
											2013-09-18 12:36:43 +01:00
										 |  |  |       if pour_bottle? :warn => true | 
					
						
							| 
									
										
										
										
											2013-02-18 07:28:06 +00:00
										 |  |  |         pour | 
					
						
							| 
									
										
										
										
											2013-03-11 18:56:26 +00:00
										 |  |  |         @poured_bottle = true | 
					
						
							| 
									
										
										
										
											2013-10-23 22:25:02 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |         stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs | 
					
						
							|  |  |  |         stdlib_in_use = CxxStdlib.new(stdlibs.first, MacOS.default_compiler) | 
					
						
							|  |  |  |         stdlib_in_use.check_dependencies(f, f.recursive_dependencies) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-15 00:28:18 +00:00
										 |  |  |         tab = Tab.for_keg f.prefix | 
					
						
							|  |  |  |         tab.poured_from_bottle = true | 
					
						
							| 
									
										
										
										
											2013-10-23 14:02:51 +01:00
										 |  |  |         tab.tabfile.delete if tab.tabfile | 
					
						
							| 
									
										
										
										
											2013-03-15 00:28:18 +00:00
										 |  |  |         tab.write | 
					
						
							| 
									
										
										
										
											2013-02-18 07:28:06 +00:00
										 |  |  |       end | 
					
						
							|  |  |  |     rescue | 
					
						
							| 
									
										
										
										
											2013-06-08 16:40:40 +01:00
										 |  |  |       raise if ARGV.homebrew_developer? | 
					
						
							| 
									
										
										
										
											2013-02-18 07:28:06 +00:00
										 |  |  |       opoo "Bottle installation failed: building from source." | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-05 20:32:05 +01:00
										 |  |  |     build_bottle_preinstall if ARGV.build_bottle? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-11 18:56:26 +00:00
										 |  |  |     unless @poured_bottle | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |       build | 
					
						
							|  |  |  |       clean | 
					
						
							| 
									
										
										
										
											2010-02-09 11:30:16 -08:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-05 20:32:05 +01:00
										 |  |  |     build_bottle_postinstall if ARGV.build_bottle? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-01 13:57:24 +01:00
										 |  |  |     begin | 
					
						
							|  |  |  |       f.post_install | 
					
						
							|  |  |  |     rescue | 
					
						
							|  |  |  |       opoo "#{f.name} post_install failed. Rerun with `brew postinstall #{f.name}`." | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2013-04-01 20:33:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-10 16:04:56 -04:00
										 |  |  |     opoo "Nothing was installed to #{f.prefix}" unless f.installed? | 
					
						
							| 
									
										
										
										
											2010-02-09 11:30:16 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-08 15:14:01 -05:00
										 |  |  |   # HACK: If readline is present in the dependency tree, it will clash | 
					
						
							|  |  |  |   # with the stdlib's Readline module when the debugger is loaded | 
					
						
							|  |  |  |   def perform_readline_hack | 
					
						
							|  |  |  |     if f.recursive_dependencies.any? { |d| d.name == "readline" } && ARGV.debug? | 
					
						
							|  |  |  |       ENV['HOMEBREW_NO_READLINE'] = '1' | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-09 13:44:59 -05:00
										 |  |  |   def check_conflicts | 
					
						
							|  |  |  |     return if ARGV.force? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     conflicts = f.conflicts.reject do |c| | 
					
						
							|  |  |  |       keg = Formula.factory(c.name).prefix | 
					
						
							|  |  |  |       not keg.directory? && Keg.new(keg).linked? | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     raise FormulaConflictError.new(f, conflicts) unless conflicts.empty? | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  |   def check_requirements | 
					
						
							| 
									
										
										
										
											2013-01-27 23:57:34 -06:00
										 |  |  |     unsatisfied = ARGV.filter_for_dependencies do | 
					
						
							| 
									
										
										
										
											2013-01-30 17:55:04 -06:00
										 |  |  |       f.recursive_requirements do |dependent, req| | 
					
						
							| 
									
										
										
										
											2013-06-03 15:08:47 -05:00
										 |  |  |         if (req.optional? || req.recommended?) && dependent.build.without?(req.name) | 
					
						
							|  |  |  |           Requirement.prune | 
					
						
							|  |  |  |         elsif req.build? && install_bottle?(dependent) | 
					
						
							|  |  |  |           Requirement.prune | 
					
						
							|  |  |  |         elsif req.satisfied? | 
					
						
							|  |  |  |           Requirement.prune | 
					
						
							|  |  |  |         elsif req.default_formula? | 
					
						
							|  |  |  |           dependent.deps << req.to_dependency | 
					
						
							|  |  |  |           Requirement.prune | 
					
						
							| 
									
										
										
										
											2013-06-25 10:12:15 -05:00
										 |  |  |         else | 
					
						
							|  |  |  |           puts "#{dependent}: #{req.message}" | 
					
						
							| 
									
										
										
										
											2013-01-27 23:57:34 -06:00
										 |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-25 10:12:15 -05:00
										 |  |  |     fatals = unsatisfied.select(&:fatal?) | 
					
						
							|  |  |  |     raise UnsatisfiedRequirements.new(f, fatals) unless fatals.empty? | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-03 22:50:11 -05:00
										 |  |  |   # Dependencies of f that were also explicitly requested on the command line. | 
					
						
							|  |  |  |   # These honor options like --HEAD and --devel. | 
					
						
							|  |  |  |   def requested_deps | 
					
						
							|  |  |  |     f.recursive_dependencies.select { |dep| dep.requested? && !dep.installed? } | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-03 22:50:11 -05:00
										 |  |  |   # All dependencies that we must install before installing f. | 
					
						
							|  |  |  |   # These do not honor flags like --HEAD and --devel. | 
					
						
							|  |  |  |   def necessary_deps | 
					
						
							| 
									
										
										
										
											2013-07-26 15:05:37 -05:00
										 |  |  |     # FIXME: can't check this inside the block for the top-level dependent | 
					
						
							|  |  |  |     # because it depends on the contents of ARGV. | 
					
						
							|  |  |  |     pour_bottle = pour_bottle? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-03 22:50:11 -05:00
										 |  |  |     ARGV.filter_for_dependencies do | 
					
						
							|  |  |  |       f.recursive_dependencies do |dependent, dep| | 
					
						
							| 
									
										
										
										
											2013-06-03 22:50:11 -05:00
										 |  |  |         dep.universal! if f.build.universal? && !dep.build? | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-03 22:50:11 -05:00
										 |  |  |         if (dep.optional? || dep.recommended?) && dependent.build.without?(dep.name) | 
					
						
							|  |  |  |           Dependency.prune | 
					
						
							| 
									
										
										
										
											2013-07-26 15:05:37 -05:00
										 |  |  |         elsif dep.build? && dependent == f && pour_bottle | 
					
						
							|  |  |  |           Dependency.prune | 
					
						
							|  |  |  |         elsif dep.build? && dependent != f && install_bottle?(dependent) | 
					
						
							| 
									
										
										
										
											2013-06-03 22:50:11 -05:00
										 |  |  |           Dependency.prune | 
					
						
							|  |  |  |         elsif dep.satisfied? | 
					
						
							| 
									
										
										
										
											2013-07-22 21:36:11 -05:00
										 |  |  |           Dependency.skip | 
					
						
							| 
									
										
										
										
											2013-06-03 22:50:11 -05:00
										 |  |  |         elsif dep.installed? | 
					
						
							|  |  |  |           raise UnsatisfiedDependencyError.new(f, dep) | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-03 22:50:11 -05:00
										 |  |  |   # Combine requested_deps and necessary deps. | 
					
						
							|  |  |  |   def filter_deps | 
					
						
							|  |  |  |     deps = Set.new.merge(requested_deps).merge(necessary_deps) | 
					
						
							|  |  |  |     f.recursive_dependencies.select { |d| deps.include? d } | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def effective_deps | 
					
						
							|  |  |  |     @effective_deps ||= filter_deps | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |   def install_dependencies | 
					
						
							| 
									
										
										
										
											2013-10-16 15:34:43 -05:00
										 |  |  |     if effective_deps.length > 1
 | 
					
						
							|  |  |  |       oh1 "Installing dependencies for #{f}: #{Tty.green}#{effective_deps*", "}#{Tty.reset}" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |     effective_deps.each do |dep| | 
					
						
							|  |  |  |       if dep.requested? | 
					
						
							|  |  |  |        install_dependency(dep) | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |         ARGV.filter_for_dependencies { install_dependency(dep) } | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |     @show_header = true unless effective_deps.empty? | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-26 21:03:46 -08:00
										 |  |  |   def install_dependency dep | 
					
						
							| 
									
										
										
										
											2013-06-26 10:37:09 -07:00
										 |  |  |     dep_tab = Tab.for_formula(dep.to_formula) | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  |     dep_options = dep.options | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |     dep = dep.to_formula | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:27 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-07 13:48:04 +00:00
										 |  |  |     outdated_keg = Keg.new(dep.linked_keg.realpath) rescue nil | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:27 -06:00
										 |  |  |     fi = FormulaInstaller.new(dep) | 
					
						
							|  |  |  |     fi.tab = dep_tab | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  |     fi.options = dep_options | 
					
						
							| 
									
										
										
										
											2011-11-26 21:03:46 -08:00
										 |  |  |     fi.ignore_deps = true | 
					
						
							|  |  |  |     fi.show_header = false | 
					
						
							| 
									
										
										
										
											2012-11-13 12:50:24 +01:00
										 |  |  |     oh1 "Installing #{f} dependency: #{Tty.green}#{dep}#{Tty.reset}" | 
					
						
							| 
									
										
										
										
											2012-03-07 13:48:04 +00:00
										 |  |  |     outdated_keg.unlink if outdated_keg | 
					
						
							| 
									
										
										
										
											2011-11-26 21:03:46 -08:00
										 |  |  |     fi.install | 
					
						
							|  |  |  |     fi.caveats | 
					
						
							|  |  |  |     fi.finish | 
					
						
							| 
									
										
										
										
											2012-03-07 13:48:04 +00:00
										 |  |  |   ensure | 
					
						
							|  |  |  |     # restore previous installation state if build failed | 
					
						
							|  |  |  |     outdated_keg.link if outdated_keg and not dep.installed? rescue nil | 
					
						
							| 
									
										
										
										
											2011-11-26 21:03:46 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   def caveats | 
					
						
							| 
									
										
										
										
											2013-09-07 11:08:51 -05:00
										 |  |  |     if ARGV.homebrew_developer? and not f.keg_only? | 
					
						
							| 
									
										
										
										
											2012-12-31 17:51:57 +00:00
										 |  |  |       audit_bin | 
					
						
							|  |  |  |       audit_sbin | 
					
						
							|  |  |  |       audit_lib | 
					
						
							| 
									
										
										
										
											2013-07-15 19:03:08 -07:00
										 |  |  |       audit_man | 
					
						
							|  |  |  |       audit_info | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-07-18 03:22:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-12 13:08:29 -06:00
										 |  |  |     c = Caveats.new(f) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     unless c.empty? | 
					
						
							|  |  |  |       @show_summary_heading = true | 
					
						
							|  |  |  |       ohai 'Caveats', c.caveats | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def finish | 
					
						
							|  |  |  |     ohai 'Finishing up' if ARGV.verbose? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-30 11:16:53 -07:00
										 |  |  |     install_plist | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-10 16:33:22 -04:00
										 |  |  |     if f.keg_only? | 
					
						
							|  |  |  |       begin | 
					
						
							|  |  |  |         Keg.new(f.prefix).optlink | 
					
						
							| 
									
										
										
										
											2013-02-17 22:54:27 -06:00
										 |  |  |       rescue Exception | 
					
						
							| 
									
										
										
										
											2012-08-10 16:33:22 -04:00
										 |  |  |         onoe "Failed to create: #{f.opt_prefix}" | 
					
						
							|  |  |  |         puts "Things that depend on #{f} will probably not build." | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     else | 
					
						
							| 
									
										
										
										
											2011-09-13 19:40:51 -07:00
										 |  |  |       link | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-08-10 16:33:22 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-18 12:56:51 -05:00
										 |  |  |     fix_install_names if OS.mac? | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-12 13:08:29 -06:00
										 |  |  |     ohai "Summary" if ARGV.verbose? or show_summary_heading | 
					
						
							| 
									
										
										
										
											2013-01-15 10:28:07 +01:00
										 |  |  |     unless ENV['HOMEBREW_NO_EMOJI'] | 
					
						
							| 
									
										
										
										
											2013-06-23 16:43:32 -07:00
										 |  |  |       print "\xf0\x9f\x8d\xba  " if MacOS.version >= :lion | 
					
						
							| 
									
										
										
										
											2013-01-15 10:28:07 +01:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |     print "#{f.prefix}: #{f.prefix.abv}" | 
					
						
							|  |  |  |     print ", built in #{pretty_duration build_time}" if build_time | 
					
						
							|  |  |  |     puts | 
					
						
							| 
									
										
										
										
											2013-06-11 15:35:30 -05:00
										 |  |  |   ensure | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |     unlock if hold_locks? | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2010-07-20 21:03:25 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   def build_time | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:27 -06:00
										 |  |  |     @build_time ||= Time.now - @start_time unless pour_bottle? or ARGV.interactive? or @start_time.nil? | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  |   def build_argv | 
					
						
							|  |  |  |     @build_argv ||= begin | 
					
						
							|  |  |  |       opts = Options.coerce(ARGV.options_only) | 
					
						
							|  |  |  |       unless opts.include? '--fresh' | 
					
						
							|  |  |  |         opts.concat(options) # from a dependent formula | 
					
						
							| 
									
										
										
										
											2013-04-05 22:00:36 -05:00
										 |  |  |         opts.concat(tab.used_options) # from a previous install | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2013-01-26 13:53:32 -06:00
										 |  |  |       opts << Option.new("--build-from-source") # don't download bottle | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   def build | 
					
						
							| 
									
										
										
										
											2012-09-11 20:59:59 -04:00
										 |  |  |     FileUtils.rm Dir["#{HOMEBREW_LOGS}/#{f}/*"] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |     @start_time = Time.now | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # 1. formulae can modify ENV, so we must ensure that each | 
					
						
							| 
									
										
										
										
											2010-11-09 12:57:41 +00:00
										 |  |  |     #    installation has a pristine ENV when it starts, forking now is | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  |     #    the easiest way to do this | 
					
						
							|  |  |  |     # 2. formulae have access to __END__ the only way to allow this is | 
					
						
							|  |  |  |     #    to make the formula script the executed script | 
					
						
							|  |  |  |     read, write = IO.pipe | 
					
						
							|  |  |  |     # I'm guessing this is not a good way to do this, but I'm no UNIX guru | 
					
						
							|  |  |  |     ENV['HOMEBREW_ERROR_PIPE'] = write.to_i.to_s | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-05 17:42:53 -05:00
										 |  |  |     args = %W[
 | 
					
						
							|  |  |  |       nice #{RUBY_PATH} | 
					
						
							|  |  |  |       -W0 | 
					
						
							|  |  |  |       -I #{File.dirname(__FILE__)} | 
					
						
							|  |  |  |       -rbuild | 
					
						
							|  |  |  |       -- | 
					
						
							|  |  |  |       #{f.path} | 
					
						
							|  |  |  |     ].concat(build_argv) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Ruby 2.0+ sets close-on-exec on all file descriptors except for | 
					
						
							|  |  |  |     # 0, 1, and 2 by default, so we have to specify that we want the pipe | 
					
						
							|  |  |  |     # to remain open in the child process. | 
					
						
							|  |  |  |     args << { write => write } if RUBY_VERSION >= "2.0" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-09 12:57:41 +00:00
										 |  |  |     fork do | 
					
						
							|  |  |  |       begin | 
					
						
							|  |  |  |         read.close | 
					
						
							| 
									
										
										
										
											2013-04-05 17:42:53 -05:00
										 |  |  |         exec(*args) | 
					
						
							| 
									
										
										
										
											2010-11-09 12:57:41 +00:00
										 |  |  |       rescue Exception => e | 
					
						
							|  |  |  |         Marshal.dump(e, write) | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  |         write.close | 
					
						
							| 
									
										
										
										
											2010-11-09 12:57:41 +00:00
										 |  |  |         exit! 1
 | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2010-11-09 12:57:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 20:59:59 -04:00
										 |  |  |     ignore_interrupts(:quietly) do # the fork will receive the interrupt and marshall it back | 
					
						
							| 
									
										
										
										
											2010-11-09 12:57:41 +00:00
										 |  |  |       write.close | 
					
						
							|  |  |  |       Process.wait | 
					
						
							|  |  |  |       data = read.read | 
					
						
							| 
									
										
										
										
											2013-09-07 22:17:52 -05:00
										 |  |  |       read.close | 
					
						
							| 
									
										
										
										
											2010-11-09 12:57:41 +00:00
										 |  |  |       raise Marshal.load(data) unless data.nil? or data.empty? | 
					
						
							| 
									
										
										
										
											2012-08-22 15:50:27 -04:00
										 |  |  |       raise Interrupt if $?.exitstatus == 130
 | 
					
						
							| 
									
										
										
										
											2010-11-09 12:57:41 +00:00
										 |  |  |       raise "Suspicious installation failure" unless $?.success? | 
					
						
							| 
									
										
										
										
											2012-08-10 16:04:56 -04:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 20:59:59 -04:00
										 |  |  |     raise "Empty installation" if Dir["#{f.prefix}/*"].empty? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-17 22:54:27 -06:00
										 |  |  |   rescue Exception | 
					
						
							| 
									
										
										
										
											2012-08-10 16:04:56 -04:00
										 |  |  |     ignore_interrupts do | 
					
						
							|  |  |  |       # any exceptions must leave us with nothing installed | 
					
						
							| 
									
										
										
										
											2012-09-11 20:59:59 -04:00
										 |  |  |       f.prefix.rmtree if f.prefix.directory? | 
					
						
							| 
									
										
										
										
											2012-08-10 16:04:56 -04:00
										 |  |  |       f.rack.rmdir_if_possible | 
					
						
							| 
									
										
										
										
											2010-11-09 12:57:41 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-08-10 16:04:56 -04:00
										 |  |  |     raise | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def link | 
					
						
							| 
									
										
										
										
											2012-02-21 11:40:06 +00:00
										 |  |  |     if f.linked_keg.directory? and f.linked_keg.realpath == f.prefix | 
					
						
							|  |  |  |       opoo "This keg was marked linked already, continuing anyway" | 
					
						
							|  |  |  |       # otherwise Keg.link will bail | 
					
						
							|  |  |  |       f.linked_keg.unlink | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-06 13:02:10 +00:00
										 |  |  |     keg = Keg.new(f.prefix) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-22 15:50:27 -04:00
										 |  |  |     begin | 
					
						
							|  |  |  |       keg.link | 
					
						
							|  |  |  |     rescue Exception => e | 
					
						
							|  |  |  |       onoe "The `brew link` step did not complete successfully" | 
					
						
							|  |  |  |       puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}" | 
					
						
							|  |  |  |       puts "You can try again using `brew link #{f.name}'" | 
					
						
							| 
									
										
										
										
											2013-06-23 16:32:31 -07:00
										 |  |  |       puts | 
					
						
							|  |  |  |       puts "Possible conflicting files are:" | 
					
						
							|  |  |  |       mode = OpenStruct.new(:dry_run => true, :overwrite => true) | 
					
						
							|  |  |  |       keg.link(mode) | 
					
						
							| 
									
										
										
										
											2012-08-22 15:50:27 -04:00
										 |  |  |       ohai e, e.backtrace if ARGV.debug? | 
					
						
							|  |  |  |       @show_summary_heading = true | 
					
						
							|  |  |  |       ignore_interrupts{ keg.unlink } | 
					
						
							|  |  |  |       raise unless e.kind_of? RuntimeError | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 20:57:41 -04:00
										 |  |  |   def install_plist | 
					
						
							| 
									
										
										
										
											2012-11-25 15:06:41 +00:00
										 |  |  |     return unless f.plist | 
					
						
							|  |  |  |     # A plist may already exist if we are installing from a bottle | 
					
						
							|  |  |  |     f.plist_path.unlink if f.plist_path.exist? | 
					
						
							|  |  |  |     f.plist_path.write f.plist | 
					
						
							|  |  |  |     f.plist_path.chmod 0644
 | 
					
						
							| 
									
										
										
										
											2012-09-11 20:57:41 -04:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   def fix_install_names | 
					
						
							| 
									
										
										
										
											2013-10-02 22:12:13 -07:00
										 |  |  |     Keg.new(f.prefix).fix_install_names(:keg_only => f.keg_only?) | 
					
						
							| 
									
										
										
										
											2013-03-21 10:32:52 +00:00
										 |  |  |     if @poured_bottle and f.bottle | 
					
						
							| 
									
										
										
										
											2013-03-11 18:56:26 +00:00
										 |  |  |       old_prefix = f.bottle.prefix | 
					
						
							|  |  |  |       new_prefix = HOMEBREW_PREFIX.to_s | 
					
						
							|  |  |  |       old_cellar = f.bottle.cellar | 
					
						
							|  |  |  |       new_cellar = HOMEBREW_CELLAR.to_s | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if old_prefix != new_prefix or old_cellar != new_cellar | 
					
						
							|  |  |  |         Keg.new(f.prefix).relocate_install_names \ | 
					
						
							| 
									
										
										
										
											2013-10-02 22:12:13 -07:00
										 |  |  |           old_prefix, new_prefix, old_cellar, new_cellar, :keg_only => f.keg_only? | 
					
						
							| 
									
										
										
										
											2013-03-11 18:56:26 +00:00
										 |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   rescue Exception => e | 
					
						
							|  |  |  |     onoe "Failed to fix install names" | 
					
						
							|  |  |  |     puts "The formula built, but you may encounter issues using it or linking other" | 
					
						
							|  |  |  |     puts "formula against it." | 
					
						
							|  |  |  |     ohai e, e.backtrace if ARGV.debug? | 
					
						
							|  |  |  |     @show_summary_heading = true | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def clean | 
					
						
							| 
									
										
										
										
											2012-09-18 16:25:44 -04:00
										 |  |  |     ohai "Cleaning" if ARGV.verbose? | 
					
						
							| 
									
										
										
										
											2012-08-29 15:43:28 -04:00
										 |  |  |     if f.class.skip_clean_all? | 
					
						
							|  |  |  |       opoo "skip_clean :all is deprecated" | 
					
						
							|  |  |  |       puts "Skip clean was commonly used to prevent brew from stripping binaries." | 
					
						
							|  |  |  |       puts "brew no longer strips binaries, if skip_clean is required to prevent" | 
					
						
							|  |  |  |       puts "brew from removing empty directories, you should specify exact paths" | 
					
						
							|  |  |  |       puts "in the formula." | 
					
						
							|  |  |  |       return | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2011-08-24 01:13:15 +01:00
										 |  |  |     Cleaner.new f | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   rescue Exception => e | 
					
						
							|  |  |  |     opoo "The cleaning step did not complete successfully" | 
					
						
							|  |  |  |     puts "Still, the installation was successful, so we will link it into your prefix" | 
					
						
							|  |  |  |     ohai e, e.backtrace if ARGV.debug? | 
					
						
							|  |  |  |     @show_summary_heading = true | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-24 01:13:15 +01:00
										 |  |  |   def pour | 
					
						
							| 
									
										
										
										
											2013-09-25 18:51:30 -05:00
										 |  |  |     if f.local_bottle_path | 
					
						
							|  |  |  |       downloader = LocalBottleDownloadStrategy.new(f) | 
					
						
							| 
									
										
										
										
											2013-06-08 16:41:23 +01:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2013-09-25 18:51:30 -05:00
										 |  |  |       downloader = f.downloader | 
					
						
							| 
									
										
										
										
											2013-06-08 16:41:23 +01:00
										 |  |  |       fetched = f.fetch | 
					
						
							|  |  |  |       f.verify_download_integrity fetched | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2011-08-24 01:13:15 +01:00
										 |  |  |     HOMEBREW_CELLAR.cd do | 
					
						
							|  |  |  |       downloader.stage | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2013-10-05 20:32:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     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 | 
					
						
							| 
									
										
										
										
											2011-08-24 01:13:15 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ## checks | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-15 19:28:10 -07:00
										 |  |  |   def print_check_output warning_and_description | 
					
						
							|  |  |  |     return unless warning_and_description | 
					
						
							|  |  |  |     warning, description = *warning_and_description | 
					
						
							|  |  |  |     opoo warning | 
					
						
							|  |  |  |     puts description | 
					
						
							|  |  |  |     @show_summary_heading = true | 
					
						
							| 
									
										
										
										
											2012-02-26 16:33:44 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-15 19:03:08 -07:00
										 |  |  |   def audit_bin | 
					
						
							| 
									
										
										
										
											2013-07-15 19:28:10 -07:00
										 |  |  |     print_check_output(check_PATH(f.bin)) unless f.keg_only? | 
					
						
							|  |  |  |     print_check_output(check_non_executables(f.bin)) | 
					
						
							| 
									
										
										
										
											2013-07-15 19:03:08 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-26 16:33:44 -08:00
										 |  |  |   def audit_sbin | 
					
						
							| 
									
										
										
										
											2013-07-15 19:28:10 -07:00
										 |  |  |     print_check_output(check_PATH(f.sbin)) unless f.keg_only? | 
					
						
							|  |  |  |     print_check_output(check_non_executables(f.sbin)) | 
					
						
							| 
									
										
										
										
											2012-02-19 19:09:38 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def audit_lib | 
					
						
							| 
									
										
										
										
											2013-07-15 19:28:10 -07:00
										 |  |  |     print_check_output(check_jars) | 
					
						
							|  |  |  |     print_check_output(check_non_libraries) | 
					
						
							| 
									
										
										
										
											2012-02-19 19:09:38 -08:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-15 19:03:08 -07:00
										 |  |  |   def audit_man | 
					
						
							| 
									
										
										
										
											2013-07-15 19:28:10 -07:00
										 |  |  |     print_check_output(check_manpages) | 
					
						
							| 
									
										
										
										
											2013-07-15 19:03:08 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def audit_info | 
					
						
							| 
									
										
										
										
											2013-07-15 19:28:10 -07:00
										 |  |  |     print_check_output(check_infopages) | 
					
						
							| 
									
										
										
										
											2013-07-15 19:03:08 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |   private | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def hold_locks? | 
					
						
							|  |  |  |     @hold_locks || false | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def lock | 
					
						
							|  |  |  |     if (@@locked ||= []).empty? | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:29 -06:00
										 |  |  |       f.recursive_dependencies.each do |dep| | 
					
						
							|  |  |  |         @@locked << dep.to_formula | 
					
						
							|  |  |  |       end unless ignore_deps | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |       @@locked.unshift(f) | 
					
						
							|  |  |  |       @@locked.each(&:lock) | 
					
						
							|  |  |  |       @hold_locks = true | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def unlock | 
					
						
							|  |  |  |     if hold_locks? | 
					
						
							|  |  |  |       @@locked.each(&:unlock) | 
					
						
							|  |  |  |       @@locked.clear | 
					
						
							|  |  |  |       @hold_locks = false | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Formula | 
					
						
							| 
									
										
										
										
											2011-09-01 10:06:28 -07:00
										 |  |  |   def keg_only_text | 
					
						
							| 
									
										
										
										
											2012-08-10 16:34:20 -04:00
										 |  |  |     s = "This formula is keg-only: so it was not symlinked into #{HOMEBREW_PREFIX}." | 
					
						
							|  |  |  |     s << "\n\n#{keg_only_reason.to_s}" | 
					
						
							|  |  |  |     if lib.directory? or include.directory? | 
					
						
							|  |  |  |       s << | 
					
						
							|  |  |  |         <<-EOS.undent_________________________________________________________72
 | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-10 16:34:20 -04:00
										 |  |  |         Generally there are no consequences of this for you. If you build your | 
					
						
							|  |  |  |         own software and it requires this formula, you'll need to add to your | 
					
						
							|  |  |  |         build variables: | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-10 16:34:20 -04:00
										 |  |  |         EOS | 
					
						
							|  |  |  |       s << "    LDFLAGS:  -L#{HOMEBREW_PREFIX}/opt/#{name}/lib\n" if lib.directory? | 
					
						
							|  |  |  |       s << "    CPPFLAGS: -I#{HOMEBREW_PREFIX}/opt/#{name}/include\n" if include.directory? | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |     s << "\n" | 
					
						
							| 
									
										
										
										
											2011-08-23 23:30:52 +01:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2009-10-26 18:13:38 +00:00
										 |  |  | end |