Browse Source

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`.  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.
Fix the variable name.

Fixes: #22410
Alex Turbov 4 năm trước cách đây
mục cha
commit
805fa791d1
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      Modules/Internal/CPack/CPackDeb.cmake

+ 1 - 1
Modules/Internal/CPack/CPackDeb.cmake

@@ -673,7 +673,7 @@ function(cpack_deb_prepare_package_vars)
   if(CPACK_ADD_LDCONFIG_CALL)
     set(CPACK_DEBIAN_GENERATE_POSTINST 1)
     set(CPACK_DEBIAN_GENERATE_POSTRM 1)
-    foreach(f IN LISTS PACKAGE_CONTROL_EXTRA)
+    foreach(f IN LISTS CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA)
       get_filename_component(n "${f}" NAME)
       if(n STREQUAL "postinst")
         set(CPACK_DEBIAN_GENERATE_POSTINST 0)