summaryrefslogtreecommitdiff
path: root/src/mongo/installer
diff options
context:
space:
mode:
authorXueruiFa <xuerui.fa@mongodb.com>2021-07-27 21:15:40 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-09 14:22:15 +0000
commit1a5ddab19e8ced1ad8f08261be2e2e17adcd7570 (patch)
treeb4b3e10c82005d30db8d7f5572ec7e2a39355460 /src/mongo/installer
parent61a7c14965c94d735800822dcd1e000da78a953b (diff)
downloadmongo-1a5ddab19e8ced1ad8f08261be2e2e17adcd7570.tar.gz
SERVER-59015: Automatically update MSI codes based on git tag
Diffstat (limited to 'src/mongo/installer')
-rw-r--r--src/mongo/installer/msi/SConscript43
1 files changed, 15 insertions, 28 deletions
diff --git a/src/mongo/installer/msi/SConscript b/src/mongo/installer/msi/SConscript
index 4f962eb6bed..9b8cdc4033f 100644
--- a/src/mongo/installer/msi/SConscript
+++ b/src/mongo/installer/msi/SConscript
@@ -1,6 +1,8 @@
# -*- mode: python; -*-
import os
+import hashlib
+import uuid
Import("env")
Import("get_option")
@@ -59,23 +61,13 @@ enterpriseToolBuildDir = buildDir + r'\mongo\db\modules\enterprise'
msi_flavor = '2008R2Plus'
msi_platform = 'x64'
-# Enterprise
-if 'enterprise' in env['MONGO_MODULES']:
+if 'enterprise' in env['MONGO_MODULES']: # Enterprise
msi_edition = 'Enterprise'
- upgrade_code = '853A13DC-34FF-4AA9-BAE2-E4E06228C3C3'
-# Community
-else:
+else: # Community
if get_option('ssl') == 'on':
msi_edition = 'SSL'
- upgrade_code = '70AC128E-D90B-4905-9309-7739AF9AF206'
else:
msi_edition = 'Standard'
- upgrade_code = '0B2EC44A-2BAA-4AEC-803F-92A885A9D12E'
-
-sourcesList.append("Installer_64.wxs")
-
-sources = ["wxs/" + file for file in sourcesList]
-objects = ["$BUILD_DIR/msi/" + file.replace(".wxs", ".wixobj") for file in sourcesList]
full_version = env['MONGO_VERSION'].partition('-')[0]
@@ -84,22 +76,17 @@ major_version = full_version
mv = major_version.split('.')
major_version = "%s.%s" % (mv[0], mv[1])
-# We must regenerate the upgrade codes for each major release.
-# i.e., 3.0, 3.2, 3.4 need new codes but not 3.2.1, 3.2.2, etc
-# The build will now fail when the major version is bumped to prevent mistakes.
-# When the upgrade codes are bumped, remember to raise the version number to the next major version.
-# On each update to the upgrade codes:
-# 1. Generate new GUIDs
-# 2. Ensure each MSI gets a different GUID. This is used to identify products.
-# It allows upgrade from 3.2.0 to 3.2.1 in place instead of side-by-side.
-# 3. Update the check for the next major release below so we bump the GUIDs in the future.
-#
-if float(major_version) > 6.0:
- # If you are troubleshooting this error, see the comment above
- env.FatalError("The upgrade codes are out of date for this release. Please \n" +
- "replace the existing GUIDs listed in this file with new GUIDs so " +
- "side-by-side installation of major versions (i.e. 3.2, and 3.4) is " +
- "supported.")
+# We must regenerate upgrade codes for each major release. These upgrade codes must also be
+# different for each MSI edition.
+m = hashlib.sha256()
+hash_str = '{}_{}'.format(major_version, msi_edition)
+m.update(hash_str.encode())
+upgrade_code = str(uuid.UUID(bytes=m.digest()[0:16]))
+
+sourcesList.append("Installer_64.wxs")
+
+sources = ["wxs/" + file for file in sourcesList]
+objects = ["$BUILD_DIR/msi/" + file.replace(".wxs", ".wixobj") for file in sourcesList]
# Currently, we are planning to key the same upgrade code for each
# (msi_edition, msi_platform, msi_flavor) combination