diff options
-rw-r--r-- | SConstruct | 9 |
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', |