Recently, I need to ensure that our software can be packaged with cpack for RHEL 7 and its free rebuilds (like CentOS 7). However, I had a problem that did not exist for RHEL 6.x and its free changes: the RPMs that cpack generate all have the following elements in their %files system directories:
%dir %attr(0755, root, root) "/" %dir %attr(0755, root, root) "/usr" %dir %attr(0755, root, root) "/usr/bin" %dir %attr(0755, root, root) "/usr/share" %dir %attr(0755, root, root) "/usr/share/applications" %dir %attr(0755, root, root) "/usr/share/doc" %dir %attr(0755, root, root) "/usr/share/icons" %dir %attr(0755, root, root) "/usr/share/icons/hicolor" %dir %attr(0755, root, root) "/usr/share/icons/hicolor/scalable" %dir %attr(0755, root, root) "/usr/share/icons/hicolor/scalable/apps"enter code here
which should not be declared as a package.
AFAIK, this requirement has been used in the RPM specification for many years, but only in the latest RPM versions (i.e. newer than 4.8.0) does it apply. Since RHEL 7 communicates with RPM 4.11.1, now that cpack creates a conflict with filesystem-3.2-18.el7.x86_64 with errors, as shown below during yum install ... :
file / from install of tunesviwer-1.4-2.noarch conflicts with file from package filesystem-3.2-18.el7.x86_64 file /usr/bin from install of tunesviewer-1.4-2.noarch conflicts with file from package filesystem-3.2-18.el7.x86_64 [...]
I tried using a small cmake module consisting of the following:
set(CPACK_RPM_SPEC_MORE_DEFINE "%define ignore \#") set(CPACK_RPM_USER_FILELIST "%ignore /" "%ignore /usr" "%ignore /usr/bin" "%ignore /usr/share" "%ignore /usr/share/applications" "%ignore /usr/share/doc" "%ignore/usr/share/icons" "%ignore /usr/share/icons/hicolor" "%ignore /usr/share/icons/hicolor/scalable" "%ignore /usr/share/icons/hicolor/scalable/apps")
and enable it immediately before CMakeLists.txt include(CPack) . But the generated RPM still contains these system directories :(
As a temporary transition, I used the file conflict hint to install the package with the file system , that is, using the rpmrebuild utility to delete these system directory entries in the %files section. Obviously, this is not a problem at all.
Has anyone found a better way?