MantisBT - CMake
View Issue Details
0014714CMakeCPackpublic2014-01-21 04:162016-06-10 14:21
Frank-Christian Otto 
Domen Vrankar 
normalminorN/A
closedfixed 
CMake 2.8.12.1 
CMake 3.6 
0014714: CPack doesn't allow to create RPM with other user/group than root/root
In my local version I added a new CPack variable to be used like this in CMakeLists.txt:

set(CPACK_RPM_FILES_DEFATTR "(0644,myuser,mygroup,0755)")

if not set the default setting (-,root,root,-) will be applied (as before).

Suggested Patch for Modules/CPackRPM.cmake attached below
--- CPackRPM.cmake 2014-01-20 13:26:36.578308592 +0100
+++ CPackRPM.cmake~ 2013-11-05 20:07:22.000000000 +0100
@@ -207,12 +207,6 @@
 # rpm -qp --scripts package.rpm
 ##end
 ##variable
-# CPACK_RPM_FILES_DEFATTR
-# Mandatory : NO
-# Default : (-,root,root,-)
-# May be used to provide specific %defattr() settings to the generated spec file
-##end
-##variable
 # CPACK_RPM_USER_FILELIST
 # CPACK_RPM_<COMPONENT>_USER_FILELIST
 # Mandatory : NO
@@ -898,11 +892,6 @@
   set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE})
 endif()

-# Set %defattr(-,root,root,-) unless there is a user provided string
-if(NOT CPACK_RPM_FILES_DEFATTR)
- set(CPACK_RPM_FILES_DEFATTR "(-,root,root,-)")
-endif()
-
 # We should generate a USER spec file template:
 # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
 # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE
@@ -970,7 +959,7 @@
 \@CPACK_RPM_SPEC_PREUNINSTALL\@

 %files
-%defattr${CPACK_RPM_FILES_DEFATTR}
+%defattr(-,root,root,-)
 \@CPACK_RPM_INSTALL_FILES\@
 \@CPACK_RPM_ABSOLUTE_INSTALL_FILES\@
 \@CPACK_RPM_USER_INSTALL_FILES\@
No tags attached.
related to 0003602closed Brad King Add possibility to change file owner into install macro 
txt patch.txt (1,212) 2014-01-21 11:52
https://public.kitware.com/Bug/file/5048/patch.txt
Issue History
2014-01-21 04:16Frank-Christian OttoNew Issue
2014-01-21 11:52Frank-Christian OttoFile Added: patch.txt
2014-01-21 11:54Frank-Christian OttoNote Added: 0034983
2015-01-07 16:01Domen VrankarAssigned To => Domen Vrankar
2015-01-07 16:01Domen VrankarStatusnew => assigned
2015-01-15 14:56Brad KingRelationship addedrelated to 0003602
2015-01-15 15:04Brad KingNote Added: 0037706
2016-03-31 13:26Domen VrankarNote Added: 0040783
2016-03-31 13:26Domen VrankarStatusassigned => resolved
2016-03-31 13:26Domen VrankarFixed in Version => CMake 3.6
2016-03-31 13:26Domen VrankarResolutionopen => fixed
2016-06-10 14:21Kitware RobotNote Added: 0041208
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0034983)
Frank-Christian Otto   
2014-01-21 11:54   
I create the patch the wrong way. (so the '-' and '+' markers must be exchanged).
corrected patch now attached as file
(0037706)
Brad King   
2015-01-15 15:04   
Relevant mailing list thread:

 [PATCH] Setting default user, group and permissions for CPackRPM
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/12089 [^]
(0040783)
Domen Vrankar   
2016-03-31 13:26   
Implemented with patch:
https://cmake.org/gitweb?p=cmake.git;a=commit;h=1fe004e [^]

This patch is for setting of default user, group and file/directory permissions as requested in report - the requirement that I came across most of the time. I'll open a new feature request for the per file/directory permissions setting.
(0041208)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.