Commit 88915a30 authored by Piotr Obrzut's avatar Piotr Obrzut Committed by Balasubramanian Kandasamy

Bug#26181622 MSI BUILD FAIL DUE TO DUPLICATED FILE ID

Fixed generated mysql_server.wxs not to contain duplicates, or too long ids

(cherry picked from commit bf47fb74dcc3e84057314817c56e6f8e05af094c)
parent bb9e547a
......@@ -218,22 +218,37 @@ MACRO(GENERATE_GUID VarName)
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDMACRO()
SET(INC_VAR 0)
# Make sure that WIX identifier created from a path matches all the rules:
# - it is shorter than 72 characters
# - doesn't contain reserver characters ('+', '-' and '/')
# ID_SET contains a global list of all identifiers which are too long.
# Every time we use an identifier which is too long we use its index in
# ID_SET to shorten the name.
SET_PROPERTY(GLOBAL PROPERTY ID_SET)
MACRO(MAKE_WIX_IDENTIFIER str varname)
STRING(REPLACE "/" "." ${varname} "${str}")
STRING(REPLACE "+" "p" ${varname} "${str}")
STRING(REPLACE "-" "m" ${varname} "${str}")
STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}")
STRING(LENGTH "${${varname}}" len)
# FIXME: the prefix length has to be controlled better
# Identifier should be smaller than 72 character
# We have to cut down the length to 70 chars, since we add 2 char prefix
# We have to cut down the length to 40 chars, since we add prefixes
# pretty often
IF(len GREATER 70)
STRING(SUBSTRING "${${varname}}" 0 67 shortstr)
MATH(EXPR INC_VAR ${INC_VAR}+1)
SET(${varname} "${shortstr}${INC_VAR}")
IF(len GREATER 40)
STRING(SUBSTRING "${${varname}}" 0 37 shortstr)
GET_PROPERTY(LOCAL_LIST GLOBAL PROPERTY ID_SET)
LIST(FIND LOCAL_LIST "${${varname}}" STRING_ID)
IF(${STRING_ID} EQUAL -1)
LIST(APPEND LOCAL_LIST "${${varname}}")
SET_PROPERTY(GLOBAL PROPERTY ID_SET "${LOCAL_LIST}")
LIST(LENGTH LOCAL_LIST STRING_ID)
MATH(EXPR STRING_ID "${STRING_ID}-1" )
ENDIF()
SET(${varname} "${shortstr}${STRING_ID}")
ENDIF()
ENDMACRO()
FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})
IF(dir_rel)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment