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.
This commit is contained in:
Vladislav Vaintroub 2021-09-10 02:20:16 +02:00 committed by Vladislav Vaintroub
parent 1070575a89
commit 0f59810b99
2 changed files with 12 additions and 2 deletions

View file

@ -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")

View file

@ -248,6 +248,13 @@ FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
FILE(APPEND ${file} "<DirectoryRef Id='${DirectoryRefId}'>\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} " <Condition>${${id}.COMPONENT_CONDITION}</Condition>\n")
ENDIF()
FILE(APPEND ${file} " <File Id='F.${id}' KeyPath='yes' Source='${f_native}'")
FILE(APPEND ${file} " DefaultVersion='${default_version}' DefaultLanguage='1033'")
IF(${id}.FILE_EXTRA)
FILE(APPEND ${file} ">\n${${id}.FILE_EXTRA}</File>")
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}
)