[CMake] Cmake/Cpack creates a corrupt .rpm

Gonzalo Garramuño ggarra13 at gmail.com
Thu May 30 11:51:04 EDT 2019


I have a CMakeLists.txt (extract) with the following commands:


SET(CPACK_GENERATOR DEB RPM TGZ )

# SET the installation directory.

SET(CPACK_SET_DESTDIR true) # Needed
SET(CPACK_INSTALL_PREFIX /usr/local/${mrViewerShortName})

SET(CPACK_RPM_PACKAGE_NAME mrViewer)
SET(CPACK_RPM_PACKAGE_RELOCATABLE false)


SET(  CPACK_RPM_POST_INSTALL_SCRIPT_FILE
     ${PROJECT_BINARY_DIR}/etc/Linux/install.sh)
SET( CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
     ${PROJECT_BINARY_DIR}/etc/Linux/uninstall.sh)


   SET(CPACK_PACKAGE_VENDOR "Film Aura, LLC")
   SET(CPACK_PACKAGE_VERSION_MAJOR ${VersionMajor})
   SET(CPACK_PACKAGE_VERSION_MINOR ${VersionMinor})
   SET(CPACK_PACKAGE_VERSION_PATCH ${VersionPatch})
   SET(CPACK_PACKAGE_VERSION "${SHORTVERSION}" )
   SET(CPACK_PACKAGE_FILE_NAME "${mrViewerPackageName}" )
   SET(CPACK_PACKAGE_CONTACT "ggarra13 at gmail.com")
   SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
       "mrViewer provides professional flipbook, audio and video playback.")


#SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY ${mrViewerPackageName} )
SET(CPACK_RESOURCE_FILE_LICENSE 
${PROJECT_SOURCE_DIR}/../../docs/LICENSE.txt)

SET( CPACK_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/BundleConfig.cmake" )
include(CPack)

ADD_CUSTOM_TARGET( bundle
                COMMAND "${CMAKE_CPACK_COMMAND}"
                "-C" "$<CONFIGURATION>"
                "--config" "${CMAKE_BINARY_DIR}/BundleConfig.cmake"
                COMMENT "Running CPack. Please wait..."
                USES_TERMINAL
                DEPENDS translations )

This creates a valid DEB file but an invalid RPM which fails with:

Running transaction
Preparing : 1/1
Running scriptlet: mrViewer-5.0.5.20190517-1.x86_64 1/1
Installing : mrViewer-5.0.5.20190517-1.x86_64 1/1
Error unpacking rpm package mrViewer-5.0.5.20190517-1.x86_64
error: unpacking of archive failed: cpio: read

Verifying : mrViewer-5.0.5.20190517-1.x86_64 1/1

Failed:
mrViewer-5.0.5.20190517-1.x86_64

Error: Transaction failed


You can find the RPM file here:

https://sourceforge.net/projects/mrviewer/files/v5.0.6/mrViewer-v5.0.6-Linux-64.rpm/download

If I use:

rpm -ql mrViewer-v5.0.6-Linux-64.rpm

all files are there.  However, when installing, the installer fails on 
reaching the lib directory of the rpm.

CMake/CPack used to build the rpm just fine some (long) versions ago 
with this same CMakeLists.txt.


-- 
Gonzalo Garramuño



More information about the CMake mailing list