def BuildEnterpriseInstallerFromStandaloneInstaller( env, product_name, product_version, product_guid, product_custom_params, product_uninstaller_additional_args, product_installer_data, standalone_installer_path, custom_action_dll_path, msi_base_name, enterprise_installer_dir, output_dir='$STAGING_DIR'): """Build an installer for use in enterprise situations. Builds an MSI around the supplied standalone installer. This MSI is intended to enable enterprise installation scenarios while being as close to a normal install as possible. It does not suffer from the separation of Omaha and application install like the other methods do. This method only works for installers that do not use an MSI. Args: env: environment to build with product_name: name of the product being built product_version: product version to be installed product_guid: product's Omaha application ID product_custom_params: custom values to be appended to the Omaha tag product_uninstaller_additional_args: extra command line parameters that the custom action dll will pass on to the product uninstaller, typically you'll want to pass any extra arguments that will force the uninstaller to run silently here. product_installer_data: installer data to be passed to the product installer at run time. This is useful as an alternative to the product_installer_install_command parameter accepted by BuildEnterpriseInstaller() since command line parameters can't be passed to the product installer when it is wrapped in a standalone installer. standalone_installer_path: path to product's standalone installer custom_action_dll_path: path to the custom action dll that exports a ShowInstallerResultUIString and ExtractTagInfoFromInstaller methods. ShowInstallerResultUIString reads the LastInstallerResultUIString from the product's ClientState key in the registry and display the string via MsiProcessMessage. ExtractTagInfoFromInstaller extracts brand code from tagged MSI package. msi_base_name: root of name for the MSI enterprise_installer_dir: path to dir which contains enterprise_standalone_installer.wxs.xml output_dir: path to the directory that will contain the resulting MSI Returns: Target nodes. Raises: Nothing. """ product_name_legal_identifier = product_name.replace(' ', '') msi_name = msi_base_name + '.msi' msi_product_version = ei_utils.ConvertToMSIVersionNumberIfNeeded( product_version) omaha_installer_namespace = ei_utils.GetInstallerNamespace() # Include the .msi filename in the Product Code generation because "the # product code must be changed if... the name of the .msi file has been # changed" according to http://msdn.microsoft.com/en-us/library/aa367850.aspx. # Also include the version number since we process version changes as major # upgrades. msi_product_id = ei_utils.GenerateNameBasedGUID( omaha_installer_namespace, 'Product %s %s %s' % (product_name, msi_base_name, product_version) ) msi_upgradecode_guid = ei_utils.GenerateNameBasedGUID( omaha_installer_namespace, 'Upgrade ' + product_name ) # To allow for multiple versions of the same product to be generated, # stick output in a subdirectory. output_directory_name = product_guid + '.' + product_version copy_target = env.Command( target=output_directory_name + msi_base_name + '.wxs', source=(enterprise_installer_dir + '/enterprise_standalone_installer.wxs.xml'), action='@copy /y $SOURCE $TARGET', ) wix_env = env.Clone() wix_candle_flags = ei_utils.GetWixCandleFlags( product_name, product_name_legal_identifier, msi_product_version, product_version, '"%s"' % product_guid, product_custom_params=product_custom_params, standalone_installer_path=str(env.File(standalone_installer_path).abspath), custom_action_dll_path=str(env.File(custom_action_dll_path).abspath), product_uninstaller_additional_args=product_uninstaller_additional_args, msi_product_id=msi_product_id, msi_upgradecode_guid=msi_upgradecode_guid, product_installer_data=product_installer_data) wix_env.Append( WIXCANDLEFLAGS=wix_candle_flags, WIXLIGHTFLAGS=ei_utils.GetWixLightFlags() ) wix_output = wix_env.WiX( target = output_directory_name + '/' + 'unsigned_' + msi_name, source = [copy_target], ) # Force a rebuild when the standalone installer changes. # The metainstaller change does not get passed through even though the .wixobj # file is rebuilt because the hash of the .wixobj does not change. # Also force a dependency on the CA DLL. Otherwise, it might not be built # before the MSI. wix_env.Depends(wix_output, [standalone_installer_path, custom_action_dll_path]) sign_output = wix_env.SignedBinary( target=output_directory_name + '/' + msi_name, source=wix_output, ) return env.Replicate(output_dir + '/' + output_directory_name, sign_output)
def OmahaBuildTestMsi(env, version, namespace, exe_name, wxs_template, msi_base_name, prefix=''): """Builds a test MSI from an exe. Returns: Output node list from env.Command(). """ msi_base_name = prefix + msi_base_name # Have to use 'copy' here because we are renaming the file, and it is being # renamed to match the final msi name to avoid collisions in the wixobj files. copy_target = env.Command( target=msi_base_name + '.wxs', source=wxs_template, action='@copy /y $SOURCE $TARGET', ) PRODUCT_GUID = ei_utils.GenerateNameBasedGUID(namespace, 'Product ' + version) COMPONENT_GUID = ei_utils.GenerateNameBasedGUID(namespace, 'Component ' + version) COMPONENT_GUID_REGISTRY = ei_utils.GenerateNameBasedGUID( namespace, 'Component Registry ' + version) COMPONENT_GUID_NOTIFY_SUCCESS = (ei_utils.GenerateNameBasedGUID( namespace, 'Component Notify Success ' + version)) COMPONENT_GUID_REGISTER_LAUNCH = (ei_utils.GenerateNameBasedGUID( namespace, 'Component Register Launch Command ' + version)) COMPONENT_GUID_NOTIFY_FAILED = (ei_utils.GenerateNameBasedGUID( namespace, 'Component Notify Failed ' + version)) COMPONENT_GUID_PROPERTY_BAR = (ei_utils.GenerateNameBasedGUID( namespace, 'Component Property Bar ' + version)) wix_env = env.Clone() wix_env.Append( WIXLIGHTFLAGS=[ # Add a supress for: # warning LGHT1076 : ICE91: The file will be installed to the per user # directory that doesn't vary based on ALLUSERS value. This file won't # be copied to each user's profile even if a per machine installation # is desired. # This warning is generated by light when we produce a user only # installer, and can be ignored as this is a user only installer. '-sw1076' ], WIXCANDLEFLAGS=[ '-dFooExePath=' + wix_env.File(exe_name).abspath, '-dFooVersion=' + version, '-dFooProductGuid=' + PRODUCT_GUID, '-dFooComponentGuid=' + COMPONENT_GUID, '-dFooComponentGuidRegistry=' + COMPONENT_GUID_REGISTRY, '-dFooComponentGuidNotifySuccess=' + COMPONENT_GUID_NOTIFY_SUCCESS, '-dFooComponentRegisterLaunchCommand=' + COMPONENT_GUID_REGISTER_LAUNCH, '-dFooComponentGuidNotifyFailed=' + COMPONENT_GUID_NOTIFY_FAILED, '-dFooComponentGuidPropertyBar=' + COMPONENT_GUID_PROPERTY_BAR, ], ) wix_inputs = copy_target wix_env['WIXCANDLEFLAGS'] += ['-dIsEnterprise=0'] unsigned_msi = wix_env.WiX('unsigned_%s.msi' % msi_base_name, wix_inputs) # Force a rebuild when the exe file changes. wix_env.Depends(unsigned_msi, [exe_name]) # Single-signed here because it is not possible to dual-sign an msi. signed_output = env.SignedBinary( target=msi_base_name + '.msi', source=unsigned_msi, ) return signed_output
def _BuildMsiForExe(env, product_name, product_version, product_guid, product_installer_path, product_installer_install_command, product_installer_disable_update_registration_arg, product_uninstaller_additional_args, msi_base_name, google_update_wixobj_output, enterprise_installer_dir, custom_action_dll_path, metainstaller_path, output_dir): """Build an MSI installer for use in enterprise situations. Builds an MSI for the executable installer at product_installer_path using the supplied details. Requires an existing Google Update installer fragment as well as a path to a custom action DLL containing the logic to launch the product's uninstaller. This is intended to enable enterprise installation scenarios. Args: env: environment to build with product_name: name of the product being built product_version: product version to be installed product_guid: product's Omaha application ID product_installer_path: path to specific product installer product_installer_install_command: command line args used to run product installer in 'install' mode product_installer_disable_update_registration_arg: command line args used to run product installer in 'do not register' mode product_uninstaller_additional_args: extra command line parameters that the custom action dll will pass on to the product uninstaller, typically you'll want to pass any extra arguments that will force the uninstaller to run silently here. msi_base_name: root of name for the MSI google_update_wixobj_output: the MSI fragment containing the Omaha installer. enterprise_installer_dir: path to dir which contains enterprise_installer.wxs.xml custom_action_dll_path: path to the custom action dll that exports a ShowInstallerResultUIString and ExtractTagInfoFromInstaller methods. ShowInstallerResultUIString reads the LastInstallerResultUIString from the product's ClientState key in the registry and display the string via MsiProcessMessage. ExtractTagInfoFromInstaller extracts brand code from tagged MSI package. metainstaller_path: path to the Omaha metainstaller. Should be same file used for google_update_wixobj_output. Used only to force rebuilds. output_dir: path to the directory that will contain the resulting MSI Returns: Nothing. Raises: Nothing. """ product_name_legal_identifier = product_name.replace(' ', '') msi_name = msi_base_name + '.msi' msi_product_version = ei_utils.ConvertToMSIVersionNumberIfNeeded( product_version) omaha_installer_namespace = ei_utils.GetInstallerNamespace() # Include the .msi filename in the Product Code generation because "the # product code must be changed if... the name of the .msi file has been # changed" according to http://msdn.microsoft.com/en-us/library/aa367850.aspx. msi_product_id = ei_utils.GenerateNameBasedGUID( omaha_installer_namespace, 'Product %s %s' % (product_name, msi_base_name) ) msi_upgradecode_guid = ei_utils.GenerateNameBasedGUID( omaha_installer_namespace, 'Upgrade ' + product_name ) copy_target = env.Command( target=msi_base_name + '.wxs', source=enterprise_installer_dir + '/enterprise_installer.wxs.xml', action='@copy /y $SOURCE $TARGET', ) wix_env = env.Clone() wix_env.Append( WIXCANDLEFLAGS=ei_utils.GetWixCandleFlags( product_name, product_name_legal_identifier, msi_product_version, product_version, product_guid, custom_action_dll_path=str(env.File(custom_action_dll_path).abspath), product_uninstaller_additional_args=product_uninstaller_additional_args, msi_product_id=msi_product_id, msi_upgradecode_guid=msi_upgradecode_guid, product_installer_path=str(env.File(product_installer_path).abspath), product_installer_install_command=product_installer_install_command, product_installer_disable_update_registration_arg=( product_installer_disable_update_registration_arg)), WIXLIGHTFLAGS=ei_utils.GetWixLightFlags() ) wix_output = wix_env.WiX( target='unsigned_' + msi_name, source=[copy_target, google_update_wixobj_output], ) # Force a rebuild when the installer or metainstaller changes. # The metainstaller change does not get passed through even though the .wixobj # file is rebuilt because the hash of the .wixobj does not change. # Also force a dependency on the CA DLL. Otherwise, it might not be built # before the MSI. wix_env.Depends(wix_output, [product_installer_path, metainstaller_path, custom_action_dll_path]) sign_output = wix_env.SignedBinary( target=msi_name, source=wix_output, ) env.Replicate(output_dir, sign_output)