From 0f59810b9944929d2b3ffb64f6d197cf9a20e358 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 10 Sep 2021 02:20:16 +0200 Subject: [PATCH] MDEV-26579 Support minor MSI in Windows installer. With this patch, 4-component MSI version can be used, e.g by setting TINY_VERSION variable in CMake, or by adding a string, e.g MYSQL_VERSION_EXTRA=-2 which sets TINY_VERSION to 2, and also changes the package name. The 4-component MSI versions do not support MSI major upgrades, only minor ones, i.e do not reinstall components, just update existing ones based on versioning rules. To support these rules, add DefaultVersion for the files that won't otherwise be versioned - headers, static and import libraries, pdbs, text - xml, python and perl scripts Also silence WiX warning that MSI won't store hashes for those files anymore. --- cmake/mysql_version.cmake | 4 +++- win/packaging/create_msi.cmake | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index cb12bf14b86f1..2924d6a0096a7 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -55,7 +55,9 @@ IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR NOT "${PATCH_VERSION}" MATCHES "[0-9]+") MESSAGE(FATAL_ERROR "VERSION file cannot be parsed.") ENDIF() - + IF((NOT TINY_VERSION) AND (EXTRA_VERSION MATCHES "[\\-][0-9]+")) + STRING(REPLACE "-" "" TINY_VERSION "${EXTRA_VERSION}") + ENDIF() SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}") MESSAGE(STATUS "MariaDB ${VERSION}") SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version") diff --git a/win/packaging/create_msi.cmake b/win/packaging/create_msi.cmake index f992915cd22c3..1b6f66d0f2c5a 100644 --- a/win/packaging/create_msi.cmake +++ b/win/packaging/create_msi.cmake @@ -248,6 +248,13 @@ FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root) FILE(APPEND ${file} "\n") SET(NONEXEFILES) + FOREACH(v MAJOR_VERSION MINOR_VERSION PATCH_VERSION TINY_VERSION) + IF(NOT ${v}) + MESSAGE(FATAL_ERROR "${v} is not set") + ENDIF() + ENDFOREACH() + SET(default_version "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}.${TINY_VERSION}") + FOREACH(f ${all_files}) IF(NOT IS_DIRECTORY ${f}) FILE(RELATIVE_PATH rel ${topdir} ${f}) @@ -267,6 +274,7 @@ FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root) FILE(APPEND ${file} " ${${id}.COMPONENT_CONDITION}\n") ENDIF() FILE(APPEND ${file} " \n${${id}.FILE_EXTRA}") ELSE() @@ -396,7 +404,7 @@ ENDIF() EXECUTE_PROCESS( COMMAND ${LIGHT_EXECUTABLE} -v -ext WixUIExtension -ext WixUtilExtension - -ext WixFirewallExtension -sice:ICE61 ${SILENCE_VCREDIST_MSM_WARNINGS} + -ext WixFirewallExtension -sice:ICE61 -sw1103 ${SILENCE_VCREDIST_MSM_WARNINGS} mysql_server.wixobj extra.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi ${EXTRA_LIGHT_ARGS} )