summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Moody <daniel.moody@mongodb.com>2020-10-06 14:51:24 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-06 15:20:00 +0000
commit084d4ae692bd2e5d804545a1745e50ecc485b797 (patch)
treea351185267c5edba2b4b0741849de7e0180fd441
parentb1e8378b3a37b4b98d675309fbb43e5e405a782e (diff)
downloadmongo-084d4ae692bd2e5d804545a1745e50ecc485b797.tar.gz
SERVER-50016 Fail on missing variables files
(cherry picked from commit 5b3086d02c905b528a28d3a751af7c6b154d2f95)
-rw-r--r--SConstruct35
1 files changed, 25 insertions, 10 deletions
diff --git a/SConstruct b/SConstruct
index a197a9f9a97..2ae9a457f47 100644
--- a/SConstruct
+++ b/SConstruct
@@ -498,15 +498,17 @@ add_option("cxx-std",
def find_mongo_custom_variables():
files = []
- for path in sys.path:
+ paths = [path for path in sys.path if 'site_scons' in path]
+ for path in paths:
probe = os.path.join(path, 'mongo_custom_variables.py')
if os.path.isfile(probe):
files.append(probe)
return files
add_option('variables-files',
- default=find_mongo_custom_variables(),
- help="Specify variables files to load",
+ default=[],
+ action="append",
+ help="Specify variables files to load.",
)
link_model_choices = ['auto', 'object', 'static', 'dynamic', 'dynamic-strict', 'dynamic-sdk']
@@ -665,9 +667,26 @@ def variable_distsrc_converter(val):
return val + "/"
return val
-variables_files = variable_shlex_converter(get_option('variables-files'))
-for file in variables_files:
- print(("Using variable customization file %s" % file))
+def fatal_error(env, msg, *args):
+ print(msg.format(*args))
+ Exit(1)
+
+# Apply the default variables files, and walk the provided
+# arguments. Interpret any falsy argument (like the empty string) as
+# resetting any prior state. This makes the argument
+# --variables-files= destructive of any prior variables files
+# arguments, including the default.
+variables_files_args = get_option('variables-files')
+variables_files = find_mongo_custom_variables()
+for variables_file in variables_files_args:
+ if variables_file:
+ variables_files.append(variables_file)
+ else:
+ variables_files = []
+for vf in variables_files:
+ if not os.path.isfile(vf):
+ fatal_error(None, f"Specified variables file '{vf}' does not exist")
+ print(f"Using variable customization file {vf}")
env_vars = Variables(
files=variables_files,
@@ -1049,10 +1068,6 @@ for var in ['CC', 'CXX']:
env.AddMethod(mongo_platform.env_os_is_wrapper, 'TargetOSIs')
env.AddMethod(mongo_platform.env_get_os_name_wrapper, 'GetTargetOSName')
-def fatal_error(env, msg, *args):
- print((msg.format(*args)))
- Exit(1)
-
def conf_error(env, msg, *args):
print((msg.format(*args)))
print(("See {0} for details".format(env.File('$CONFIGURELOG').abspath)))