CPack/Deb: enable per component setting of dependencies
This commit is contained in:
parent
f281c6214b
commit
4de7c8126b
|
@ -0,0 +1,12 @@
|
|||
cpack-deb-component-dependencies
|
||||
--------------------------------
|
||||
|
||||
* The :module:`CPackDeb` module learned to set package dependencies
|
||||
per component. See :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS`,
|
||||
:variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES`,
|
||||
:variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS`,
|
||||
:variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS`,
|
||||
:variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES`,
|
||||
:variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES`,
|
||||
:variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS` and
|
||||
:variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS`.
|
|
@ -78,6 +78,7 @@
|
|||
#
|
||||
# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)")
|
||||
#
|
||||
#
|
||||
# .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER
|
||||
#
|
||||
# The Debian package maintainer
|
||||
|
@ -164,6 +165,7 @@
|
|||
# * Default : -
|
||||
#
|
||||
# .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS
|
||||
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS
|
||||
#
|
||||
# Sets the `Pre-Depends` field of the Debian package.
|
||||
# Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it
|
||||
|
@ -172,11 +174,16 @@
|
|||
# pre-dependency.
|
||||
#
|
||||
# * Mandatory : NO
|
||||
# * Default : -
|
||||
# * Default :
|
||||
#
|
||||
# - An empty string for non-component based installations
|
||||
# - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based
|
||||
# installations.
|
||||
#
|
||||
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
|
||||
#
|
||||
# .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES
|
||||
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES
|
||||
#
|
||||
# Sets the `Enhances` field of the Debian package.
|
||||
# Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works
|
||||
|
@ -184,11 +191,16 @@
|
|||
# functionality of another package.
|
||||
#
|
||||
# * Mandatory : NO
|
||||
# * Default : -
|
||||
# * Default :
|
||||
#
|
||||
# - An empty string for non-component based installations
|
||||
# - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based
|
||||
# installations.
|
||||
#
|
||||
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
|
||||
#
|
||||
# .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS
|
||||
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS
|
||||
#
|
||||
# Sets the `Breaks` field of the Debian package.
|
||||
# When a binary package (P) declares that it breaks other packages (B),
|
||||
|
@ -199,12 +211,17 @@
|
|||
# packages (B) cannot be reconfigured again.
|
||||
#
|
||||
# * Mandatory : NO
|
||||
# * Default : -
|
||||
# * Default :
|
||||
#
|
||||
# - An empty string for non-component based installations
|
||||
# - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based
|
||||
# installations.
|
||||
#
|
||||
# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks
|
||||
#
|
||||
#
|
||||
# .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
|
||||
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS
|
||||
#
|
||||
# Sets the `Conflicts` field of the Debian package.
|
||||
# When one binary package declares a conflict with another using a `Conflicts`
|
||||
|
@ -212,7 +229,11 @@
|
|||
# the same time.
|
||||
#
|
||||
# * Mandatory : NO
|
||||
# * Default : -
|
||||
# * Default :
|
||||
#
|
||||
# - An empty string for non-component based installations
|
||||
# - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based
|
||||
# installations.
|
||||
#
|
||||
# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts
|
||||
#
|
||||
|
@ -225,48 +246,68 @@
|
|||
# time.
|
||||
#
|
||||
# .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES
|
||||
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES
|
||||
#
|
||||
# Sets the `Provides` field of the Debian package.
|
||||
# A virtual package is one which appears in the `Provides` control field of
|
||||
# another package.
|
||||
#
|
||||
# * Mandatory : NO
|
||||
# * Default : -
|
||||
# * Default :
|
||||
#
|
||||
# - An empty string for non-component based installations
|
||||
# - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based
|
||||
# installations.
|
||||
#
|
||||
# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual
|
||||
#
|
||||
#
|
||||
# .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
|
||||
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES
|
||||
#
|
||||
# Sets the `Replaces` field of the Debian package.
|
||||
# Packages can declare in their control file that they should overwrite
|
||||
# files in certain other packages, or completely replace other packages.
|
||||
#
|
||||
# * Mandatory : NO
|
||||
# * Default : -
|
||||
# * Default :
|
||||
#
|
||||
# - An empty string for non-component based installations
|
||||
# - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based
|
||||
# installations.
|
||||
#
|
||||
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
|
||||
#
|
||||
#
|
||||
# .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS
|
||||
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS
|
||||
#
|
||||
# Sets the `Recommends` field of the Debian package.
|
||||
# Allows packages to declare a strong, but not absolute, dependency on other
|
||||
# packages.
|
||||
#
|
||||
# * Mandatory : NO
|
||||
# * Default : -
|
||||
# * Default :
|
||||
#
|
||||
# - An empty string for non-component based installations
|
||||
# - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based
|
||||
# installations.
|
||||
#
|
||||
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
|
||||
#
|
||||
#
|
||||
# .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
|
||||
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS
|
||||
#
|
||||
# Sets the `Suggests` field of the Debian package.
|
||||
# Allows packages to declare a suggested package install grouping.
|
||||
#
|
||||
# * Mandatory : NO
|
||||
# * Default : -
|
||||
# * Default :
|
||||
#
|
||||
# - An empty string for non-component based installations
|
||||
# - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based
|
||||
# installations.
|
||||
#
|
||||
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
|
||||
#
|
||||
|
@ -496,18 +537,21 @@ function(cpack_deb_prepare_package_vars)
|
|||
# You should set: DEBIAN_PACKAGE_DEPENDS
|
||||
# TODO: automate 'objdump -p | grep NEEDED'
|
||||
|
||||
# if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_DEPENDS
|
||||
# if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_${dependency_type_}
|
||||
# automatic dependency discovery will be performed afterwards.
|
||||
if(CPACK_DEB_PACKAGE_COMPONENT)
|
||||
set(_component_depends_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_DEPENDS")
|
||||
foreach(dependency_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES)
|
||||
set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${dependency_type_}")
|
||||
|
||||
# if set, overrides the global dependency
|
||||
if(DEFINED ${_component_depends_var})
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${${_component_depends_var}}")
|
||||
if(DEFINED ${_component_var})
|
||||
set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${${_component_var}}")
|
||||
if(CPACK_DEBIAN_PACKAGE_DEBUG)
|
||||
message("CPackDeb Debug: component '${_local_component_name}' dependencies set to '${CPACK_DEBIAN_PACKAGE_DEPENDS}'")
|
||||
message("CPackDeb Debug: component '${_local_component_name}' ${dependency_type_}"
|
||||
"dependencies set to '${CPACK_DEBIAN_PACKAGE_${dependency_}}'")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# at this point, the CPACK_DEBIAN_PACKAGE_DEPENDS is properly set
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function(checkDepends_ FILE REGEX)
|
||||
function(checkDependencies_ FILE REGEX)
|
||||
set(whitespaces_ "[\t\n\r ]*")
|
||||
|
||||
getPackageInfo("${FILE}" "FILE_INFO_")
|
||||
|
@ -7,9 +7,28 @@ function(checkDepends_ FILE REGEX)
|
|||
endif()
|
||||
endfunction()
|
||||
|
||||
checkDepends_("${FOUND_FILE_1}" ".*Depends${whitespaces_}:${whitespaces_}depend-application, depend-application-b.*")
|
||||
# use wildcard as we are using dependency auto detection
|
||||
checkDepends_("${FOUND_FILE_2}" ".*Depends${whitespaces_}:${whitespaces_}.*depend-application, depend-application-b.*")
|
||||
checkDepends_("${FOUND_FILE_3}" ".*Depends${whitespaces_}:${whitespaces_}depend-headers.*")
|
||||
checkDepends_("${FOUND_FILE_4}" ".*Depends${whitespaces_}:${whitespaces_}depend-default, depend-default-b.*")
|
||||
checkDepends_("${FOUND_FILE_5}" ".*Depends${whitespaces_}:${whitespaces_}depend-default, depend-default-b.*")
|
||||
foreach(dependency_type_ DEPENDS CONFLICTS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS)
|
||||
string(TOLOWER "${dependency_type_}" lower_dependency_type_)
|
||||
string(SUBSTRING ${lower_dependency_type_} 1 -1 lower_dependency_type_tail_)
|
||||
string(SUBSTRING ${dependency_type_} 0 1 dependency_type_head_)
|
||||
set(dependency_type_name_ "${dependency_type_head_}${lower_dependency_type_tail_}")
|
||||
|
||||
checkDependencies_("${FOUND_FILE_1}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b.*")
|
||||
checkDependencies_("${FOUND_FILE_2}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}.*${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b.*")
|
||||
checkDependencies_("${FOUND_FILE_3}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-headers.*")
|
||||
checkDependencies_("${FOUND_FILE_4}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b.*")
|
||||
checkDependencies_("${FOUND_FILE_5}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b.*")
|
||||
endforeach()
|
||||
|
||||
checkDependencies_("${FOUND_FILE_1}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
|
||||
checkDependencies_("${FOUND_FILE_2}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
|
||||
checkDependencies_("${FOUND_FILE_3}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
|
||||
checkDependencies_("${FOUND_FILE_4}" ".*Provides${whitespaces_}:${whitespaces_}provided-lib.*")
|
||||
checkDependencies_("${FOUND_FILE_5}" ".*Provides${whitespaces_}:${whitespaces_}provided-lib_auto.*, provided-lib_auto-b.*")
|
||||
|
||||
# PREDEPENDS
|
||||
checkDependencies_("${FOUND_FILE_1}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-application, predepends-application-b.*")
|
||||
checkDependencies_("${FOUND_FILE_2}" ".*Pre-Depends${whitespaces_}:${whitespaces_}.*predepends-application, predepends-application-b.*")
|
||||
checkDependencies_("${FOUND_FILE_3}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-headers.*")
|
||||
checkDependencies_("${FOUND_FILE_4}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-default, predepends-default-b.*")
|
||||
checkDependencies_("${FOUND_FILE_5}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-default, predepends-default-b.*")
|
||||
|
|
|
@ -7,9 +7,15 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS FALSE)
|
|||
# to determine their dependencies and we can not be certain if there will be any
|
||||
set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_SHLIBDEPS TRUE)
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "depend-default, depend-default-b")
|
||||
set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_DEPENDS "depend-application, depend-application-b")
|
||||
set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_DEPENDS "depend-application, depend-application-b")
|
||||
set(CPACK_DEBIAN_HEADERS_PACKAGE_DEPENDS "depend-headers")
|
||||
foreach(dependency_type_ DEPENDS CONFLICTS PREDEPENDS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS)
|
||||
string(TOLOWER "${dependency_type_}" lower_dependency_type_)
|
||||
|
||||
# TODO add other dependency tests once CPackDeb supports them
|
||||
set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b")
|
||||
set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b")
|
||||
set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b")
|
||||
set(CPACK_DEBIAN_HEADERS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-headers")
|
||||
endforeach()
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_PROVIDES "provided-default, provided-default-b")
|
||||
set(CPACK_DEBIAN_LIBS_PACKAGE_PROVIDES "provided-lib")
|
||||
set(CPACK_DEBIAN_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b")
|
||||
|
|
Loading…
Reference in New Issue