| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/python2.4 | |
| 2 # | |
| 3 # Copyright 2009-2010 Google Inc. | |
| 4 # | |
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 # you may not use this file except in compliance with the License. | |
| 7 # You may obtain a copy of the License at | |
| 8 # | |
| 9 # http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 # | |
| 11 # Unless required by applicable law or agreed to in writing, software | |
| 12 # distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 # See the License for the specific language governing permissions and | |
| 15 # limitations under the License. | |
| 16 # ======================================================================== | |
| 17 | |
| 18 Import('env') | |
| 19 | |
| 20 import binascii | |
| 21 import md5 | |
| 22 from enterprise.installer import build_enterprise_installer | |
| 23 | |
| 24 | |
| 25 def BuildMSI(version, namespace, exe_name, wxs_template, msi_base_name, | |
| 26 is_enterprise=False, prefix=''): | |
| 27 if is_enterprise: | |
| 28 msi_base_name = 'enterprise_' + msi_base_name | |
| 29 msi_base_name = prefix + msi_base_name | |
| 30 | |
| 31 # Have to use 'copy' here because we are renaming the file, and it is being | |
| 32 # renamed to match the final msi name to avoid collisions in the wixobj files. | |
| 33 copy_target = env.Command( | |
| 34 target=msi_base_name + '.wxs', | |
| 35 source=wxs_template, | |
| 36 action='@copy /y $SOURCE $TARGET', | |
| 37 ) | |
| 38 | |
| 39 PRODUCT_GUID = build_enterprise_installer.GenerateNameBasedGUID( | |
| 40 namespace, | |
| 41 'Product ' + version | |
| 42 ) | |
| 43 COMPONENT_GUID = build_enterprise_installer.GenerateNameBasedGUID( | |
| 44 namespace, | |
| 45 'Component ' + version | |
| 46 ) | |
| 47 COMPONENT_GUID_REGISTRY = build_enterprise_installer.GenerateNameBasedGUID( | |
| 48 namespace, | |
| 49 'Component Registry ' + version | |
| 50 ) | |
| 51 COMPONENT_GUID_NOTIFY_SUCCESS = ( | |
| 52 build_enterprise_installer.GenerateNameBasedGUID( | |
| 53 namespace, | |
| 54 'Component Notify Success ' + version | |
| 55 )) | |
| 56 COMPONENT_GUID_REGISTER_LAUNCH = ( | |
| 57 build_enterprise_installer.GenerateNameBasedGUID( | |
| 58 namespace, | |
| 59 'Component Register Launch Command ' + version | |
| 60 )) | |
| 61 COMPONENT_GUID_NOTIFY_FAILED = ( | |
| 62 build_enterprise_installer.GenerateNameBasedGUID( | |
| 63 namespace, | |
| 64 'Component Notify Failed ' + version | |
| 65 )) | |
| 66 COMPONENT_GUID_PROPERTY_BAR = ( | |
| 67 build_enterprise_installer.GenerateNameBasedGUID( | |
| 68 namespace, | |
| 69 'Component Property Bar ' + version | |
| 70 )) | |
| 71 | |
| 72 wix_env = env.Clone() | |
| 73 wix_env.Append( | |
| 74 WIXLIGHTFLAGS = [ | |
| 75 # Add a supress for: | |
| 76 # warning LGHT1076 : ICE91: The file will be installed to the per user | |
| 77 # directory that doesn't vary based on ALLUSERS value. This file won't | |
| 78 # be copied to each user's profile even if a per machine installation | |
| 79 # is desired. | |
| 80 # This warning is generated by light when we produce a user only | |
| 81 # installer, and can be ignored as this is a user only installer. | |
| 82 '-sw1076' | |
| 83 ], | |
| 84 WIXCANDLEFLAGS = [ | |
| 85 '-dFooExePath=' + wix_env.File(exe_name).abspath, | |
| 86 '-dFooVersion=' + version, | |
| 87 '-dFooProductGuid=' + PRODUCT_GUID, | |
| 88 '-dFooComponentGuid=' + COMPONENT_GUID, | |
| 89 '-dFooComponentGuidRegistry=' + COMPONENT_GUID_REGISTRY, | |
| 90 '-dFooComponentGuidNotifySuccess=' + COMPONENT_GUID_NOTIFY_SUCCESS, | |
| 91 '-dFooComponentRegisterLaunchCommand=' + | |
| 92 COMPONENT_GUID_REGISTER_LAUNCH, | |
| 93 '-dFooComponentGuidNotifyFailed=' + COMPONENT_GUID_NOTIFY_FAILED, | |
| 94 '-dFooComponentGuidPropertyBar=' + COMPONENT_GUID_PROPERTY_BAR, | |
| 95 ], | |
| 96 ) | |
| 97 | |
| 98 wix_inputs = copy_target | |
| 99 # Force a rebuild when the exe file changes. | |
| 100 additional_dependencies = [exe_name] | |
| 101 | |
| 102 if is_enterprise: | |
| 103 output_dir = '$TARGET_ROOT/Test_Installers' | |
| 104 wix_env['WIXCANDLEFLAGS'] += ['-dIsEnterprise=1'] | |
| 105 | |
| 106 # The metainstaller change does not get passed through even though the | |
| 107 # .wixobj file is rebuilt because the hash of the .wixobj does not change. | |
| 108 metainstaller_path = '$STAGING_DIR/%sGoogleUpdateSetup.exe' % (prefix) | |
| 109 google_update_wixobj = build_enterprise_installer.BuildGoogleUpdateFragment( | |
| 110 env, | |
| 111 metainstaller_path, | |
| 112 'Test Foo', | |
| 113 version, | |
| 114 '{D6B08267-B440-4c85-9F79-E195E80D9937}', | |
| 115 '&ap=enterprise', | |
| 116 msi_base_name, | |
| 117 ('$MAIN_DIR/enterprise/installer/' | |
| 118 'google_update_installer_fragment.wxs.xml') | |
| 119 ) | |
| 120 | |
| 121 wix_inputs += [google_update_wixobj] | |
| 122 additional_dependencies += [metainstaller_path] | |
| 123 else: | |
| 124 output_dir = '$TESTS_DIR' | |
| 125 wix_env['WIXCANDLEFLAGS'] += ['-dIsEnterprise=0'] | |
| 126 | |
| 127 unsigned_msi = wix_env.WiX('unsigned_%s.msi' % msi_base_name, wix_inputs) | |
| 128 | |
| 129 wix_env.Depends(unsigned_msi, additional_dependencies) | |
| 130 | |
| 131 signed_output = env.SignedBinary( | |
| 132 target=msi_base_name + '.msi', | |
| 133 source=unsigned_msi, | |
| 134 ) | |
| 135 | |
| 136 env.Replicate(output_dir, signed_output) | |
| 137 | |
| 138 _GUID_NAMESPACE = binascii.a2b_hex('BE19B3E4502845af8B3E67A99FCDCFB1') | |
| 139 _USER_GUID_NAMESPACE = binascii.a2b_hex('2B599C061F7C4eed9D686616EEBDDFDB') | |
| 140 | |
| 141 # test_foo.wxs.xml is so named because SCons tries to apply WiX building | |
| 142 # rules to any input file with the .wxs suffix even in a custom command. | |
| 143 _WXS_TEMPLATE_NAME = 'test_foo.wxs.xml' | |
| 144 _USER_WXS_TEMPLATE_NAME = 'user_app.wxs.xml' | |
| 145 | |
| 146 for (major, minor, build, patch) in [(1,0,101,0), (1,0,102,0)]: | |
| 147 version = '%d.%d.%d.%d' % (major, minor, build, patch) | |
| 148 msi_base_name = 'test_foo_v' + version | |
| 149 | |
| 150 ver_env = env.Clone() | |
| 151 ver_env.Append( | |
| 152 LIBS = [ | |
| 153 ('libcmt.lib', 'libcmtd.lib')[env.Bit('debug')], | |
| 154 ('libcpmt.lib', 'libcpmtd.lib')[env.Bit('debug')], | |
| 155 'version.lib', | |
| 156 ], | |
| 157 RCFLAGS = [ | |
| 158 '-DVERSION_STRING=%s' % version, | |
| 159 '-DMAJOR=%s' % major, | |
| 160 '-DMINOR=%s' % minor, | |
| 161 '-DBUILD=%s' % build, | |
| 162 '-DPATCH=%s' % patch | |
| 163 ], | |
| 164 ) | |
| 165 | |
| 166 ver_env['OBJPREFIX'] = '%s%s/' % (ver_env['OBJPREFIX'], version) | |
| 167 | |
| 168 base_name = 'test_foo_v%s' % version.replace('.', '_') | |
| 169 signed_target_name = base_name + '.exe' | |
| 170 target_name = base_name + '_unsigned' | |
| 171 | |
| 172 unsigned_exe = ver_env.ComponentTestProgram( | |
| 173 prog_name=target_name, | |
| 174 source=[ | |
| 175 'test_foo.cc', | |
| 176 ver_env.RES('test_foo_v%s.res' % version, 'test_foo.rc'), | |
| 177 ], | |
| 178 COMPONENT_TEST_RUNNABLE=False | |
| 179 ) | |
| 180 | |
| 181 signed_output = ver_env.SignedBinary( | |
| 182 target=signed_target_name, | |
| 183 source=unsigned_exe, | |
| 184 ) | |
| 185 | |
| 186 ver_env.Replicate('$TESTS_DIR', signed_output) | |
| 187 | |
| 188 signed_exe = signed_output[0] | |
| 189 | |
| 190 BuildMSI(version, _GUID_NAMESPACE, signed_exe, _WXS_TEMPLATE_NAME, | |
| 191 msi_base_name) | |
| 192 | |
| 193 # Build the enterprise installer for each version of Omaha. | |
| 194 for omaha_version_info in ver_env['omaha_versions_info']: | |
| 195 prefix = omaha_version_info.filename_prefix | |
| 196 | |
| 197 BuildMSI(version, _GUID_NAMESPACE, signed_exe, _WXS_TEMPLATE_NAME, | |
| 198 msi_base_name, is_enterprise=True, prefix=prefix) | |
| 199 | |
| 200 BuildMSI(version, _USER_GUID_NAMESPACE, signed_exe, _USER_WXS_TEMPLATE_NAME, | |
| 201 'user_app_v' + version) | |
| 202 | |
| 203 bar_env = env.Clone() | |
| 204 bar_env.Append( | |
| 205 LIBS = [ | |
| 206 ('libcmt.lib', 'libcmtd.lib')[env.Bit('debug')], | |
| 207 ('libcpmt.lib', 'libcpmtd.lib')[env.Bit('debug')], | |
| 208 ], | |
| 209 ) | |
| 210 bar_env.ComponentTestProgram(prog_name='test_bar', | |
| 211 source='test_bar.cc', | |
| 212 COMPONENT_TEST_RUNNABLE=False) | |
| 213 | |
| 214 | |
| 215 """ This is commented out because it step_test is currently unused, | |
| 216 and may be removed. Remove this if/when step_test is removed. | |
| 217 | |
| 218 omaha_system_env = env.Clone() | |
| 219 omaha_system_env.Append( | |
| 220 CPPDEFINES = [ | |
| 221 'UNICODE', | |
| 222 '_UNICODE' | |
| 223 ], | |
| 224 LIBS = [ | |
| 225 '$LIB_PATH/common.lib', | |
| 226 ('atls.lib', 'atlsd.lib')[env.Bit('debug')], | |
| 227 ('libcmt.lib', 'libcmtd.lib')[env.Bit('debug')], | |
| 228 ('libcpmt.lib', 'libcpmtd.lib')[env.Bit('debug')], | |
| 229 ], | |
| 230 ) | |
| 231 | |
| 232 | |
| 233 omaha_system_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS']) | |
| 234 omaha_system_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE'] | |
| 235 | |
| 236 omaha_system_env.ComponentTestProgram([ | |
| 237 'omaha_system_test.cc', | |
| 238 'step_test.cc', | |
| 239 ], | |
| 240 COMPONENT_TEST_RUNNABLE=False | |
| 241 ) | |
| 242 """ | |
| 243 | |
| OLD | NEW |