aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/cmd/upgrade.rb12
-rw-r--r--Library/Homebrew/extend/ENV/super.rb18
-rw-r--r--Library/Homebrew/extend/os/linux/system_config.rb42
-rw-r--r--Library/Homebrew/extend/os/system_config.rb7
4 files changed, 69 insertions, 10 deletions
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index cea77ad29..ed36b8f33 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -75,6 +75,18 @@ module Homebrew
puts pinned.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", "
end
+ # Sort keg_only before non-keg_only formulae to avoid any needless conflicts
+ # with outdated, non-keg_only versions of formulae being upgraded.
+ formulae_to_install.sort! do |a, b|
+ if !a.keg_only? && b.keg_only?
+ 1
+ elsif a.keg_only? && !b.keg_only?
+ -1
+ else
+ 0
+ end
+ end
+
formulae_to_install.each do |f|
upgrade_formula(f)
next unless ARGV.include?("--cleanup")
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index 1a5f420f6..0935647f5 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -111,16 +111,16 @@ module Superenv
# Homebrew's apple-gcc42 will be outside the PATH in superenv,
# so xcrun may not be able to find it
- case homebrew_cc
- when "gcc-4.2"
- begin
- apple_gcc42 = Formulary.factory("apple-gcc42")
- rescue FormulaUnavailableError
+ begin
+ case homebrew_cc
+ when "gcc-4.2"
+ paths << Formulary.factory("apple-gcc42").opt_bin
+ when GNU_GCC_REGEXP
+ paths << gcc_version_formula($&).opt_bin
end
- paths << apple_gcc42.opt_bin.to_s if apple_gcc42
- when GNU_GCC_REGEXP
- gcc_formula = gcc_version_formula($&)
- paths << gcc_formula.opt_bin.to_s
+ rescue FormulaUnavailableError
+ # Don't fail and don't add these formulae to the path if they don't exist.
+ nil
end
paths.to_path_s
diff --git a/Library/Homebrew/extend/os/linux/system_config.rb b/Library/Homebrew/extend/os/linux/system_config.rb
new file mode 100644
index 000000000..e62b12e71
--- /dev/null
+++ b/Library/Homebrew/extend/os/linux/system_config.rb
@@ -0,0 +1,42 @@
+require "formula"
+
+class SystemConfig
+ class << self
+ def host_os_version
+ if which("lsb_release")
+ description = `lsb_release -d`.chomp.sub("Description:\t", "")
+ codename = `lsb_release -c`.chomp.sub("Codename:\t", "")
+ "#{description} (#{codename})"
+ elsif (redhat_release = Pathname.new("/etc/redhat-release")).readable?
+ redhat_release.read.chomp
+ else
+ "N/A"
+ end
+ end
+
+ def host_gcc_version
+ gcc = Pathname.new "/usr/bin/gcc"
+ return "N/A" unless gcc.executable?
+ `#{gcc} --version 2>/dev/null`[/ (\d+\.\d+\.\d+)/, 1]
+ end
+
+ def formula_version(formula)
+ return "N/A" unless CoreTap.instance.installed?
+ f = Formulary.factory formula
+ return "N/A" unless f.installed?
+ f.version
+ rescue FormulaUnavailableError
+ return "N/A"
+ end
+
+ def dump_verbose_config(out = $stdout)
+ dump_generic_verbose_config(out)
+ out.puts "Kernel: #{`uname -mors`.chomp}"
+ out.puts "OS: #{host_os_version}"
+ out.puts "/usr/bin/gcc: #{host_gcc_version}"
+ ["glibc", "gcc", "xorg"].each do |f|
+ out.puts "#{f}: #{formula_version f}"
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/extend/os/system_config.rb b/Library/Homebrew/extend/os/system_config.rb
index edc007166..fec31f1fa 100644
--- a/Library/Homebrew/extend/os/system_config.rb
+++ b/Library/Homebrew/extend/os/system_config.rb
@@ -1,2 +1,7 @@
require "system_config"
-require "extend/os/mac/system_config" if OS.mac?
+
+if OS.mac?
+ require "extend/os/mac/system_config"
+elsif OS.linux?
+ require "extend/os/linux/system_config"
+end