The following issue has been SUBMITTED. ====================================================================== http://public.kitware.com/Bug/view.php?id=13451 ====================================================================== Reported By: Andy Piper Assigned To: ====================================================================== Project: CMake Issue ID: 13451 Category: Modules Reproducibility: always Severity: major Priority: normal Status: new ====================================================================== Date Submitted: 2012-08-02 12:03 EDT Last Modified: 2012-08-02 12:03 EDT ====================================================================== Summary: 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 ====================================================================== 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 ====================================================================== -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers