[cmake-developers] [CMake 0011944]: CPackDeb: Support dependencies between components/Debian packages

Raffi Enficiaud raffi.enficiaud at mines-paris.org
Fri Apr 24 11:10:25 EDT 2015


Le 22/04/15 08:01, Domen Vrankar a écrit :
> 2015-04-21 23:38 GMT+02:00 Raffi Enficiaud <raffi.enficiaud at mines-paris.org>:
>> Le 21/04/15 23:01, Domen Vrankar a écrit :
>>>
>
> There are a few other things to change though.
> Take a look at CPackRPM man page:
> http://www.cmake.org/cmake/help/v3.2/module/CPackRPM.html?highlight=cpack%20rpm
>
> There is an explanation at the top that component variables override
> non component variables and then each non component and component
> variable is explained at the same time - without this the man page
> will get even longer as it already is without a good reason. Please
> change the way you wrote the documentation for your component
> variables.
>
> Also put the text:
> # The value of `CPACK_DEBIAN_<COMP>_PACKAGE_DEPENDS` can be set to an
> empty string
> #  to enable the automatic discovery of dependencies without inheriting from
> #  the default value of :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`.
>
> inside a Note so that it will be more visible.
>
> Thanks,
> Domen
>

Hi,

Please find attached a patch for the reworked documentation. I tried to 
make the doc more consistent with the CPackRPM (doc right after the 
variable declaration and options afterwards).
I also put links for the variables and changed the formatting a bit.

There are a couple of things though:
- the variable CPACK_PACKAGE_CONTACT does not exist anywhere in the code
- right now, the CPACK_COMPONENT_<COMP>_DESCRIPTION is used as an 
equivalent to the CPACK_DEBIAN_PACKAGE_DESCRIPTION per component. If I 
follow the RPM conventions, those would be called 
CPACK_DEBIAN_<COMP>_PACKAGE_DESCRIPTION, which I find also better. 
However, in that case, should it default to 
CPACK_COMPONENT_<COMP>_DESCRIPTION or to 
CPACK_DEBIAN_PACKAGE_DESCRIPTION? In fact 
CPACK_COMPONENT_<COMP>_DESCRIPTION and 
CPACK_DEBIAN_<COMP>_PACKAGE_DESCRIPTION would have the same purpose and 
I think that it will not be obvious for the user to cope with all those 
variables.

Best,
Raffi
-------------- next part --------------
From 870d8e9e1041daf46a89f061eacd36690286687f Mon Sep 17 00:00:00 2001
From: Raffi Enficiaud <raffi.enficiaud at mines-paris.org>
Date: Fri, 24 Apr 2015 17:03:47 +0200
Subject: [PATCH] CPackDeb: reworked documentation

---
 Modules/CPackDeb.cmake | 224 +++++++++++++++++++++++++++++--------------------
 1 file changed, 134 insertions(+), 90 deletions(-)

diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 07cd1bc..869941c 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -15,214 +15,258 @@
 # the build system.
 #
 # CPackDeb has specific features which are controlled by the specifics
-# CPACK_DEBIAN_XXX variables.You'll find a detailed usage on the wiki:
-# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
+# :code:`CPACK_DEBIAN_XXX` variables. 
 #
+# :code:`CPACK_DEBIAN_<COMP>_XXXX` variables may be used in order to have
+# **component** specific values.  Note however that <COMP> refers
+# to the **grouping name**.  This may be either a component name or a
+# component GROUP name.
+#
+# You'll find a detailed usage on the wiki:
+# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 .
 # However as a handy reminder here comes the list of specific variables:
 #
+#
 # .. variable:: CPACK_DEBIAN_PACKAGE_NAME
 #
+#  The debian package summary
+#
 #  * Mandatory : YES
-#  * Default   : CPACK_PACKAGE_NAME (lower case)
+#  * Default   : :variable:`CPACK_PACKAGE_NAME` (lower case)
 #
-#  The debian package summary
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_VERSION
 #
+#  The debian package version
+#
 #  * Mandatory : YES
-#  * Default   : CPACK_PACKAGE_VERSION
+#  * Default   : :variable:`CPACK_PACKAGE_VERSION`
 #
-#  The debian package version
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE
 #
+#  The debian package architecture
+#
 #  * Mandatory : YES
-#  * Default   : Output of dpkg --print-architecture (or i386 if dpkg is not found)
+#  * Default   : Output of :code:`dpkg --print-architecture` (or :code:`i386`
+#    if :code:`dpkg` is not found)
 #
-#  The debian package architecture
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS
+#               CPACK_DEBIAN_<COMP>_PACKAGE_DEPENDS
+#
+#  May be used to set deb dependencies.
 #
 #  * Mandatory : NO
-#  * Default   : -
+#  * Default   :
 #
-#  May be used to set deb dependencies.
+#    - An empty string for non-component based installations
+#    - :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS` for component-based
+#      installations.
 #
-# .. variable:: CPACK_DEBIAN_<COMP>_PACKAGE_DEPENDS
+#  .. note::
 #
-#  * Mandatory : NO
-#  * Default   : :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`
+#    If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or
+#    more specifically :variable:`CPACK_DEBIAN_<COMP>_PACKAGE_SHLIBDEPS` is
+#    set for this component, the discovered dependencies will be appended
+#    to :variable:`CPACK_DEBIAN_<COMP>_PACKAGE_DEPENDS` intead of
+#    :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If
+#    :variable:`CPACK_DEBIAN_<COMP>_PACKAGE_DEPENDS` is an empty string, only
+#    the automatically discovered dependencies will be set for this component.
+#
+#  Example::
+#
+#    set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)")
 #
-#  Indicates the debian package dependencies for a specific component 'COMP'.
-#  This value has priority over :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If
-#  :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` is set, then the discovered
-#  dependencies will be appended to `CPACK_DEBIAN_<COMP>_PACKAGE_DEPENDS` if set
-#  (intead of `CPACK_DEBIAN_PACKAGE_DEPENDS`).
-#  The value of `CPACK_DEBIAN_<COMP>_PACKAGE_DEPENDS` can be set to an empty string
-#  to enable the automatic discovery of dependencies without inheriting from
-#  the default value of :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`.
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER
 #
+#  The debian package maintainer
+#
 #  * Mandatory : YES
-#  * Default   : CPACK_PACKAGE_CONTACT
+#  * Default   : :code:`CPACK_PACKAGE_CONTACT`
 #
-#  The debian package maintainer
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION
-#
-#  * Mandatory : YES
-#  * Default   : CPACK_PACKAGE_DESCRIPTION_SUMMARY
+#               CPACK_COMPONENT_<COMP>_DESCRIPTION
 #
 #  The debian package description
 #
-# .. variable:: CPACK_COMPONENT_<COMP>_DESCRIPTION
+#  * Mandatory : YES
+#  * Default   :
 #
-#  * Mandatory : NO
-#  * Default   : CPACK_DEBIAN_PACKAGE_DESCRIPTION
+#    - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` for non-component based
+#      installation
+#    - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` for component-based
+#      installation
 #
-#  The debian package description for a specific component 'COMP'.
-#  This description has priority over the other descriptions given by
-#  :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` and
-#  :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`.
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_SECTION
 #
 #  * Mandatory : YES
 #  * Default   : 'devel'
 #
+#
 # .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
 #
+#  The compression used for creating the Debian package.
+#  Possible values are: lzma, xz, bzip2 and gzip.
+#
 #  * Mandatory : YES
 #  * Default   : 'gzip'
 #
-#     Possible values are: lzma, xz, bzip2 and gzip.
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
 #
+#  The debian package priority
+#
 #  * Mandatory : YES
 #  * Default   : 'optional'
 #
-#  The debian package priority
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE
 #
-#  * Mandatory : NO
-#  * Default   : -
-#
 #  The URL of the web site for this package, preferably (when applicable) the
 #  site from which the original source can be obtained and any additional
 #  upstream documentation or information may be found.
-#  The content of this field is a simple URL without any surrounding
-#  characters such as <>.
+#
+#  * Mandatory : NO
+#  * Default   : -
+#
+#  .. note::
+#
+#    The content of this field is a simple URL without any surrounding
+#    characters such as <>.
+#
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS
+#               CPACK_DEBIAN_<COMP>_PACKAGE_SHLIBDEPS
+#
+#  May be set to ON in order to use :code:`dpkg-shlibdeps` to generate
+#  better package dependency list.
 #
 #  * Mandatory : NO
-#  * Default   : OFF
+#  * Default   :
 #
-#  May be set to ON in order to use dpkg-shlibdeps to generate
-#  better package dependency list.
-#  You may need set CMAKE_INSTALL_RPATH toi appropriate value
-#  if you use this feature, because if you don't dpkg-shlibdeps
-#  may fail to find your own shared libs.
-#  See http://www.cmake.org/Wiki/CMake_RPATH_handling.
+#    - OFF for non-component based installations
+#    - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` for component-based
+#      installations.
 #
-# .. variable:: CPACK_DEBIAN_<comp>_PACKAGE_SHLIBDEPS
+#  .. note::
 #
-#  * Mandatory : NO
-#  * Default   : CPACK_DEBIAN_PACKAGE_SHLIBDEPS
+#    You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value
+#    if you use this feature, because if you don't :code:`dpkg-shlibdeps`
+#    may fail to find your own shared libs.
+#    See http://www.cmake.org/Wiki/CMake_RPATH_handling.
 #
-#  Same as `CPACK_DEBIAN_PACKAGE_SHLIBDEPS` but for one specific component.
-#  If set (either to ON or OFF) it overrides the default given by
-#  `CPACK_DEBIAN_PACKAGE_SHLIBDEPS`.
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG
 #
-#  * Mandatory : NO
-#  * Default   : -
-#
 #  May be set when invoking cpack in order to trace debug information
 #  during CPackDeb run.
 #
+#  * Mandatory : NO
+#  * Default   : -
+#
 # .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS
 #
+#  Like Depends, except that it also forces :code:`dpkg` to complete
+#  installation of the packages named before even starting the installation of
+#  the package which declares the pre-dependency.
+#
 #  * Mandatory : NO
 #  * Default   : -
 #
-#  see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#  This field is like Depends, except that it also forces dpkg to complete installation of
-#  the packages named before even starting the installation of the package which declares
-#  the pre-dependency.
+#  See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES
 #
+#  Similar to Suggests but works in the opposite direction: declares that a
+#  package can enhance the functionality of another package.
+#
 #  * Mandatory : NO
 #  * Default   : -
 #
-#  see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#  This field is similar to Suggests but works in the opposite direction.
-#  It is used to declare that a package can enhance the functionality of another package.
+#  See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS
 #
+#  When one binary package (P) declares that it breaks other packages (B),
+#  :code:`dpkg` will not allow the package (P) which declares Breaks be
+#  installed unless the packages that will be broken (B) are uninstalled first.
+#  Once the package (P) is installed, the previously removed packages (B)
+#  cannot be installed again unless (P) is uninstalled.
+#
 #  * Mandatory : NO
 #  * Default   : -
 #
-#  see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#  When one binary package declares that it breaks another, dpkg will refuse to allow the
-#  package which declares Breaks be installed unless the broken package is deconfigured first,
-#  and it will refuse to allow the broken package to be reconfigured.
+#  See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
 #
+#  When one binary package declares a conflict with another using a Conflicts
+#  field, :code:`dpkg` will not allow them to be installed on the system at
+#  the same time.
+#
 #  * Mandatory : NO
 #  * Default   : -
 #
-#  see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#  When one binary package declares a conflict with another using a Conflicts field,
-#  dpkg will refuse to allow them to be installed on the system at the same time.
+#  See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES
 #
+#  A virtual package is one which appears in the Provides control field of
+#  another package.
+#
 #  * Mandatory : NO
 #  * Default   : -
 #
-#  see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#  A virtual package is one which appears in the Provides control field of another package.
+#  See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
 #
+#  Packages can declare in their control file that they should overwrite
+#  files in certain other packages, or completely replace other packages.
+#
 #  * Mandatory : NO
 #  * Default   : -
 #
-#  see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#  Packages can declare in their control file that they should overwrite
-#  files in certain other packages, or completely replace other packages.
+#  See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS
 #
+#  Allows packages to declare a strong, but not absolute, dependency on other
+#  packages.
+#
 #  * Mandatory : NO
 #  * Default   : -
 #
-#  see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#  Allows packages to declare a strong, but not absolute, dependency on other packages.
+#  See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
 #
+#  Allows packages to declare a suggested package install grouping.
+#
 #  * Mandatory : NO
 #  * Default   : -
 #
-#  see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#  Allows packages to declare a suggested package install grouping.
+#  See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
 #
+#  This variable allow advanced user to add custom script to the
+#  control.tar.gz.
+#  Typical usage is for conffiles, postinst, postrm, prerm.
+#
 #  * Mandatory : NO
 #  * Default   : -
 #
-#  This variable allow advanced user to add custom script to the
-#  control.tar.gz Typical usage is for conffiles, postinst, postrm, prerm.
 #  Usage::
 #
 #   set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
@@ -268,13 +312,13 @@ function(cpack_deb_prepare_package_vars)
     set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE})
   endif()
 
-  
+
   # per component automatic discover: some of the component might not have
-  # binaries. 
+  # binaries.
   if(CPACK_DEB_PACKAGE_COMPONENT)
     string(TOUPPER ${CPACK_DEB_PACKAGE_COMPONENT} _local_component_name)
     set(_component_shlibdeps_var CPACK_DEBIAN_${_local_component_name}_PACKAGE_SHLIBDEPS)
-    
+
     # if set, overrides the global configuration
     if(DEFINED ${_component_shlibdeps_var})
       set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ${${_component_shlibdeps_var}})
@@ -412,13 +456,13 @@ function(cpack_deb_prepare_package_vars)
   # Depends:
   # You should set: DEBIAN_PACKAGE_DEPENDS
   # TODO: automate 'objdump -p | grep NEEDED'
-  
+
   # if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_DEPENDS
   # automatic dependency discovery will be performed afterwards.
   if(CPACK_DEB_PACKAGE_COMPONENT)
     string(TOUPPER ${CPACK_DEB_PACKAGE_COMPONENT} _local_component_name)
     set(_component_depends_var CPACK_DEBIAN_${_local_component_name}_PACKAGE_DEPENDS)
-    
+
     # if set, overrides the global dependency
     if(DEFINED ${_component_depends_var})
       set(CPACK_DEBIAN_PACKAGE_DEPENDS ${${_component_depends_var}})
@@ -428,8 +472,8 @@ function(cpack_deb_prepare_package_vars)
     endif()
   endif()
 
-  # at this point, the CPACK_DEBIAN_PACKAGE_DEPENDS is properly set 
-  # to the minimal dependency of the package 
+  # at this point, the CPACK_DEBIAN_PACKAGE_DEPENDS is properly set
+  # to the minimal dependency of the package
   # Append automatic dependance discovery.
   if(CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS AND NOT CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS STREQUAL "")
     if (CPACK_DEBIAN_PACKAGE_DEPENDS)
@@ -462,7 +506,7 @@ function(cpack_deb_prepare_package_vars)
   else()
     string(TOUPPER ${CPACK_DEB_PACKAGE_COMPONENT} _local_component_name)
     set(component_description_var CPACK_COMPONENT_${_local_component_name}_DESCRIPTION)
-    
+
     # component description overrides package description
     if(${component_description_var})
       set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${${component_description_var}})
@@ -475,7 +519,7 @@ function(cpack_deb_prepare_package_vars)
       endif()
       set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
     endif()
-      
+
   endif()
 
   # Section: (recommended)
-- 
2.0.1



More information about the cmake-developers mailing list