[CMake] CPackRPM.cmake patch

Erwan Legrand elegrand at cloudmark.com
Thu May 6 13:59:20 EDT 2010


Hi,

I'm currently trying to solve a two problems with the RPM generator:
  * Lack of support for file names containing spaces
  * Lack of support for %config and %config(noreplace)

I'm yet to succeed. I tried to fix the call to sed to enclose file names 
between double quotes. It's not working as expected. I suspect I might 
have missed a backslash somewhere.

As for the %config support, it works well as long as I specify only one 
file. I believe I would need to add a %config line for each file. 
Unfortunately don't know how to achieve this with CMake macros.

Any help is of course welcome. Here are my changes:

--- ./CPackRPM.cmake.orig	2010-05-06 19:52:00.000000000 +0200
+++ ./CPackRPM.cmake	2010-05-06 19:16:15.000000000 +0200
@@ -410,8 +410,8 @@
  # We must remove the './' due to the local search (thus the sed)
  # Then we must authorize any man pages extension (adding * at the end)
  # because rpmbuild may automatically compress those files
-EXECUTE_PROCESS(COMMAND find -type f -o -type l
-               COMMAND sed {s/\\.//}
+EXECUTE_PROCESS(COMMAND find . -type f -o -type l
+               COMMAND sed {s/^\\.\\(.*\\)\$/\"\\1\"/}
                 COMMAND sed {s/.*man.*\\/.*/&*/}
                 WORKING_DIRECTORY 
"${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
                 OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES)
@@ -498,8 +498,8 @@
  %files
  %defattr(-,root,root,-)
  \@TMP_RPM_SPEC_CONFIG\@
-\@TMP_RPM_SPEC_CONFIG_RENAME\@
-${CPACK_RPM_INSTALL_FILES}
+\@TMP_RPM_SPEC_CONFIG_NOREPLACE\@
+\@CPACK_RPM_INSTALL_FILES\@

  %changelog
  * Sat Nov 28 2009 Erk <eric.noulard at gmail.com>

-- 
Erwan Legrand
Sr. Software Engineer
Gateway Technology
Cloudmark


More information about the CMake mailing list