diff options
author | Andrew Morrow <acm@mongodb.com> | 2020-02-05 14:18:45 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-05 21:37:50 +0000 |
commit | 18966553fc7f9d350c3428ea1a23162aba2526ef (patch) | |
tree | a8e162bef29f6afd5b3acc063b9e56019f475fd0 | |
parent | 8d6496fe97e9b8f5c709778cd975071ad0a69e1c (diff) | |
download | mongo-18966553fc7f9d350c3428ea1a23162aba2526ef.tar.gz |
SERVER-23208 Pick SCons upstream fix for SCons issue #3469
https://github.com/SCons/scons/commit/7c32091fccad5e70755dc46174fe516fff4549c3
3 files changed, 34 insertions, 18 deletions
diff --git a/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Builder.py b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Builder.py index e4e521542cb..0ee614b6edd 100644 --- a/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Builder.py +++ b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Builder.py @@ -647,6 +647,8 @@ class BuilderBase(object): env_kw = kw else: env_kw = self.overrides + + # TODO if env_kw: then the following line. there's no purpose in calling if no overrides. env = env.Override(env_kw) return self._execute(env, target, source, OverrideWarner(kw), ekw) diff --git a/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Conftest.py b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Conftest.py index c24adf8c3f5..4491884a090 100644 --- a/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Conftest.py +++ b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Conftest.py @@ -315,8 +315,8 @@ int main(void) { return ret -def CheckHeader(context, header_name, header = None, language = None, - include_quotes = None): +def CheckHeader(context, header_name, header=None, language=None, + include_quotes=None): """ Configure check for a C or C++ header file "header_name". Optional "header" can be defined to do something before including the diff --git a/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/SConf.py b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/SConf.py index e714636d6ab..8f917a54f80 100644 --- a/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/SConf.py +++ b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/SConf.py @@ -56,6 +56,7 @@ import SCons.Warnings import SCons.Conftest from SCons.Debug import Trace +from collections import defaultdict # Turn off the Conftest error logging SCons.Conftest.LogInputFiles = 0 @@ -98,7 +99,7 @@ def SetProgressDisplay(display): SConfFS = None -_ac_build_counter = 0 # incremented, whenever TryBuild is called +_ac_build_counter = defaultdict(int) _ac_config_logs = {} # all config.log files created in this build _ac_config_hs = {} # all config.h files created in this build sconf_global = None # current sconf object @@ -161,11 +162,14 @@ class ConfigureCacheError(SConfError): def __init__(self,target): SConfError.__init__(self, '"%s" is not yet built and cache is forced.' % str(target)) + # define actions for building text files -def _createSource( target, source, env ): +def _createSource(target, source, env): fd = open(str(target[0]), "w") fd.write(source[0].get_contents().decode()) fd.close() + + def _stringSource( target, source, env ): return (str(target[0]) + ' <-\n |' + source[0].get_contents().decode().replace( '\n', "\n |" ) ) @@ -573,8 +577,7 @@ class SConfBase(object): """ return self.pspawn(sh, escape, cmd, args, env, self.logstream, self.logstream) - - def TryBuild(self, builder, text = None, extension = ""): + def TryBuild(self, builder, text=None, extension=""): """Low level TryBuild implementation. Normally you don't need to call that - you can use TryCompile / TryLink / TryRun instead """ @@ -592,8 +595,30 @@ class SConfBase(object): raise SCons.Errors.UserError('Missing SPAWN construction variable.') nodesToBeBuilt = [] + sourcetext = self.env.Value(text) + f = "conftest" + + if text is not None: + textSig = SCons.Util.MD5signature(sourcetext) + textSigCounter = str(_ac_build_counter[textSig]) + _ac_build_counter[textSig] += 1 + + f = "_".join([f, textSig, textSigCounter]) + textFile = self.confdir.File(f + extension) + textFileNode = self.env.SConfSourceBuilder(target=textFile, + source=sourcetext) + nodesToBeBuilt.extend(textFileNode) + + source = textFile + target = textFile.File(f + "SConfActionsContentDummyTarget") + else: + source = None + target = None + + action = builder.builder.action.get_contents(target=target, source=[source], env=self.env) + actionsig = SCons.Util.MD5signature(action) + f = "_".join([f, actionsig]) - f = "conftest_" + str(_ac_build_counter) pref = self.env.subst( builder.builder.prefix ) suff = self.env.subst( builder.builder.suffix ) target = self.confdir.File(pref + f + suff) @@ -602,16 +627,6 @@ class SConfBase(object): # Slide our wrapper into the construction environment as # the SPAWN function. self.env['SPAWN'] = self.pspawn_wrapper - sourcetext = self.env.Value(text) - - if text is not None: - textFile = self.confdir.File(f + extension) - textFileNode = self.env.SConfSourceBuilder(target=textFile, - source=sourcetext) - nodesToBeBuilt.extend(textFileNode) - source = textFileNode - else: - source = None nodes = builder(target = target, source = source) if not SCons.Util.is_List(nodes): @@ -622,7 +637,6 @@ class SConfBase(object): finally: self.env['SPAWN'] = save_spawn - _ac_build_counter = _ac_build_counter + 1 if result: self.lastTarget = nodes[0] else: |