CPackRPM: Handle directives of form %foo and %foo(anything)

Directives that are legal inside the %files section of an RPM spec may
contain a variety of characters particularly when specifying %caps which
can include +, _, and space.  Watch for parenthesis to determine what
forms the prefix vs. path.

Fixes #14362.
This commit is contained in:
Andrew Fuller 2016-06-24 10:45:40 -07:00 committed by Brad King
parent f05657de9d
commit a351edd245
1 changed files with 2 additions and 2 deletions

View File

@ -1683,8 +1683,8 @@ function(cpack_rpm_generate_package)
set(CPACK_RPM_USER_INSTALL_FILES "")
foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL)
string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F})
string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F})
string(REGEX REPLACE "%[A-Za-z]+(\\([^()]*\\))? " "" F_PATH ${F})
string(REGEX MATCH "%[A-Za-z]+(\\([^()]*\\))?" F_PREFIX ${F})
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>")