MantisBT - CMake
View Issue Details
0015209CMakeCPackpublic2014-10-16 09:102016-01-04 11:51
Luc J. Bourhis 
Domen Vrankar 
normalminoralways
closedfixed 
CMake 2.8.12.2 
CMake 3.3CMake 3.3 
0015209: RPM generation chokes on directory symlinks with latest rpmbuild
As stated here (https://bugzilla.redhat.com/show_bug.cgi?id=1005529 [^]), the following specs file is no more legal as of rpmbuild 4.11

%files
%dir xxx
yyy/

when xxx or yyy are directory symlinks instead of proper directories. Unfortunately CPack has not been taught that and it generates %dir xxx for a directory symlink xxx.
Using the CMakeLists.txt attached to this bug report, issue "make package", on a Linux machine with rpmbuild 4.11 (I tested with Fedora 20). You should get the following error message:

error: Not a directory: /home/luc/Developer/sandbox/build/_CPack_Packages/Linux/RPM/it-will-fail-0.1.1-Linux/usr/usr/share/test/project/subdir
    Not a directory: /home/luc/Developer/sandbox/build/_CPack_Packages/Linux/RPM/it-will-fail-0.1.1-Linux/usr/usr/share/test/project/subdir
No tags attached.
txt CMakeLists.txt (487) 2014-10-16 09:10
https://public.kitware.com/Bug/file/5277/CMakeLists.txt
patch CPackRPM.cmake.patch (564) 2014-10-17 08:22
https://public.kitware.com/Bug/file/5278/CPackRPM.cmake.patch
patch 0001-CPackRPM-handling-of-symbolic-links.patch (12,666) 2014-11-08 16:03
https://public.kitware.com/Bug/file/5290/0001-CPackRPM-handling-of-symbolic-links.patch
Issue History
2014-10-16 09:10Luc J. BourhisNew Issue
2014-10-16 09:10Luc J. BourhisFile Added: CMakeLists.txt
2014-10-17 08:22Alex RettigFile Added: CPackRPM.cmake.patch
2014-10-17 08:23Alex RettigNote Added: 0037040
2014-10-17 08:29Brad KingAssigned To => Domen Vrankar
2014-10-17 08:29Brad KingStatusnew => assigned
2014-10-17 08:42Brad KingTarget Version => CMake 3.2
2014-11-08 16:03Domen VrankarFile Added: 0001-CPackRPM-handling-of-symbolic-links.patch
2014-11-08 16:07Domen VrankarNote Added: 0037165
2015-01-19 10:56Brad KingNote Added: 0037742
2015-02-04 15:37Brad KingTarget VersionCMake 3.2 => CMake 3.3
2015-03-31 14:11Brad KingNote Added: 0038374
2015-03-31 14:11Brad KingStatusassigned => resolved
2015-03-31 14:11Brad KingResolutionopen => fixed
2015-03-31 14:11Brad KingFixed in Version => CMake 3.3
2016-01-04 11:51Robert MaynardNote Added: 0040083
2016-01-04 11:51Robert MaynardStatusresolved => closed

Notes
(0037040)
Alex Rettig   
2014-10-17 08:23   
I just ran into the same problem.

The solution is easy: in CPackRPM.cmake there is a check, whether a file IS_DIRECTORY, then a %dir entry is created in the SPEC file. But the file must not be considered as directory (thus no %dir prepended to the entry), if also IS_SYMLINK.

The attached patch CPackRPM.cmake.patch fixes the issue. It fits to the according file as of version 3.0.2 of CMake.

Please consider it for integration to the repository.
(0037165)
Domen Vrankar   
2014-11-08 16:07   
The patch only solves problems with directory packages but does not check if a symbolic link is created in a way that it can be relocated for relocatable packages.

I have written a more extensive patch that also tries to create symbolic links as relocatable as possible.

Attached patch: 0001-CPackRPM-handling-of-symbolic-links.patch
(0037742)
Brad King   
2015-01-19 10:56   
Re 0015209:0037165: Thanks. Please look at extending the test suite to cover this case.
(0038374)
Brad King   
2015-03-31 14:11   
The change has been applied along with test cases:

 CPackRPM: Add basic symlink support
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=681f3a2f [^]
(0040083)
Robert Maynard   
2016-01-04 11:51   
Closing resolved issues that have not been updated in more than 4 months.