Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,922
    • Issues 3,922
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 11
    • Merge requests 11
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Merge requests
  • !6825

CPack/productbuild: add options to control domains element

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged David Wosk requested to merge davidwosk1/cmake:cpack-pkg-domains into master Dec 22, 2021
  • Overview 4
  • Commits 1
  • Pipelines 2
  • Changes 4

Summary

According to the documentation for the Distribution.xml file, the auth attribute in the pkg-ref element is deprecated. Instead, the domains element is the preferred way to determine the required authorization level needed for the install. Removing auth="Admin" allows package developers to create installers that do not require root privileges when installing to the user's home directory.

Remedy

Introduce a CPACK_PRODUCTBUILD_DOMAINS option that, when set, outputs the domains element to the Distribution XML and omits the auth attribute of the pkg-ref element. The attributes of the domains element are able to be overridden via the CPACK_PRODUCTBUILD_DOMAINS_ANYWHERE, CPACK_PRODUCTBUILD_USER, and ``CPACK_PRODUCTBUILD_ROOT` options.

Rundown

  1. Source/CPack/cmCPackPKGGenerator.cxx:
    1. L.165/R: After writing the component groups to the Distribution XML, make a call to this->CreateDomains() which handles appending the domains element to the XML. I suppose this could be moved elsewhere (such as before writing the component groups). I just chose this line as a starting point.
    2. LL.279-81/R: If the CPACK_PRODUCTBUILD_DOMAINS option is set and truthy, then omit the auth attribute of the pkg-ref element.
    3. LL.296-98/R: If the CPACK_PRODUCTBUILD_DOMAINS option is not set or falsy, then omit the domains element. This ensures the default behavior for projects is to not insert the domains element (opt-in only).
    4. LL.305-19/R: Handle setting the 3 attributes (enable_anywhere, enable_currentUserHome, and enable_localSystem). Allow defaults to be overridden via attribute-specific options.
  2. Various documentation related changes.

Testing

In downstream project, ran the following:

  1. Do not specify CPACK_PRODUCTBUILD_DOMAINS

    Observation: domains element not written to Distribution XML

  2. Specify set(CPACK_PRODUCTBUILD_DOMAINS TRUE)

    Observation:

    <domains enable_anywhere="true" enable_currentUserHome="false" enable_localSystem="true"/>
  3. Specify set(CPACK_PRODUCTBUILD_DOMAINS TRUE) and set(CPACK_PRODUCTBUILD_DOMAINS_USER TRUE)

    Observation:

    <domains enable_anywhere="true" enable_currentUserHome="true" enable_localSystem="true"/>
  4. Specify various combinations of above.

In (2) and (3), the auth attribute was also omitted from pkg-ref.


Fixes: #23030 (closed)

Edited Jan 06, 2022 by Brad King
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: cpack-pkg-domains