summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2015-06-12 11:32:57 -0400
committerAndrew Morrow <acm@mongodb.com>2015-06-12 13:28:17 -0400
commit483706ef48add1506e04ed8cde6f6f671cabdd6f (patch)
treec08d480af78bc4477bf5ef127fb703400121ef5c /site_scons
parentf32226bc1c8489a7cfff2ba2242c98b3f2efb16b (diff)
downloadmongo-483706ef48add1506e04ed8cde6f6f671cabdd6f.tar.gz
SERVER-17789 Do not use option values to configure the variant directory
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/mongo_scons_utils.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/site_scons/mongo_scons_utils.py b/site_scons/mongo_scons_utils.py
new file mode 100644
index 00000000000..1ddaf9915dd
--- /dev/null
+++ b/site_scons/mongo_scons_utils.py
@@ -0,0 +1,37 @@
+import md5
+
+def default_variant_dir_generator(target, source, env, for_signature):
+
+ if env.GetOption('cache') != None:
+ return 'cached'
+
+ # If an option should affect the variant directory, name it here.
+ variant_options = [
+ 'opt',
+ 'dbg',
+ ]
+
+ # Hash the named options and their values, and take the first 8 characters of the hash as
+ # the variant name
+ hasher = md5.md5()
+ for option in variant_options:
+ hasher.update(option)
+ hasher.update(str(env.GetOption(option)))
+ variant_dir = hasher.hexdigest()[0:8]
+
+ # If our option hash yields a well known hash, replace it with its name.
+ known_variant_hashes = {
+ '343e6678' : 'debug',
+ '85fcf9b0' : 'opt',
+ '981ce870' : 'debug',
+ '9fface73' : 'optdebug',
+ 'c52b1cc3' : 'opt',
+ }
+
+ return known_variant_hashes.get(variant_dir, variant_dir)
+
+
+def os_specific_variant_dir_generator(target, source, env, for_signature):
+ return '-'.join([
+ env['TARGET_OS'],
+ default_variant_dir_generator(target, source, env, for_signature)])