Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64384 - in trunk/tools/build/v2: . build kernel test
From: ghost_at_[hidden]
Date: 2010-07-27 07:53:39


Author: vladimir_prus
Date: 2010-07-27 07:53:37 EDT (Tue, 27 Jul 2010)
New Revision: 64384
URL: http://svn.boost.org/trac/boost/changeset/64384

Log:
Make default build work.

Also, return non-zero status if there were errors.

Text files modified:
   trunk/tools/build/v2/build/errors.py | 5 +++++
   trunk/tools/build/v2/build/targets.py | 11 ++++++++---
   trunk/tools/build/v2/build_system.py | 11 +++++++++--
   trunk/tools/build/v2/kernel/bootstrap.jam | 6 +++++-
   trunk/tools/build/v2/kernel/bootstrap.py | 2 +-
   trunk/tools/build/v2/test/default_build.py | 3 ++-
   6 files changed, 30 insertions(+), 8 deletions(-)

Modified: trunk/tools/build/v2/build/errors.py
==============================================================================
--- trunk/tools/build/v2/build/errors.py (original)
+++ trunk/tools/build/v2/build/errors.py 2010-07-27 07:53:37 EDT (Tue, 27 Jul 2010)
@@ -97,6 +97,10 @@
 
     def __init__(self):
         self.contexts_ = []
+ self._count = 0
+
+ def count(self):
+ return self._count
 
     def push_user_context(self, message, nested=None):
         self.contexts_.append(Context(message, nested))
@@ -117,6 +121,7 @@
         raise ExceptionWithUserContext("unexpected exception", self.contexts_[:],
                                        e, sys.exc_info()[2])
     def __call__(self, message):
+ self._count = self._count + 1
         raise ExceptionWithUserContext(message, self.contexts_[:],
                                        stack=traceback.extract_stack())
 

Modified: trunk/tools/build/v2/build/targets.py
==============================================================================
--- trunk/tools/build/v2/build/targets.py (original)
+++ trunk/tools/build/v2/build/targets.py 2010-07-27 07:53:37 EDT (Tue, 27 Jul 2010)
@@ -76,6 +76,8 @@
 import os.path
 import sys
 
+from b2.manager import get_manager
+
 from b2.util.utility import *
 import property, project, virtual_target, property_set, feature, generators, toolset
 from virtual_target import Subvariant
@@ -84,6 +86,8 @@
 from b2.util import path, bjam_signature
 from b2.build.errors import user_error_checkpoint
 
+import b2.build.build_request as build_request
+
 import b2.util.set
 
 _re_separate_target_from_properties = re.compile (r'^([^<]*)(/(<.*))?$')
@@ -594,10 +598,10 @@
         d = target.default_build ()
         
         if self.alternatives_ and self.default_build_ != d:
- raise BaseException ("Default build must be identical in all alternatives\n"
+ get_manager().errors()("default build must be identical in all alternatives\n"
               "main target is '%s'\n"
               "with '%s'\n"
- "differing from previous default build: '%s'" % (full_name (), d.raw (), self.default_build_.raw ()))
+ "differing from previous default build: '%s'" % (self.full_name (), d.raw (), self.default_build_.raw ()))
 
         else:
             self.default_build_ = d
@@ -687,7 +691,8 @@
             # to use here.
             compressed = feature.compress_subproperties(property_set.all())
 
- result = build_request.expand_no_defaults (compressed, defaults_to_apply)
+ result = build_request.expand_no_defaults(
+ b2.build.property_set.create([p]) for p in (compressed + defaults_to_apply))
             
         else:
             result.append (property_set)

Modified: trunk/tools/build/v2/build_system.py
==============================================================================
--- trunk/tools/build/v2/build_system.py (original)
+++ trunk/tools/build/v2/build_system.py 2010-07-27 07:53:37 EDT (Tue, 27 Jul 2010)
@@ -8,6 +8,8 @@
 # Distributed under the Boost Software License, Version 1.0.
 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
+
+
 from b2.build.engine import Engine
 from b2.manager import Manager
 from b2.util.path import glob
@@ -432,14 +434,14 @@
     if "--profiling" in sys.argv:
         import cProfile
         import pstats
- cProfile.runctx('main_real()', globals(), locals(), "stones.prof")
+ return cProfile.runctx('main_real()', globals(), locals(), "stones.prof")
         
         stats = pstats.Stats("stones.prof")
         stats.strip_dirs()
         stats.sort_stats('time', 'calls')
         stats.print_callers(20)
     else:
- main_real()
+ return main_real()
 
 def main_real():
 
@@ -852,3 +854,8 @@
         # Prevent automatic update of the 'all' target, now that
         # we have explicitly updated what we wanted.
         bjam.call("UPDATE")
+
+ if manager.errors().count() == 0:
+ return ["ok"]
+ else:
+ return []

Modified: trunk/tools/build/v2/kernel/bootstrap.jam
==============================================================================
--- trunk/tools/build/v2/kernel/bootstrap.jam (original)
+++ trunk/tools/build/v2/kernel/bootstrap.jam 2010-07-27 07:53:37 EDT (Tue, 27 Jul 2010)
@@ -225,7 +225,11 @@
         
         module PyBB
         {
- bootstrap $(root) ;
+ local ok = [ bootstrap $(root) ] ;
+ if ! $(ok)
+ {
+ EXIT ;
+ }
         }
         
         

Modified: trunk/tools/build/v2/kernel/bootstrap.py
==============================================================================
--- trunk/tools/build/v2/kernel/bootstrap.py (original)
+++ trunk/tools/build/v2/kernel/bootstrap.py 2010-07-27 07:53:37 EDT (Tue, 27 Jul 2010)
@@ -21,5 +21,5 @@
     sys.modules["b2"] = m
 
     import b2.build_system
- b2.build_system.main()
+ return b2.build_system.main()
 

Modified: trunk/tools/build/v2/test/default_build.py
==============================================================================
--- trunk/tools/build/v2/test/default_build.py (original)
+++ trunk/tools/build/v2/test/default_build.py 2010-07-27 07:53:37 EDT (Tue, 27 Jul 2010)
@@ -42,7 +42,8 @@
 differing from previous default build <variant>debug
 
 """
-t.run_build_system("-n --no-error-backtrace", status=1, stdout=expected)
+t.run_build_system("-n --no-error-backtrace", status=1)
+t.fail_test(t.stdout().find("default build must be identical in all alternatives") == -1)
 
 # Test that default-build must be identical in all alternatives. No Error case,
 # empty default build.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk