[cmake-developers] [CPackDeb] Configure Debian package name for components
Markus Rickert
rickert at fortiss.org
Sun Nov 8 07:34:41 EST 2015
Hi,
it is currently not possible to modify the component part of the package
name for Debian packages generated by CPack. For component-based
packaging, the name is currently composed of
"${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}", where
the latter is set to "-${CPACK_DEB_PACKAGE_COMPONENT}".
The use of CPACK_PACKAGE_NAME here does not match the behavior of
non-component-based packaging, where CPACK_DEBIAN_PACKAGE_NAME can be
defined.
With CPACK_PACKAGE_NAME set to "foo" and CPACK_DEBIAN_PACKAGE_NAME set
to "libfoo", a component "libraries" that gathers the libraries in a
project then defaults to, e.g., "foo-libraries", rather than "libfoo"
(without a component part) in the control file.
These conventions can also differ between, e.g., Debian/Ubuntu and
Fedora. The former would expect libraries in "libfoo", headers in
"libfoo-dev", and documentation in "libfoo-doc", the latter however
rather "foo"/"foo-devel" or "libfoo"/"libfoo-devel".
I've included two possible patches for this. The first one adds a fully
configurable component package name via
CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME, the latter only allows to set the
part name appended to CPACK_DEBIAN_PACKAGE_NAME (with "-<COMPONENT>"
still the default behavior).
It would be great if one of those solutions could be integrated, as this
enables better matching of CPack and upstream conventions. A similar
patch could also be added to CPackRPM.
Best regards,
Markus Rickert
-------------- next part --------------
From 09b171fb5b6965c571aa57bf68856eac04d21ab6 Mon Sep 17 00:00:00 2001
From: Markus Rickert <rickert at fortiss.org>
Date: Sat, 7 Nov 2015 18:58:56 +0100
Subject: [PATCH] Configure Debian component part name for package name
---
Modules/CPackDeb.cmake | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 875a534..3161ffd 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -34,6 +34,14 @@
# * Default : :variable:`CPACK_PACKAGE_NAME` (lower case)
#
#
+# .. variable:: CPACK_DEBIAN_<COMPONENT>_PART_NAME
+#
+# The Debian package summary component part
+#
+# * Mandatory : NO
+# * Default : `-<COMPONENT>` (lower case)
+#
+#
# .. variable:: CPACK_DEBIAN_PACKAGE_VERSION
#
# The Debian package version
@@ -694,8 +702,12 @@ function(cpack_deb_prepare_package_vars)
endif()
endforeach()
- set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}")
- string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
+ if(NOT DEFINED CPACK_DEBIAN_${_local_component_name}_PART_NAME)
+ set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}")
+ else()
+ set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME ${CPACK_DEBIAN_${_local_component_name}_PART_NAME})
+ endif()
+ string(TOLOWER "${CPACK_DEBIAN_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
else()
set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "")
endif()
--
1.9.1
-------------- next part --------------
From 779742c19847bbb0ec28a3071fa59074a9989743 Mon Sep 17 00:00:00 2001
From: Markus Rickert <rickert at fortiss.org>
Date: Sat, 7 Nov 2015 18:56:24 +0100
Subject: [PATCH] Configure Debian package name per component
---
Modules/CPackDeb.cmake | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 875a534..552e430 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -27,6 +27,7 @@
# However as a handy reminder here comes the list of specific variables:
#
# .. variable:: CPACK_DEBIAN_PACKAGE_NAME
+# .. variable:: CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME
#
# The Debian package summary
#
@@ -593,7 +594,7 @@ function(cpack_deb_prepare_package_vars)
# if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_${dependency_type_}
# automatic dependency discovery will be performed afterwards.
if(CPACK_DEB_PACKAGE_COMPONENT)
- foreach(dependency_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES SOURCE)
+ foreach(dependency_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES SOURCE NAME)
set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${dependency_type_}")
# if set, overrides the global dependency
@@ -694,8 +695,13 @@ function(cpack_deb_prepare_package_vars)
endif()
endforeach()
- set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}")
- string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
+ if(NOT CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME)
+ set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}")
+ string(TOLOWER "${CPACK_DEBIAN_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
+ else()
+ set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "")
+ string(TOLOWER ${CPACK_DEBIAN_PACKAGE_NAME} CPACK_DEBIAN_PACKAGE_NAME)
+ endif()
else()
set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "")
endif()
--
1.9.1
More information about the cmake-developers
mailing list