Search code examples
cmakedebcpack

CPACK_DEBIAN_<component>_PACKAGE_CONTROL_EXTRA gets ignored


I am trying to build deb packages for a cmake project. This project (foundationdb - but that is probably not relevant for this question) contains two components and I want to build two packages for it. However, this does not seem to work well. Specifically it seems that additions to the control archive are ignored. This is my current cpack configuration:

set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
# clients
set(CPACK_DEBIAN_clients_PACKAGE_CONTROL_STRICT_PERMISSION ON)
set(CPACK_DEBIAN_clients_PACKAGE_SECTION "database")
set(CPACK_DEBIAN_clients_PACKAGE_DEPENDS "adduser, libc6 (>= 2.11)")
set(CPACK_DEBIAN_clients_PACKAGE_HOMEPAGE "https://www.foundationdb.org")
set(CPACK_DEBIAN_clients_PACKAGE_CONTROL_EXTRA
  ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-clients/postinst)

set(CPACK_DEBIAN_server_PACKAGE_CONTROL_STRICT_PERMISSION ON)
set(CPACK_DEBIAN_server_PACKAGE_SECTION "database")
set(CPACK_DEBIAN_server_PACKAGE_DEPENDS "adduser, libc6 (>= 2.11), python (>= 2.6)")
set(CPACK_DEBIAN_server_PACKAGE_CONTROL_EXTRA
  ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/conffiles
  ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/preinst
  ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/postinst
  ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/prerm
  ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/postrm)

However, when I build the packages with cpack dpkg -I on the server package gives me the following output (the output for the client looks very similar and this package has the same problem):

new Debian package, version 2.0.
size 376987382 bytes: control archive=1088 bytes.
    265 bytes,     9 lines      control
   1864 bytes,    27 lines      md5sums
Package: foundationdb
Version: 6.0.0
Section: devel
Priority: optional
Architecture: amd64
Installed-Size: 1240492
Maintainer: The FoundationDB Community
Description: FoundationDB is a scalable, fault-tolerant, ordered key-value store with full ACID transactions.

This means the control files are missing. This means that the scripts are not ran during install and uninstall.

I already checked that the variables are set correctly in CPackConfig.cmake and when I build one package instead of components adding extras seems to work fine.

Is there anything I am missing here? I am using cmake version 3.10.2


Solution

  • After trying several things I found online and adding I finally found the problem. The component name has to be all upper-case. So for example this line

    set(CPACK_DEBIAN_server_PACKAGE_CONTROL_EXTRA
      ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/conffiles
      ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/preinst
      ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/postinst
      ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/prerm
      ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/postrm)
    

    has to be

    set(CPACK_DEBIAN_SERVER_PACKAGE_CONTROL_EXTRA
      ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/conffiles
      ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/preinst
      ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/postinst
      ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/prerm
      ${CMAKE_SOURCE_DIR}/packaging/deb/DEBIAN-foundationdb-server/postrm)
    

    I couldn't see this in the documentation and this does not matter for the CPackRPM - but it might very well be that I am just a bit blind...