Merge topic 'cpack-deb-component-depends'

4f3b9706 CPack/Deb prevent accidental component dependencies
This commit is contained in:
Brad King 2016-05-24 13:54:00 -04:00 committed by CMake Topic Stage
commit 384de98709
4 changed files with 27 additions and 14 deletions

View File

@ -11,7 +11,8 @@ cpack-deb-imporvements
* The :module:`CPackDeb` module learned how to generate dependencies between
Debian packages if multi-component setup is used and
:variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables are set.
This breaks compatibility with previous versions.
For backward compatibility this feature is disabled by default. See
:variable:`CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS`.
* The :module:`CPackDeb` module learned how to set the package release number
(``DebianRevisionNumber`` in package file name). See

View File

@ -100,6 +100,13 @@
#
# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)")
#
# .. variable:: CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS
#
# Sets inter component dependencies if listed with
# :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables.
#
# * Mandatory : NO
# * Default : -
#
# .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER
#
@ -713,20 +720,23 @@ function(cpack_deb_prepare_package_vars)
endif()
endif()
endforeach()
set(COMPONENT_DEPENDS "")
foreach (_PACK ${CPACK_COMPONENT_${_local_component_name}_DEPENDS})
get_component_package_name(_PACK_NAME "${_PACK}")
if(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS)
set(COMPONENT_DEPENDS "")
foreach (_PACK ${CPACK_COMPONENT_${_local_component_name}_DEPENDS})
get_component_package_name(_PACK_NAME "${_PACK}")
if(COMPONENT_DEPENDS)
set(COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION}), ${COMPONENT_DEPENDS}")
else()
set(COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION})")
endif()
endforeach()
if(COMPONENT_DEPENDS)
set(COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION}), ${COMPONENT_DEPENDS}")
else()
set(COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION})")
endif()
endforeach()
if(COMPONENT_DEPENDS)
if(CPACK_DEBIAN_PACKAGE_DEPENDS)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${COMPONENT_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
else()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${COMPONENT_DEPENDS}")
if(CPACK_DEBIAN_PACKAGE_DEPENDS)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${COMPONENT_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
else()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${COMPONENT_DEPENDS}")
endif()
endif()
endif()
endif()

View File

@ -4,6 +4,7 @@
if(CPACK_GENERATOR MATCHES "DEB")
set(CPACK_DEB_COMPONENT_INSTALL "ON")
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS "ON")
endif()
#

View File

@ -4,6 +4,7 @@
if(CPACK_GENERATOR MATCHES "DEB")
set(CPACK_DEB_COMPONENT_INSTALL "ON")
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS "ON")
endif()
#