Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,229
    • Issues 3,229
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 12
    • Merge Requests 12
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #21832

Closed
Open
Opened Feb 18, 2021 by Alex Reinking@alexreinking

CPack Deb lacks a way to configure copyright files by component

When doing a componentized CPack build with multiple trees (ie. via CPACK_INSTALL_CMAKE_PROJECTS) it is not possible to externally manage the copyright files. Ubuntu/Debian policy, enforced by lintian, requires that every package have a /usr/share/doc/<package-name>/copyright file, but adding install() calls directly to the project presumes a component-name-to-package-name mapping. If you're trying to package multiple components together in a group, you're out of luck.

I propose creating variables CPACK_DEBIAN_RESOURCE_FILE_LICENSE and CPACK_DEBIAN_<COMPONENT>_RESOURCE_FILE_LICENSE that configure their target files to the mandated path (/usr/share/doc/<package-name>/copyright). They could take their default value from CPACK_RESOURCE_FILE_LICENSE (with a policy) or do nothing if not set.

It would be especially useful if the copyright files could be configured with packaging variables available: @CPACK_PACKAGE_NAME@, @CPACK_PACKAGE_CONTACT@, @CPACK_DEBIAN_PACKAGE_HOMEPAGE@, etc.


I'm currently hacking around this with a pre-build script (CPACK_PRE_BUILD_SCRIPTS) that looks like:

cmake_minimum_required(VERSION 3.19)

foreach(comp IN LISTS CPACK_COMPONENTS_ALL)
  string(TOUPPER "CPACK_DEBIAN_${comp}_PACKAGE_NAME" package_name_var)
  string(TOLOWER "${${package_name_var}}" package_name)
  set(copyright_dir "${CPACK_TEMPORARY_DIRECTORY}/${comp}/usr/share/doc/${package_name}")
  configure_file("${CPACK_RESOURCE_FILE_LICENSE}" "${copyright_dir}/copyright" 
                 @ONLY NO_SOURCE_PERMISSIONS)
endforeach()

Of course this works for me only because I happen to know all the intermediate variables exist.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: cmake/cmake#21832