Skip to content

CPack/DEB: Avoid overriding user-provided `postinst` and `postrm`

When a user provides CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA or CPACK_DEBIAN_<comp>_PACKAGE_CONTROL_EXTRA variables in CMakeLists.txt and the package contains dynamic libraries, the CPackDeb.cmake sets CPACK_ADD_LDCONFIG_CALL to 1 (line 699). Later it analyzes if defaulted postinst/postrm should be generated trying to check if the user provides any in CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA variable. However, the foreach loop uses the invalid variable PACKAGE_CONTROL_EXTRA instead, so these files gonna be overridden, cuz CPACK_DEBIAN_GENERATE_POSTINST and CPACK_DEBIAN_GENERATE_POSTRM preset to 1 right before the loop, which is never executed.

Fixes: #22410 (closed)
Backport: release
Topic-rename: cpack-deb-post-ops

Edited by Brad King

Merge request reports