From f2124c8cac9879ed1631ebafdbd85fd4b5a307a0 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Thu, 29 Jan 2009 15:07:32 +0000 Subject: Fix use of $CHANGED_SOURCES with the --config=force option so that .sconsign build state stays consistent. --- src/CHANGES.txt | 2 ++ src/engine/SCons/SConf.py | 11 +++++++++++ test/Configure/cache-not-ok.py | 2 +- test/Configure/option--config.py | 34 +++++++++++++++++----------------- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 85b3fde..57eb348 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -20,6 +20,8 @@ RELEASE X.X.X - XXX - Detect implicit dependencies on commands even when the command is quoted. + - Fix interaction of $CHANGED_SOURCES with the --config=force option. + From Robert P. J. Day: - User's Guide updates. diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index 6461dda..fbf193a 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -314,6 +314,17 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask): s = sys.stdout = sys.stderr = Streamer(sys.stdout) try: env = self.targets[0].get_build_env() + if cache_mode == FORCE: + # Set up the Decider() to force rebuilds by saying + # that every source has changed. Note that we still + # call the environment's underlying source decider so + # that the correct .sconsign info will get calculated + # and keep the build state consistent. + def force_build(dependency, target, prev_ni, + env_decider=env.decide_source): + env_decider(dependency, target, prev_ni) + return True + env.Decider(force_build) env['PSTDOUT'] = env['PSTDERR'] = s try: sconf.cached = 0 diff --git a/test/Configure/cache-not-ok.py b/test/Configure/cache-not-ok.py index 339c464..48524c2 100644 --- a/test/Configure/cache-not-ok.py +++ b/test/Configure/cache-not-ok.py @@ -79,7 +79,7 @@ test.checkLogAndStdout(["Checking for C header file no_std_c_header.h... ", # Same should be true for the default behavior of Decider('content'). -test.run(arguments='--config=force target_signatures_content=1') +test.run(arguments='target_signatures_content=1 --config=force') test.checkLogAndStdout(["Checking for C header file no_std_c_header.h... ", "Checking for C library no_c_library_SAFFDG... "], ["no"]*2, diff --git a/test/Configure/option--config.py b/test/Configure/option--config.py index 807ddb5..3515c96 100644 --- a/test/Configure/option--config.py +++ b/test/Configure/option--config.py @@ -50,12 +50,12 @@ env = Environment(CPPPATH='#/include') import os env.AppendENVPath('PATH', os.environ['PATH']) conf = Configure(env) -r1 = conf.CheckCHeader('non_system_header1.h') -r2 = conf.CheckCHeader('non_system_header2.h') +conf.CheckCHeader('non_system_header0.h') +conf.CheckCHeader('non_system_header1.h') env = conf.Finish() """) -test.write(['include', 'non_system_header1.h'], """ +test.write(['include', 'non_system_header0.h'], """ /* A header */ """) @@ -70,53 +70,53 @@ scons: *** "%(conftest_0_c)s" is not yet built and cache is forced. test.run(arguments='--config=cache', status=2, stderr=expect) test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header1.h... ", - "Checking for C header file non_system_header2.h... "], +test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], ["yes", "no"], [[((".c", NCR), (_obj, NCR))], [((".c", NCR), (_obj, NCF))]], "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header1.h... ", - "Checking for C header file non_system_header2.h... "], +test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], ["yes", "no"], [[((".c", CR), (_obj, CR))], [((".c", CR), (_obj, CF))]], "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=force') -test.checkLogAndStdout( ["Checking for C header file non_system_header1.h... ", - "Checking for C header file non_system_header2.h... "], +test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], ["yes", "no"], [[((".c", NCR), (_obj, NCR))], [((".c", NCR), (_obj, NCF))]], "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=cache') -test.checkLogAndStdout( ["Checking for C header file non_system_header1.h... ", - "Checking for C header file non_system_header2.h... "], +test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], ["yes", "no"], [[((".c", CR), (_obj, CR))], [((".c", CR), (_obj, CF))]], "config.log", ".sconf_temp", "SConstruct") -test.write(['include', 'non_system_header2.h'], """ +test.write(['include', 'non_system_header1.h'], """ /* Another header */ """) -test.unlink(['include', 'non_system_header1.h']) +test.unlink(['include', 'non_system_header0.h']) test.run(arguments='--config=cache') -test.checkLogAndStdout( ["Checking for C header file non_system_header1.h... ", - "Checking for C header file non_system_header2.h... "], +test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], ["yes", "no"], [[((".c", CR), (_obj, CR))], [((".c", CR), (_obj, CF))]], "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header1.h... ", - "Checking for C header file non_system_header2.h... "], +test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], ["no", "yes"], [[((".c", CR), (_obj, NCF))], [((".c", CR), (_obj, NCR))]], -- cgit v0.12