aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMisty De Meo2013-10-22 22:21:59 -0700
committerMisty De Meo2013-10-26 21:54:29 -0700
commit3657393017cc4a17f72107a7b144060fa7dc7b8b (patch)
treeeabfda32aafb004d67c7dec5ee74bfdd0eba7d56 /Library
parent71fcefc6137fd8c67952e114a8485bfae599ea1b (diff)
downloadbrew-3657393017cc4a17f72107a7b144060fa7dc7b8b.tar.bz2
Move stdlib tracking postinstall
This moves stdlib tracking after the install completes, which allows the tracking to have access to the actual stdlib in use. This unfortunately means that builds can error out *after* a build, resulting in wasted time; however, it reduces false positives, and the overall user experience is still likely to be better this way.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/build.rb23
-rw-r--r--Library/Homebrew/formula_installer.rb14
-rw-r--r--Library/Homebrew/tab.rb5
3 files changed, 14 insertions, 28 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb
index cc58bf4b0..8a4267bac 100755
--- a/Library/Homebrew/build.rb
+++ b/Library/Homebrew/build.rb
@@ -141,17 +141,6 @@ class Build
end
end
- # TODO Track user-selected stdlibs, such as boost in C++11 mode
- stdlib = ENV.compiler == :clang ? MacOS.default_cxx_stdlib : :libstdcxx
- stdlib_in_use = CxxStdlib.new(stdlib, ENV.compiler)
-
- # This is a bad place for this check, but we don't have access to
- # compiler selection within the formula installer, only inside the
- # build instance.
- # This is also awkward because we don't actually know yet if this package
- # will link against a C++ stdlib, but we don't want to test after the build.
- stdlib_in_use.check_dependencies(f, deps)
-
f.brew do
if ARGV.flag? '--git'
system "git init"
@@ -174,7 +163,17 @@ class Build
begin
f.install
- Tab.create(f, ENV.compiler,
+
+ stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs
+ # It's technically possible for the same lib to link to multiple
+ # C++ stdlibs, but very bad news. Right now we don't track this
+ # woeful scenario.
+ stdlib_in_use = CxxStdlib.new(stdlibs.first, ENV.compiler)
+ # This will raise and fail the build if there's an
+ # incompatibility.
+ stdlib_in_use.check_dependencies(f, deps)
+
+ Tab.create(f, ENV.compiler, stdlibs.first,
Options.coerce(ARGV.options_only)).write
rescue Exception => e
if ARGV.debug?
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 7e5101f86..b83189bec 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -386,8 +386,6 @@ class FormulaInstaller
fix_install_names if OS.mac?
- record_cxx_stdlib
-
ohai "Summary" if ARGV.verbose? or show_summary_heading
unless ENV['HOMEBREW_NO_EMOJI']
print "\xf0\x9f\x8d\xba " if MacOS.version >= :lion
@@ -529,18 +527,6 @@ class FormulaInstaller
@show_summary_heading = true
end
- def record_cxx_stdlib
- stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs
- return if stdlibs.empty?
-
- tab = Tab.for_keg f.prefix
- tab.tabfile.delete if tab.tabfile
- # It's technically possible for the same lib to link to multiple C++ stdlibs,
- # but very bad news. Right now we don't track this woeful scenario.
- tab.stdlib = stdlibs.first
- tab.write
- end
-
def clean
ohai "Cleaning" if ARGV.verbose?
if f.class.skip_clean_all?
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index 708e10346..5e4d24693 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -10,7 +10,7 @@ require 'utils/json'
class Tab < OpenStruct
FILENAME = 'INSTALL_RECEIPT.json'
- def self.create f, compiler, args
+ def self.create f, compiler, stdlib, args
f.build.args = args
sha = HOMEBREW_REPOSITORY.cd do
@@ -25,7 +25,8 @@ class Tab < OpenStruct
:tapped_from => f.tap,
:time => Time.now.to_i, # to_s would be better but Ruby has no from_s function :P
:HEAD => sha,
- :compiler => compiler
+ :compiler => compiler,
+ :stdlib => stdlib
end
def self.from_file path