Skip to content

Commit

Permalink
MDEV-26579 Support minor MSI in Windows installer.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vaintroub committed Jan 25, 2024
1 parent 1070575 commit 0f59810
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmake/mysql_version.cmake
Expand Up @@ -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")
Expand Down
10 changes: 9 additions & 1 deletion win/packaging/create_msi.cmake
Expand Up @@ -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})
Expand All @@ -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()
Expand Down Expand Up @@ -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}
)
Expand Down

0 comments on commit 0f59810

Please sign in to comment.