summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2017-03-29 12:55:46 -0400
committerAndrew Morrow <acm@mongodb.com>2018-04-18 14:27:29 -0400
commited1813b8f82684ff53abc92326f1cf6ac6709e8d (patch)
tree79b81467470b224bb1bfa7aee63782876350e0c8
parent1e619e899f17520ddb04f3848b1bdd8b99f97787 (diff)
downloadmongo-ed1813b8f82684ff53abc92326f1cf6ac6709e8d.tar.gz
SERVER-21317 Enforce MONGO_VERSION is set properly
(cherry picked from commit 19b7e7213746e50323abe8ec97bb33023965aab7)
-rw-r--r--SConstruct9
1 files changed, 8 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index 3f487e34caf..b2d2f536ab0 100644
--- a/SConstruct
+++ b/SConstruct
@@ -654,9 +654,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',