summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Egesdahl <ryan.egesdahl@mongodb.com>2021-07-15 20:06:09 -0700
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-22 19:31:27 +0000
commitd8a447aaa333d984f56bfab3d13ba94555a209b2 (patch)
tree0c2242ab1f9b8c88be2b9414f3c8e498146a4d12
parente817e6b1b9dd1a49a63a6d469eb3f890ff3ba512 (diff)
downloadmongo-d8a447aaa333d984f56bfab3d13ba94555a209b2.tar.gz
SERVER-58285 Disallow MONGO_VERSION=0.0.0
Developers have commonly set MONGO_VERSION=0.0.0 in the past to avoid having to set one explicitly for every build. However, there are better and widely-available ways to set this automatically now, and in upcoming releases, it will be important for MONGO_VERSION to be set to an accurate value. From now on, we will specifically disallow setting it to 0.0.0 as a way of signaling to developers that they should stop setting it explicitly. In the future, we may do further checking to ensure the variable is set to an accurate value.
-rw-r--r--SConstruct5
1 files changed, 3 insertions, 2 deletions
diff --git a/SConstruct b/SConstruct
index 18d478c42d1..31939139c5c 100644
--- a/SConstruct
+++ b/SConstruct
@@ -940,8 +940,9 @@ env_vars.Add('MONGO_DISTNAME',
default='$MONGO_VERSION')
def validate_mongo_version(key, val, env):
- regex = r'^(\d+)\.(\d+)\.(\d+)-?((?:(rc)(\d+))?.*)?'
- if not re.match(regex, val):
+ valid_version_re = re.compile(r'^(\d+)\.(\d+)\.(\d+)-?((?:(rc)(\d+))?.*)?$', re.MULTILINE)
+ invalid_version_re = re.compile(r'^0\.0\.0(?:-.*)?', re.MULTILINE)
+ if not valid_version_re.match(val) or invalid_version_re.match(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)