Attached is a patch to improve the handling of %directives in 
CPACK_RPM_USER_FILELIST.  Specifically it accepts any characters (even spaces) 
inside the parenthesis so it doesn't need to keep changing every time there's a 
new valid symbol.  The current open ticket is 
https://gitlab.kitware.com/cmake/cmake/issues/13468 which is asking to use an 
underscore.  %caps requires the use of '+' and also spaces.


I've created a merge request here: 
https://gitlab.kitware.com/cmake/cmake/merge_requests/23? with the same 
contents as this format-patch, but the contribution guidelines say a 
format-patch to this list is desired.


Cheers,

-Andrew??
From 13717c3943e11848233f6c8e95ee69ba3bda3ec1 Mon Sep 17 00:00:00 2001
From: Andrew Fuller <aful...@teradici.com>
Date: Fri, 24 Jun 2016 10:45:40 -0700
Subject: [PATCH] Adjust the regex to handle %foo and %foo(anything)
 directives.

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 issue #14362
---
 Modules/CPackRPM.cmake | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index d231ff0..cb8cdc8 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -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}>")
-- 
2.7.4

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to