Skip to content

Commit b4e3fb5

Browse files
Piotr Obrzutbkandasa
Piotr Obrzut
authored andcommitted
Merge branch 'mysql-5.5' into mysql-5.6
(cherry picked from commit 6ddc838acd11da6d43d2b86f2e73f0b7ebf125c2)
1 parent 7b57b15 commit b4e3fb5

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

packaging/WiX/create_msi.cmake.in

+22-7
Original file line numberDiff line numberDiff line change
@@ -218,22 +218,37 @@ MACRO(GENERATE_GUID VarName)
218218
OUTPUT_STRIP_TRAILING_WHITESPACE)
219219
ENDMACRO()
220220

221-
SET(INC_VAR 0)
221+
# Make sure that WIX identifier created from a path matches all the rules:
222+
# - it is shorter than 72 characters
223+
# - doesn't contain reserver characters ('+', '-' and '/')
224+
# ID_SET contains a global list of all identifiers which are too long.
225+
# Every time we use an identifier which is too long we use its index in
226+
# ID_SET to shorten the name.
227+
SET_PROPERTY(GLOBAL PROPERTY ID_SET)
222228
MACRO(MAKE_WIX_IDENTIFIER str varname)
223229
STRING(REPLACE "/" "." ${varname} "${str}")
230+
STRING(REPLACE "+" "p" ${varname} "${str}")
231+
STRING(REPLACE "-" "m" ${varname} "${str}")
224232
STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}")
225233
STRING(LENGTH "${${varname}}" len)
234+
# FIXME: the prefix length has to be controlled better
226235
# Identifier should be smaller than 72 character
227-
# We have to cut down the length to 70 chars, since we add 2 char prefix
236+
# We have to cut down the length to 40 chars, since we add prefixes
228237
# pretty often
229-
IF(len GREATER 70)
230-
STRING(SUBSTRING "${${varname}}" 0 67 shortstr)
231-
MATH(EXPR INC_VAR ${INC_VAR}+1)
232-
SET(${varname} "${shortstr}${INC_VAR}")
238+
IF(len GREATER 40)
239+
STRING(SUBSTRING "${${varname}}" 0 37 shortstr)
240+
GET_PROPERTY(LOCAL_LIST GLOBAL PROPERTY ID_SET)
241+
LIST(FIND LOCAL_LIST "${${varname}}" STRING_ID)
242+
IF(${STRING_ID} EQUAL -1)
243+
LIST(APPEND LOCAL_LIST "${${varname}}")
244+
SET_PROPERTY(GLOBAL PROPERTY ID_SET "${LOCAL_LIST}")
245+
LIST(LENGTH LOCAL_LIST STRING_ID)
246+
MATH(EXPR STRING_ID "${STRING_ID}-1" )
247+
ENDIF()
248+
SET(${varname} "${shortstr}${STRING_ID}")
233249
ENDIF()
234250
ENDMACRO()
235251

236-
237252
FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
238253
FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})
239254
IF(dir_rel)

0 commit comments

Comments
 (0)