summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2017-03-29 12:55:46 -0400
committerAndrew Morrow <acm@mongodb.com>2017-03-31 09:05:11 -0400
commit19b7e7213746e50323abe8ec97bb33023965aab7 (patch)
tree61827c5b1497e9627ff456b99f6e24dd60130140 /SConstruct
parent46933aa071eb0aa6614bfe26c56cc9b75270038b (diff)
downloadmongo-19b7e7213746e50323abe8ec97bb33023965aab7.tar.gz
SERVER-21317 Enforce MONGO_VERSION is set properly
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct9
1 files changed, 8 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index cdb15a3a945..b96e516aace 100644
--- a/SConstruct
+++ b/SConstruct
@@ -723,9 +723,16 @@ env_vars.Add('MONGO_DISTNAME',
help='Sets the version string to be used in dist archive naming',
default='$MONGO_VERSION')
+def validate_mongo_version(key, val, env):
+ regex = r'^(\d+)\.(\d+)\.(\d+)-?((?:(rc)(\d+))?.*)?'
+ if not re.match(regex, val):
+ print("Invalid MONGO_VERSION '{}', or could not derive from version.json or git metadata. Please add a conforming MONGO_VERSION=x.y.z[-extra] as an argument to SCons".format(val))
+ Exit(1)
+
env_vars.Add('MONGO_VERSION',
help='Sets the version string for MongoDB',
- default=version_data['version'])
+ default=version_data['version'],
+ validator=validate_mongo_version)
env_vars.Add('MONGO_GIT_HASH',
help='Sets the githash to store in the MongoDB version information',