Clean up CMake packaging code in preparation for migrating RPM packaging to CPack. #17590
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR can largely be described as two related but mostly distinct sets of changes.
The first change is a mass rename and restructure of
packaging/cmake/control
. This covers all the changes inCMakeLists.txt
and all the renames, and is needed to simplify differentiation of what package type each file is involved with (since the RPM packages will need completely different pre/post install/remove scripts, among other things). I expect this part to be non-controversial, but it’s included as part of this PR simply because it is a hard requirement for a few parts of the other set of changes and it is logically part of the same cleanup.The second change is a conversion of the Packaging module from a long series of variable defines to a custom function used to declare each package. The idea here is to decouple the large amount of boilerplate code involved in defining each package component from the actual information involved in defining each component.
A significant percentage of the work needed for adding RPM packages involves defining an almost identical set of variables to those used for DEB packages, with only trivial differences between the values. CPack technically provides some handling for this, but it’s woefully insufficient for our actual needs, and it does not cover large parts of what will otherwise be nearly duplicate code that could be programmatically handled instead.
Because of this, the shift to using a custom function to declare each package will significantly simplify the changes needed to add RPM support, and should also significantly reduce the long-term maintenance burden for the packaging code, as well as making it much easier to add a new package and have it just work for both DEB and RPM packages.
In addition to these two primary changes, this PR also does some cleanup of the dependencies for our native packages:
Test Plan
Preliminary testing involves checking that the set of packages that gets built is the same before and after this PR. Supplementary checking is required to confirm that the package control files are the same (barring the dependency changes mentioned above).