From 5e0d37c421c9c044365c264b602227a6de4ee64d Mon Sep 17 00:00:00 2001 From: Mathew Robinson Date: Fri, 1 Sep 2017 18:01:34 -0400 Subject: SERVER-30995 Add Compass Installer to MongoDB packaging --- buildscripts/msitrim.py | 86 +++--- debian/mongodb-enterprise-unstable.rules | 2 + debian/mongodb-enterprise.rules | 2 + debian/mongodb-org-unstable.rules | 2 + debian/mongodb-org.rules | 2 + rpm/mongo.mdv.spec | 1 + rpm/mongodb-enterprise-init.spec | 1 + rpm/mongodb-enterprise-unstable-init.spec | 1 + rpm/mongodb-enterprise-unstable.spec | 1 + rpm/mongodb-enterprise.spec | 1 + rpm/mongodb-org-init.spec | 1 + rpm/mongodb-org-unstable-init.spec | 1 + rpm/mongodb-org-unstable.spec | 1 + rpm/mongodb-org.spec | 1 + src/mongo/SConscript | 14 + src/mongo/installer/compass/InstallCompass.ps1 | 20 ++ src/mongo/installer/compass/install_compass | 112 ++++++++ src/mongo/installer/msi/SConscript | 328 +++++++++++----------- src/mongo/installer/msi/wxs/BinaryFragment.wxs | 320 ++++++++++----------- src/mongo/installer/msi/wxs/FeatureFragment.wxs | 211 +++++++------- src/mongo/installer/msi/wxs/Installer_64.wxs | 194 ++++++++----- src/mongo/installer/msi/wxs/LicensingFragment.wxs | 112 ++++---- src/mongo/installer/msi/wxs/UIFragment.wxs | 103 ++++--- 23 files changed, 869 insertions(+), 648 deletions(-) create mode 100755 src/mongo/installer/compass/InstallCompass.ps1 create mode 100755 src/mongo/installer/compass/install_compass diff --git a/buildscripts/msitrim.py b/buildscripts/msitrim.py index 7e267375229..45ca8d482ac 100644 --- a/buildscripts/msitrim.py +++ b/buildscripts/msitrim.py @@ -1,43 +1,43 @@ -"""Script to fix up our MSI files """ - -import argparse; -import msilib -import shutil; - -parser = argparse.ArgumentParser(description='Trim MSI.') -parser.add_argument('file', type=argparse.FileType('r'), help='file to trim') -parser.add_argument('out', type=argparse.FileType('w'), help='file to output to') - -args = parser.parse_args() - -def exec_delete(query): - view = db.OpenView(query) - view.Execute(None) - - cur_record = view.Fetch() - view.Modify(msilib.MSIMODIFY_DELETE, cur_record) - view.Close() - - -def exec_update(query, column, value): - view = db.OpenView(query) - view.Execute(None) - - cur_record = view.Fetch() - cur_record.SetString(column, value) - view.Modify(msilib.MSIMODIFY_REPLACE, cur_record) - view.Close() - - -print "Trimming MSI" - -db = msilib.OpenDatabase(args.file.name, msilib.MSIDBOPEN_DIRECT) - -exec_delete("select * from ControlEvent WHERE Dialog_ = 'LicenseAgreementDlg' AND Control_ = 'Next' AND Event = 'NewDialog' AND Argument = 'CustomizeDlg'") -exec_delete("select * from ControlEvent WHERE Dialog_ = 'CustomizeDlg' AND Control_ = 'Back' AND Event = 'NewDialog' AND Argument = 'LicenseAgreementDlg'") - -exec_update("select * from ControlEvent WHERE Dialog_ = 'VerifyReadyDlg' AND Control_ = 'Back' AND Event = 'NewDialog' AND Argument = 'CustomizeDlg'", 5, "WixUI_InstallMode = \"InstallCustom\"") - -db.Commit() - -shutil.copyfile(args.file.name, args.out.name); +"""Script to fix up our MSI files """ + +import argparse; +import msilib +import shutil; + +parser = argparse.ArgumentParser(description='Trim MSI.') +parser.add_argument('file', type=argparse.FileType('r'), help='file to trim') +parser.add_argument('out', type=argparse.FileType('w'), help='file to output to') + +args = parser.parse_args() + +def exec_delete(query): + view = db.OpenView(query) + view.Execute(None) + + cur_record = view.Fetch() + view.Modify(msilib.MSIMODIFY_DELETE, cur_record) + view.Close() + + +def exec_update(query, column, value): + view = db.OpenView(query) + view.Execute(None) + + cur_record = view.Fetch() + cur_record.SetString(column, value) + view.Modify(msilib.MSIMODIFY_REPLACE, cur_record) + view.Close() + + +print "Trimming MSI" + +db = msilib.OpenDatabase(args.file.name, msilib.MSIDBOPEN_DIRECT) + +exec_delete("select * from ControlEvent WHERE Dialog_ = 'LicenseAgreementDlg' AND Control_ = 'Next' AND Event = 'NewDialog' AND Argument = 'CustomizeDlg'") +exec_delete("select * from ControlEvent WHERE Dialog_ = 'CustomizeDlg' AND Control_ = 'Back' AND Event = 'NewDialog' AND Argument = 'LicenseAgreementDlg'") +exec_delete("select * from ControlEvent WHERE Dialog_ = 'CustomizeDlg' AND Control_ = 'Next' AND Event = 'NewDialog' AND Argument = 'VerifyReadyDlg'") +exec_delete("select * from ControlEvent WHERE Dialog_ = 'VerifyReadyDlg' AND Control_ = 'Back' AND Event = 'NewDialog' AND Argument = 'CustomizeDlg'") + +db.Commit() + +shutil.copyfile(args.file.name, args.out.name); diff --git a/debian/mongodb-enterprise-unstable.rules b/debian/mongodb-enterprise-unstable.rules index 70419c6673d..dcfd78abef4 100644 --- a/debian/mongodb-enterprise-unstable.rules +++ b/debian/mongodb-enterprise-unstable.rules @@ -61,6 +61,7 @@ clean: rm -f mongorestore rm -f mongodump rm -f mongofiles + rm -f install_compass rm -f .sconsign.dblite rm -f libmongoclient.a rm -rf client/*.o @@ -87,6 +88,7 @@ install: build cp -v $(CURDIR)/bin/mongo $(CURDIR)/debian/mongodb-enterprise-unstable-shell/usr/bin cp -v $(CURDIR)/bin/mongod $(CURDIR)/debian/mongodb-enterprise-unstable-server/usr/bin cp -v $(CURDIR)/bin/mongos $(CURDIR)/debian/mongodb-enterprise-unstable-mongos/usr/bin + cp -v $(CURDIR)/bin/install_compass $(CURDIR)/debian/mongodb-enterprise-unstable-tools/usr/bin for binary in ${TOOLS} ; \ do \ diff --git a/debian/mongodb-enterprise.rules b/debian/mongodb-enterprise.rules index 81983eee840..70aed7e0687 100644 --- a/debian/mongodb-enterprise.rules +++ b/debian/mongodb-enterprise.rules @@ -60,6 +60,7 @@ clean: rm -f mongorestore rm -f mongodump rm -f mongofiles + rm -f install_compass rm -f .sconsign.dblite rm -f libmongoclient.a rm -rf client/*.o @@ -86,6 +87,7 @@ install: build cp -v $(CURDIR)/bin/mongo $(CURDIR)/debian/mongodb-enterprise-shell/usr/bin cp -v $(CURDIR)/bin/mongod $(CURDIR)/debian/mongodb-enterprise-server/usr/bin cp -v $(CURDIR)/bin/mongos $(CURDIR)/debian/mongodb-enterprise-mongos/usr/bin + cp -v $(CURDIR)/bin/install_compass $(CURDIR)/debian/mongodb-enterprise-tools/usr/bin for binary in ${TOOLS} ; \ do \ diff --git a/debian/mongodb-org-unstable.rules b/debian/mongodb-org-unstable.rules index 25c0d0ed795..5af48203cb0 100644 --- a/debian/mongodb-org-unstable.rules +++ b/debian/mongodb-org-unstable.rules @@ -58,6 +58,7 @@ clean: rm -f mongorestore rm -f mongodump rm -f mongofiles + rm -f install_compass rm -f .sconsign.dblite rm -f libmongoclient.a rm -rf client/*.o @@ -84,6 +85,7 @@ install: build cp -v $(CURDIR)/bin/mongo $(CURDIR)/debian/mongodb-org-unstable-shell/usr/bin cp -v $(CURDIR)/bin/mongod $(CURDIR)/debian/mongodb-org-unstable-server/usr/bin cp -v $(CURDIR)/bin/mongos $(CURDIR)/debian/mongodb-org-unstable-mongos/usr/bin + cp -v $(CURDIR)/bin/install_compass $(CURDIR)/debian/mongodb-org-unstable-tools/usr/bin for binary in ${TOOLS} ; \ do \ diff --git a/debian/mongodb-org.rules b/debian/mongodb-org.rules index f7e32fb0af3..4ca259be8fe 100644 --- a/debian/mongodb-org.rules +++ b/debian/mongodb-org.rules @@ -57,6 +57,7 @@ clean: rm -f mongorestore rm -f mongodump rm -f mongofiles + rm -f install_compass rm -f .sconsign.dblite rm -f libmongoclient.a rm -rf client/*.o @@ -83,6 +84,7 @@ install: build cp -v $(CURDIR)/bin/mongo $(CURDIR)/debian/mongodb-org-shell/usr/bin cp -v $(CURDIR)/bin/mongod $(CURDIR)/debian/mongodb-org-server/usr/bin cp -v $(CURDIR)/bin/mongos $(CURDIR)/debian/mongodb-org-mongos/usr/bin + cp -v $(CURDIR)/bin/install_compass $(CURDIR)/debian/mongodb-org-unstable-tools/usr/bin for binary in ${TOOLS} ; \ do \ diff --git a/rpm/mongo.mdv.spec b/rpm/mongo.mdv.spec index 5b9b28bf4d2..8935334dcef 100644 --- a/rpm/mongo.mdv.spec +++ b/rpm/mongo.mdv.spec @@ -139,6 +139,7 @@ fi %{_bindir}/mongoimport %{_bindir}/mongorestore %{_bindir}/mongostat +%{_bindir}/install_compass %{_mandir}/man1/mongo.1* %{_mandir}/man1/mongod.1* diff --git a/rpm/mongodb-enterprise-init.spec b/rpm/mongodb-enterprise-init.spec index 323bd43de3b..ba86c9aac27 100644 --- a/rpm/mongodb-enterprise-init.spec +++ b/rpm/mongodb-enterprise-init.spec @@ -271,6 +271,7 @@ fi %{_bindir}/mongorestore %{_bindir}/mongotop %{_bindir}/mongostat +%{_bindir}/install_compass %{_mandir}/man1/bsondump.1* %{_mandir}/man1/mongodump.1* diff --git a/rpm/mongodb-enterprise-unstable-init.spec b/rpm/mongodb-enterprise-unstable-init.spec index 92e453b51be..911620c45ed 100644 --- a/rpm/mongodb-enterprise-unstable-init.spec +++ b/rpm/mongodb-enterprise-unstable-init.spec @@ -260,6 +260,7 @@ fi %{_bindir}/mongorestore %{_bindir}/mongotop %{_bindir}/mongostat +%{_bindir}/install_compass %{_mandir}/man1/bsondump.1* %{_mandir}/man1/mongodump.1* diff --git a/rpm/mongodb-enterprise-unstable.spec b/rpm/mongodb-enterprise-unstable.spec index 781deacdd4b..5164b03bfe7 100644 --- a/rpm/mongodb-enterprise-unstable.spec +++ b/rpm/mongodb-enterprise-unstable.spec @@ -257,6 +257,7 @@ fi %{_bindir}/mongorestore %{_bindir}/mongotop %{_bindir}/mongostat +%{_bindir}/install_compass %{_mandir}/man1/bsondump.1* %{_mandir}/man1/mongodump.1* diff --git a/rpm/mongodb-enterprise.spec b/rpm/mongodb-enterprise.spec index 477f9cd291a..5b939d25972 100644 --- a/rpm/mongodb-enterprise.spec +++ b/rpm/mongodb-enterprise.spec @@ -267,6 +267,7 @@ fi %{_bindir}/mongorestore %{_bindir}/mongotop %{_bindir}/mongostat +%{_bindir}/install_compass %{_mandir}/man1/bsondump.1* %{_mandir}/man1/mongodump.1* diff --git a/rpm/mongodb-org-init.spec b/rpm/mongodb-org-init.spec index 790ccd0e7fa..d5c7a18f2e9 100644 --- a/rpm/mongodb-org-init.spec +++ b/rpm/mongodb-org-init.spec @@ -264,6 +264,7 @@ fi %{_bindir}/mongorestore %{_bindir}/mongotop %{_bindir}/mongostat +%{_bindir}/install_compass %{_mandir}/man1/bsondump.1* %{_mandir}/man1/mongodump.1* diff --git a/rpm/mongodb-org-unstable-init.spec b/rpm/mongodb-org-unstable-init.spec index 05de5cc5c48..f474c60ba97 100644 --- a/rpm/mongodb-org-unstable-init.spec +++ b/rpm/mongodb-org-unstable-init.spec @@ -252,6 +252,7 @@ fi %{_bindir}/mongorestore %{_bindir}/mongotop %{_bindir}/mongostat +%{_bindir}/install_compass %{_mandir}/man1/bsondump.1* %{_mandir}/man1/mongodump.1* diff --git a/rpm/mongodb-org-unstable.spec b/rpm/mongodb-org-unstable.spec index c1096ce1c67..cc92c60b0cb 100644 --- a/rpm/mongodb-org-unstable.spec +++ b/rpm/mongodb-org-unstable.spec @@ -248,6 +248,7 @@ fi %{_bindir}/mongorestore %{_bindir}/mongotop %{_bindir}/mongostat +%{_bindir}/install_compass %{_mandir}/man1/bsondump.1* %{_mandir}/man1/mongodump.1* diff --git a/rpm/mongodb-org.spec b/rpm/mongodb-org.spec index a1fc5a18aa8..676c4be3b8e 100644 --- a/rpm/mongodb-org.spec +++ b/rpm/mongodb-org.spec @@ -260,6 +260,7 @@ fi %{_bindir}/mongorestore %{_bindir}/mongotop %{_bindir}/mongostat +%{_bindir}/install_compass %{_mandir}/man1/bsondump.1* %{_mandir}/man1/mongodump.1* diff --git a/src/mongo/SConscript b/src/mongo/SConscript index 96c41128916..75d5cf90fac 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -463,6 +463,11 @@ distBinaries = [] distDebugSymbols = [] def add_exe( v ): + # The compass installer is written in powershell. On windows when calling + # installExternalBinary it tries to add .exe, in this case we do not want + # this so ignore the ${PROGSUFFIX} for powershell scripts. + if v.endswith('.ps1'): + return "${PROGPREFIX}%s" % v return "${PROGPREFIX}%s${PROGSUFFIX}" % v def failMissingObjCopy(env, target, source): @@ -581,6 +586,13 @@ for full_dir, archive_dir in env["ARCHIVE_ADDITION_DIR_MAP"].items(): for target in env["DIST_BINARIES"]: installBinary(env, "db/modules/" + target) + +if env.TargetOSIs('windows'): + installExternalBinary(env, "src/mongo/installer/compass/InstallCompass.ps1") +else: + installExternalBinary(env, "src/mongo/installer/compass/install_compass") + + # "dist" target is valid only when --use-new-tools is specified # Attempts to build release artifacts without tools must fail if has_option("use-new-tools"): @@ -598,6 +610,7 @@ if has_option("use-new-tools"): '--transform $BUILD_DIR/mongo=$SERVER_DIST_BASENAME/bin', '--transform $BUILD_DIR/mongo/stripped/src/mongo-tools=$SERVER_DIST_BASENAME/bin', '--transform src/mongo-tools=$SERVER_DIST_BASENAME/bin', + '--transform src/mongo/installer/compass=$SERVER_DIST_BASENAME/bin', '${TEMPFILE(SOURCES[1:])}' ], ), @@ -624,6 +637,7 @@ debug_symbols_dist = env.Command( ), BUILD_DIR=env.Dir('$BUILD_DIR').path ) + env.Alias('dist-debugsymbols', debug_symbols_dist) #final alias diff --git a/src/mongo/installer/compass/InstallCompass.ps1 b/src/mongo/installer/compass/InstallCompass.ps1 new file mode 100755 index 00000000000..b2d1259bfae --- /dev/null +++ b/src/mongo/installer/compass/InstallCompass.ps1 @@ -0,0 +1,20 @@ +$R = Invoke-WebRequest -Uri https://s3.amazonaws.com/info-mongodb-com/com-download-center/compass.json +$J = ConvertFrom-Json $R.Content +$LINK = "" + +echo "Determining latest version of Compass..." +for ($i = 0; $i -lt $J.versions.Length; $i++) { + if ($J.versions[$i].version -like "*(Stable)*") { + for ($x = 0; $x -lt $J.versions[$i].platform.Length; $x++) { + if ($J.versions[$i].platform[$x].name -eq "Windows 64-bit (7+)") { + $LINK = $J.versions[$i].platform[$x].download_link + } + } + } +} + +echo "Downloading Compass...." +Invoke-WebRequest -Uri $LINK -OutFile ".\compass-install.exe" + +echo "Installing Compass..." +.\compass-install.exe diff --git a/src/mongo/installer/compass/install_compass b/src/mongo/installer/compass/install_compass new file mode 100755 index 00000000000..0a81d750711 --- /dev/null +++ b/src/mongo/installer/compass/install_compass @@ -0,0 +1,112 @@ +#!/usr/bin/env python2 + +import subprocess +import time +import tempfile +import urllib +import json +import sys +import os +import os.path as path +import shutil + +# Used later when choosing between a dpkg or rpm based distro. + +def pkg_format(): + with open(os.devnull, 'w') as FNULL: + try: + subprocess.call(['apt-get', '--help'], stdout=FNULL, stderr=FNULL) + return 'apt' + except: + pass + + try: + subprocess.call(['yum', '--help'], stdout=FNULL, stderr=FNULL) + return 'yum' + except: + pass + + return '' + +print 'Determining download link...' +download_manager = urllib.urlopen('https://s3.amazonaws.com/info-mongodb-com/com-download-center/compass.json') +jsn = json.loads(download_manager.read()) +download_manager.close() + +platform = sys.platform + +# Sometimes sys.platform gives us 'linux2' and we only want 'linux' +if platform.startswith('linux'): + platform = 'linux' + +if platform == 'linux' and os.getuid() != 0: + print 'You must run this script as root.' + sys.exit(1) + +ver = filter(lambda x: 'Stable' in x['version'], jsn['versions'])[0] +links = filter(lambda x: x['os'] == platform, ver['platform']) + +if len(links) == 0: + print 'Platform %s not supported.' % sys.platform + sys.exit(1) + +if platform == 'linux': + if pkg_format() == 'apt': + links = filter(lambda x: 'Ubuntu' in x['name'], links) + elif pkg_format() == 'yum': + links = filter(lambda x: 'RedHat' in x['name'], links) + else: + print 'Unsupported Linux Distribution.' + sys.exit(1) + +dl = links[0]['download_link'] + + +def dl_progress(count, block_size, total_size): + global start_time + if count == 0: + start_time = time.time() + return + duration = time.time() - start_time + progress_size = int(count * block_size) + speed = int(progress_size / (1024 * duration)) + percent = int(count * block_size * 100 / total_size) + sys.stdout.write("\rDownloading Compass... %d%%" % percent) + sys.stdout.flush() + + +fn, headers = urllib.urlretrieve(dl, reporthook=dl_progress) +# Download progress doesn't end with a newline so add it here. +print '' + + +if platform == 'darwin': + tmp = tempfile.mkdtemp() + subprocess.check_call(['hdiutil', 'attach', '-mountpoint', tmp, fn]) + try: + apps = [f for f in os.listdir(tmp) if f.endswith('.app')] + for a in apps: + if path.isdir('/Applications/' + f): + print 'Old version found removing...' + shutil.rmtree('/Applications/' + f) + print 'Copying %s to /Applications' % f + shutil.copytree(path.join(tmp, f), '/Applications/' + f) + # We don't really care about what errors come up here. Just log the failure + # and use the finally to make sure we always unmount the dmg. + except Exception as e: + print e + finally: + subprocess.check_call(['hdiutil', 'detach', tmp]) +elif platform == 'linux': + if pkg_format() == 'yum': + install = ['yum', 'install', '--assumeyes', fn] + elif pkg_format() == 'apt': + install = ['apt-get', 'install', '--yes', fn] + else: + print 'No available installation methods.' + sys.exit(1) + + subprocess.call(install) +else: + print 'Unrecognized platform %s' % sys.platform + sys.exit(1) diff --git a/src/mongo/installer/msi/SConscript b/src/mongo/installer/msi/SConscript index 59a871e978a..e62370f76df 100644 --- a/src/mongo/installer/msi/SConscript +++ b/src/mongo/installer/msi/SConscript @@ -1,164 +1,164 @@ -# -*- mode: python; -*- - -import os - -Import("env") -Import("has_option") - -env = env.Clone() - -env['WIX'] = os.environ.get('WIX') -env['WIXPATH'] = r'$WIX\bin' -env['WIXHEAT'] = r'$WIXPATH\heat.exe' -env['WIXCANDLE'] = r'$WIXPATH\candle.exe' -env['WIXLIGHT'] = r'$WIXPATH\light.exe' -env['WIXUIEXT'] = r'$WIXPATH\WixUIExtension.dll' -env['MERGEMODULESBASEPATH'] = os.environ.get('MERGEMODULESBASEPATH') -if env['MERGEMODULESBASEPATH'] == None and os.environ.get('ProgramFiles(x86)') != None: - env['MERGEMODULESBASEPATH'] = (os.environ.get('ProgramFiles(x86)') + - r"\Common Files\Merge Modules") - -sourcesList = [ "BinaryFragment.wxs", - "FeatureFragment.wxs", - "LicensingFragment.wxs", - "UIFragment.wxs", - ] - -# Need to do this in order to get scons to translate path separators into native format -buildDir = env.Dir("$BUILD_DIR").path -if has_option("use-new-tools"): - toolBuildDir = "src\mongo-tools" -else: - toolBuildDir = buildDir + r'\mongo' - -enterprisebase = 'src\mongo\db\modules\enterprise' -enterpriseToolBuildDir = buildDir + r'\mongo\db\modules\enterprise' - -# Set up parameters to pass to wix - -# -# msi_edition - "Enterprise" or "Standard" -# msi_platform - "x64" or "x86" -# msi_flavor - "2008R2Plus" or "" -# - -msi_flavor = '2008R2Plus' -msi_platform = 'x64' - -# Enterprise -if 'enterprise' in env['MONGO_MODULES']: - msi_edition = 'Enterprise' - upgrade_code = '822C75A4-40BA-456B-91D3-C339155F0F90' -# Community -else: - if has_option('ssl'): - msi_edition = 'SSL' - upgrade_code = 'FDAA2775-060E-4C54-9C19-A84197F3070D' - else: - msi_edition = 'Standard' - upgrade_code = '7BCCBD4E-AC8A-48BC-9922-E9EBB158A060' - -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] - -# major version is the x.y, not the x.y.z -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) > 3.6: - # 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.") - -# Currently, we are planning to key the same upgrade code for each -# (msi_edition, msi_platform, msi_flavor) combination -# and change MSI ProductId on minor updates, 2.6.0 -> 2.6.1, we let Wix do automatic -# GUID generation for us rather then build a database of GUIDs in our build system -# For major updates, we are going to create a new directory/productid/upgrade_code ie, 2.6 -> 3.0 - - -# candle: compile .wxs files into .wixobjs -env.Command(objects, - sources, - '"$WIXCANDLE" -wx' - # cannot have anything other than x.x.x.x in version string. - # we should choose a fourth version number that reflects pre-ness. - ' -dMongoDBMajorVersion=' + major_version + - ' -dMongoDBVersion=' + full_version + - ' -dLicenseSource=distsrc' - r' -dEnterpriseBase=' + enterprisebase + '\\' - ' -dBinarySource=' + buildDir + r'\mongo' - ' -dToolBinarySource=' + toolBuildDir + - ' -dEnterpriseToolBinarySource=' + enterpriseToolBuildDir + - ' -dMergeModulesBasePath="$MERGEMODULESBASEPATH"' - ' -dEdition=' + msi_edition + - ' -d"ProductId=*\"' - ' -dUpgradeCode=' + upgrade_code + - ' -dClientSource=' + buildDir + r'\client_build' - r' -dClientHeaderSource=${INSTALL_DIR}\include\mongo' - ' -dConfiguration=Release' - ' -dOutDir=' + buildDir + r'\msi' - ' -dPlatform=' + msi_platform + - ' -dFlavor=' + msi_flavor + - r' -dProjectDir=buildscripts\packaging\msi\\' - ' -dProjectName=MongoDB' - ' -dTargetDir=' + buildDir + r'\msi' - ' -dTargetExt=.msi' - ' -dTargetFileName=${SERVER_ARCHIVE}' - r' -dSaslSource=c:\sasl\bin' - r' -dSnmpSource=c:\snmp\bin' - r' -dSslSource=' + env['WINDOWS_OPENSSL_BIN'] + - ' -out ' + buildDir + r'\msi\\' - ' -arch ' + msi_platform + - ' -ext "$WIXUIEXT"' - ' $SOURCES') - -#light: link .objs into an msi -pre_msi = "$BUILD_DIR/msi/${SERVER_DIST_BASENAME}.pre.msi" - -# Suppress VC140_CRT_CRT.MSM Internal Consistency Errors -# ICE03 - Supress "String overflow" -# -- https://msdn.microsoft.com/en-us/library/windows/desktop/aa369037(v=vs.85).aspx -# ICE82 - Suppress "duplicate sequence number" -# -- https://msdn.microsoft.com/en-us/library/windows/desktop/aa368798(v=vs.85).aspx -# - -pre_msi_cmd = env.Command(pre_msi, - objects, - '"$WIXLIGHT" -out ${TARGET} -wx -cultures:null -sice:ICE82 -sice:ICE03' - ' -ext "$WIXUIEXT"' - ' ${SOURCES}') - -env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongo.exe') -env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongod.exe') -env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongos.exe') -env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongoperf.exe') - -if 'enterprise' in env['MONGO_MODULES']: - env.Depends(pre_msi_cmd, "#" + enterpriseToolBuildDir + "/mongodecrypt.exe") - env.Depends(pre_msi_cmd, "#" + enterpriseToolBuildDir + "/mongoldap.exe") - -msi = "$BUILD_DIR/msi/${SERVER_DIST_BASENAME}.msi" -env.Command(msi, - pre_msi, - r'$PYTHON buildscripts\msitrim.py ${SOURCES} ${TARGET}') -env.AlwaysBuild(msi) - -env.Alias( "msi" , msi ) - +# -*- mode: python; -*- + +import os + +Import("env") +Import("has_option") + +env = env.Clone() + +env['WIX'] = os.environ.get('WIX') +env['WIXPATH'] = r'$WIX\bin' +env['WIXHEAT'] = r'$WIXPATH\heat.exe' +env['WIXCANDLE'] = r'$WIXPATH\candle.exe' +env['WIXLIGHT'] = r'$WIXPATH\light.exe' +env['WIXUIEXT'] = r'$WIXPATH\WixUIExtension.dll' +env['WIXUTILEXT'] = r'$WIXPATH\WixUtilExtension.dll' +env['MERGEMODULESBASEPATH'] = os.environ.get('MERGEMODULESBASEPATH') +if env['MERGEMODULESBASEPATH'] == None and os.environ.get('ProgramFiles(x86)') != None: + env['MERGEMODULESBASEPATH'] = (os.environ.get('ProgramFiles(x86)') + + r"\Common Files\Merge Modules") + +sourcesList = [ "BinaryFragment.wxs", + "FeatureFragment.wxs", + "LicensingFragment.wxs", + "UIFragment.wxs", + ] + +# Need to do this in order to get scons to translate path separators into native format +buildDir = env.Dir("$BUILD_DIR").path +if has_option("use-new-tools"): + toolBuildDir = "src\mongo-tools" +else: + toolBuildDir = buildDir + r'\mongo' + +enterprisebase = 'src\mongo\db\modules\enterprise' +enterpriseToolBuildDir = buildDir + r'\mongo\db\modules\enterprise' + +# Set up parameters to pass to wix - +# +# msi_edition - "Enterprise" or "Standard" +# msi_platform - "x64" or "x86" +# msi_flavor - "2008R2Plus" or "" +# + +msi_flavor = '2008R2Plus' +msi_platform = 'x64' + +# Enterprise +if 'enterprise' in env['MONGO_MODULES']: + msi_edition = 'Enterprise' + upgrade_code = '822C75A4-40BA-456B-91D3-C339155F0F90' +# Community +else: + if has_option('ssl'): + msi_edition = 'SSL' + upgrade_code = 'FDAA2775-060E-4C54-9C19-A84197F3070D' + else: + msi_edition = 'Standard' + upgrade_code = '7BCCBD4E-AC8A-48BC-9922-E9EBB158A060' + +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] + +# major version is the x.y, not the x.y.z +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) > 3.6: + # 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.") + +# Currently, we are planning to key the same upgrade code for each +# (msi_edition, msi_platform, msi_flavor) combination +# and change MSI ProductId on minor updates, 2.6.0 -> 2.6.1, we let Wix do automatic +# GUID generation for us rather then build a database of GUIDs in our build system +# For major updates, we are going to create a new directory/productid/upgrade_code ie, 2.6 -> 3.0 + + +# candle: compile .wxs files into .wixobjs +env.Command(objects, + sources, + '"$WIXCANDLE" -wx' + # cannot have anything other than x.x.x.x in version string. + # we should choose a fourth version number that reflects pre-ness. + ' -dMongoDBMajorVersion=' + major_version + + ' -dMongoDBVersion=' + full_version + + ' -dLicenseSource=distsrc' + r' -dEnterpriseBase=' + enterprisebase + '\\' + ' -dBinarySource=' + buildDir + r'\mongo' + ' -dToolBinarySource=' + toolBuildDir + + ' -dEnterpriseToolBinarySource=' + enterpriseToolBuildDir + + ' -dMergeModulesBasePath="$MERGEMODULESBASEPATH"' + ' -dEdition=' + msi_edition + + ' -d"ProductId=*\"' + ' -dUpgradeCode=' + upgrade_code + + ' -dClientSource=' + buildDir + r'\client_build' + r' -dClientHeaderSource=${INSTALL_DIR}\include\mongo' + ' -dConfiguration=Release' + ' -dOutDir=' + buildDir + r'\msi' + ' -dPlatform=' + msi_platform + + ' -dFlavor=' + msi_flavor + + r' -dProjectDir=buildscripts\packaging\msi\\' + ' -dProjectName=MongoDB' + ' -dTargetDir=' + buildDir + r'\msi' + ' -dTargetExt=.msi' + ' -dTargetFileName=${SERVER_ARCHIVE}' + r' -dSaslSource=c:\sasl\bin' + r' -dSnmpSource=c:\snmp\bin' + r' -dSslSource=' + env['WINDOWS_OPENSSL_BIN'] + + ' -out ' + buildDir + r'\msi\\' + ' -arch ' + msi_platform + + ' -ext "$WIXUIEXT"' + ' $SOURCES') + +#light: link .objs into an msi +pre_msi = "$BUILD_DIR/msi/${SERVER_DIST_BASENAME}.pre.msi" + +# Suppress VC140_CRT_CRT.MSM Internal Consistency Errors +# ICE03 - Supress "String overflow" +# -- https://msdn.microsoft.com/en-us/library/windows/desktop/aa369037(v=vs.85).aspx +# ICE82 - Suppress "duplicate sequence number" +# -- https://msdn.microsoft.com/en-us/library/windows/desktop/aa368798(v=vs.85).aspx +# + +pre_msi_cmd = env.Command(pre_msi, + objects, + '"$WIXLIGHT" -out ${TARGET} -wx -cultures:null -sice:ICE82 -sice:ICE03' + ' -ext "$WIXUIEXT" -ext "$WIXUTILEXT"' + ' ${SOURCES}') + +env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongo.exe') +env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongod.exe') +env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongos.exe') +env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongoperf.exe') + +if 'enterprise' in env['MONGO_MODULES']: + env.Depends(pre_msi_cmd, "#" + enterpriseToolBuildDir + "/mongodecrypt.exe") + env.Depends(pre_msi_cmd, "#" + enterpriseToolBuildDir + "/mongoldap.exe") + +msi = "$BUILD_DIR/msi/${SERVER_DIST_BASENAME}.msi" +env.Command(msi, + pre_msi, + r'$PYTHON buildscripts\msitrim.py ${SOURCES} ${TARGET}') +env.AlwaysBuild(msi) + +env.Alias( "msi" , msi ) diff --git a/src/mongo/installer/msi/wxs/BinaryFragment.wxs b/src/mongo/installer/msi/wxs/BinaryFragment.wxs index 01c7d639612..d6453775f38 100644 --- a/src/mongo/installer/msi/wxs/BinaryFragment.wxs +++ b/src/mongo/installer/msi/wxs/BinaryFragment.wxs @@ -1,160 +1,160 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mongo/installer/msi/wxs/FeatureFragment.wxs b/src/mongo/installer/msi/wxs/FeatureFragment.wxs index 1f8dff61d73..a6fe4271c21 100644 --- a/src/mongo/installer/msi/wxs/FeatureFragment.wxs +++ b/src/mongo/installer/msi/wxs/FeatureFragment.wxs @@ -1,106 +1,105 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mongo/installer/msi/wxs/Installer_64.wxs b/src/mongo/installer/msi/wxs/Installer_64.wxs index 83426028ad6..4699d42c78d 100644 --- a/src/mongo/installer/msi/wxs/Installer_64.wxs +++ b/src/mongo/installer/msi/wxs/Installer_64.wxs @@ -1,77 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Installed OR (NOT MONGO_MULTIPLE_SKU OR MONGO_MULTIPLE_SKU = "!(wix.ProductMajorName)") - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Installed OR (NOT MONGO_MULTIPLE_SKU OR MONGO_MULTIPLE_SKU = "!(wix.ProductMajorName)") + + + + + + + + + + + + + + + + + + + + + + + + + (NOT Installed) AND (SHOULD_INSTALL_COMPASS = 1) + + + + diff --git a/src/mongo/installer/msi/wxs/LicensingFragment.wxs b/src/mongo/installer/msi/wxs/LicensingFragment.wxs index 7e2ff5ba8cf..ab3ca60414d 100644 --- a/src/mongo/installer/msi/wxs/LicensingFragment.wxs +++ b/src/mongo/installer/msi/wxs/LicensingFragment.wxs @@ -1,56 +1,56 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mongo/installer/msi/wxs/UIFragment.wxs b/src/mongo/installer/msi/wxs/UIFragment.wxs index 9978fcbc509..030606bfb5d 100644 --- a/src/mongo/installer/msi/wxs/UIFragment.wxs +++ b/src/mongo/installer/msi/wxs/UIFragment.wxs @@ -1,42 +1,61 @@ - - - - - - - - LicenseAccepted = "1" - WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete" - WixUI_InstallMode = "InstallCustom" - - - - - 1 - 1 - 1 - - - 1 - 1 - - - 1 - - - - 1 - - - - - - - - - - - - - - + + + + + + + + LicenseAccepted = "1" + WixUI_InstallMode = "InstallCustom" + + + + + + + 1 + 1 + 1 + + + 1 + 1 + + + 1 + + + + 1 + + + + + + + + + + + + + + + + + + WixUI_InstallMode = "InstallComplete" OR WixUI_InstallMode = "InstallTypical" + WixUI_InstallMode = "InstallCustom" + + + 1 + + + 1 + + + + Installing Compass... (this may take a few minutes) + + + -- cgit v1.2.1