MantisBT - CMake | ||||||||||
View Issue Details | ||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||
0013451 | CMake | Modules | public | 2012-08-02 12:03 | 2013-01-09 10:54 | |||||
Reporter | Andy Piper | |||||||||
Assigned To | Eric NOULARD | |||||||||
Priority | normal | Severity | major | Reproducibility | always | |||||
Status | closed | Resolution | fixed | |||||||
Platform | Linux | OS | OS Version | |||||||
Product Version | CMake 2.8.8 | |||||||||
Target Version | CMake 2.8.10 | Fixed in Version | CMake 2.8.10 | |||||||
Summary | 0013451: RPMs created with CPackRPM.cmake should not include non-empty directories in their contents-list | |||||||||
Description | I am building RPM packages using the CPackRPM.cmake module. The RPMs have a default install prefix of "/opt/mycompany" and have been made relocatable like so: set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/mycompany") set(CPACK_PACKAGE_RELOCATABLE TRUE) The RPMs are relocatable because they are being installed into custom locations (using the --prefix option) by non-root users who have private RPM databases (see section 4 of http://www.nordugrid.org/documents/rpm_for_everybody.html [^]). This setup will allow us to install different versions of our components for development and maintenance work on a single machine, as required. When attempting to install our RPMs to custom locations as a non-root user using a command like this: rpm -ivh --prefix=/home/andy/workspace/myproject/contrib \ --dbpath=/home/andy/workspace/myproject/contrib/rpmdb \ mypackage-1.0.rpm ...the following error was reported: error: unpacking of archive failed on file /opt: cpio: chmod failed - Operation not permitted But I wasn't installing the RPM to /opt! So I looked at the content-list of the RPM created using CPackRPM.cmake (using "less <rpm-package>"), and saw that it began with: /opt /opt/mycompany /opt/mycompany/lib64 /opt/mycompany/lib64/libcomponent_one.so ...etc... (FYI, The path "/opt/mycompany" will be replaced by the --prefix option in the "rpm" command above) I then looked at at the content-list of another relocatable RPM with the same default install prefix, but this package had been created by hand using the "rpmbuild" command and a normal .spec file. The content-list in this RPM began with: /opt/mycompany/lib64/libcomponent_two.so ...etc... There were no entries to explicitly create non-empty directories, and this RPM *could* be installed to non-default locations by non-root users (with their fancy private RPM databases). This told me that the entries to create non-empty directories should not be present in the content-list: the RPM package-manager will handle these directories for you. This led me towards the "EXECUTE_PROCESS(COMMAND find . -type f ...)" call in CPackRPM.cmake which populates the content-list for the RPM being built. This command was searching from the "build root" directory (".") and was including non-empty directories in its output. After changing the search to start at the install-prefix directory ("./${CPACK_PACKAGING_INSTALL_PREFIX}") and ignoring non-empty directories, the RPM-installation issue was resolved. So the fix is to change the "find" command from this: find . -type f -o -type l -o (-type d -a -not -name ".") to this: find ./${CPACK_PACKAGING_INSTALL_PREFIX} -type f -o -type l -o (-type d -a -not -name "." -a -empty) I have attached a patch with this fix. | |||||||||
Steps To Reproduce | Build any RPM using CPackRPM.cmake and examine the file-list using "less <rpm-package>". The content-list will begin with a series of one or more non-empty directories, when it should begin with the first file (or intentionally empty directory) | |||||||||
Additional Information | Fix has been tested on SLES 11.2 and OpenSUSE 12.1 | |||||||||
Tags | No tags attached. | |||||||||
Relationships |
| |||||||||
Attached Files | CPackRPM.cmake.patch (1,285) 2012-08-02 12:03 https://public.kitware.com/Bug/file/4412/CPackRPM.cmake.patch CPackRPM.cmake.patch2 (1,276) 2012-08-02 12:09 https://public.kitware.com/Bug/file/4413/CPackRPM.cmake.patch2 CPackRPM.cmake.relocatable-prefix.patch (1,926) 2012-08-06 12:47 https://public.kitware.com/Bug/file/4419/CPackRPM.cmake.relocatable-prefix.patch | |||||||||
Issue History | ||||||||||
Date Modified | Username | Field | Change | |||||||
2012-08-02 12:03 | Andy Piper | New Issue | ||||||||
2012-08-02 12:03 | Andy Piper | File Added: CPackRPM.cmake.patch | ||||||||
2012-08-02 12:08 | Andy Piper | Note Added: 0030158 | ||||||||
2012-08-02 12:09 | Andy Piper | File Added: CPackRPM.cmake.patch2 | ||||||||
2012-08-02 12:22 | Eric NOULARD | Assigned To | => Eric NOULARD | |||||||
2012-08-02 12:22 | Eric NOULARD | Status | new => assigned | |||||||
2012-08-03 05:01 | Eric NOULARD | Relationship added | related to 0012305 | |||||||
2012-08-03 05:09 | Eric NOULARD | Note Added: 0030161 | ||||||||
2012-08-06 05:42 | Andy Piper | Note Added: 0030171 | ||||||||
2012-08-06 08:01 | Eric NOULARD | Note Added: 0030172 | ||||||||
2012-08-06 08:15 | Andy Piper | Note Added: 0030173 | ||||||||
2012-08-06 08:33 | Eric NOULARD | Note Added: 0030174 | ||||||||
2012-08-06 12:47 | Andy Piper | File Added: CPackRPM.cmake.relocatable-prefix.patch | ||||||||
2012-08-06 12:48 | Andy Piper | Note Added: 0030176 | ||||||||
2012-08-07 03:42 | Eric NOULARD | Note Added: 0030180 | ||||||||
2012-08-07 04:49 | Andy Piper | Note Added: 0030181 | ||||||||
2012-08-07 13:21 | Eric NOULARD | Platform | => Linux | |||||||
2012-08-07 13:21 | Eric NOULARD | Target Version | => CMake 2.8.10 | |||||||
2012-08-07 13:21 | Eric NOULARD | Note Added: 0030183 | ||||||||
2012-08-07 13:21 | Eric NOULARD | Status | assigned => resolved | |||||||
2012-08-07 13:21 | Eric NOULARD | Fixed in Version | => CMake 2.8.10 | |||||||
2012-08-07 13:21 | Eric NOULARD | Resolution | open => fixed | |||||||
2013-01-09 10:54 | Robert Maynard | Note Added: 0032010 | ||||||||
2013-01-09 10:54 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|