11# This script validates the msi can be installed, uninstalled, and checks for the default install location and some of the possible install files
22import glob
33import os
4+ import re
45import subprocess
56import sys
67import tempfile
@@ -87,6 +88,8 @@ def validate_files(is_enterprise):
8788 print (f"File exists: { file_match [0 ]} " )
8889 if file_match [0 ].endswith (".exe" ):
8990 validate_help (file_match [0 ])
91+ if file_match [0 ].endswith ("mongod.exe" ):
92+ validate_version (file_match [0 ])
9093 else :
9194 print (f"Error: { file_path } could not be found." )
9295 sys .exit (1 )
@@ -102,6 +105,24 @@ def validate_help(exe_path):
102105 print (f"Error while calling help for { exe_path } : { e } " )
103106 sys .exit (1 )
104107
108+ # Make sure we have a proper git version in the windows release
109+ def validate_version (exe_path ):
110+ try :
111+ version_command = [exe_path , "--version" ]
112+ print (f"Calling '{ exe_path } ' with command: { ' ' .join (version_command )} ..." )
113+ result = subprocess .run (version_command , check = True , stdout = subprocess .PIPE , text = True )
114+ print (f"{ exe_path } called version successfully." )
115+ match = re .search ('.*"gitVersion": "[0-9a-fA-F]{40}".*' , result .stdout )
116+ if match :
117+ print ("Found a valid git version." )
118+ return
119+ else :
120+ print ("--version command did not contain a valid git version in gitVersion. Stdout:" )
121+ print (result .stdout )
122+ sys .exit (1 )
123+ except subprocess .CalledProcessError as e :
124+ print (f"Error while calling version for { exe_path } : { e } " )
125+ sys .exit (1 )
105126
106127def main ():
107128 if len (sys .argv ) != 2 :
0 commit comments