summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-09-22 14:14:24 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-09-22 14:14:49 (GMT)
commit33eec572328847da74f87c99bde3c5f0eef992bb (patch)
treef167aa57a9699e608dffdf19676e8a073d57545d /Modules
parent9c20ef95e01f97849e0a4008ac732c823a067ce5 (diff)
parent74b7457f12c943abd2c33aebc8ada5b50e331f50 (diff)
downloadCMake-33eec572328847da74f87c99bde3c5f0eef992bb.zip
CMake-33eec572328847da74f87c99bde3c5f0eef992bb.tar.gz
CMake-33eec572328847da74f87c99bde3c5f0eef992bb.tar.bz2
Merge topic 'cpack-rpm-deb-version'
74b7457f CPack RPM and DEB: improved package version handling Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1296
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CPackDeb.cmake52
-rw-r--r--Modules/CPackRPM.cmake17
2 files changed, 61 insertions, 8 deletions
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 85d564e..337bec8 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -88,6 +88,16 @@
# get overwritten and it is up to the packager to set the variables in a
# manner that will prevent such errors.
#
+# .. variable:: CPACK_DEBIAN_PACKAGE_EPOCH
+#
+# The Debian package epoch
+#
+# * Mandatory : No
+# * Default : -
+#
+# Optional number that should be incremented when changing versioning schemas
+# or fixing mistakes in the version numbers of older packages.
+#
# .. variable:: CPACK_DEBIAN_PACKAGE_VERSION
#
# The Debian package version
@@ -95,12 +105,17 @@
# * Mandatory : YES
# * Default : :variable:`CPACK_PACKAGE_VERSION`
#
+# This variable may contain only alphanumerics (A-Za-z0-9) and the characters
+# . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If
+# :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` is not set then hyphens are not
+# allowed.
+#
# .. variable:: CPACK_DEBIAN_PACKAGE_RELEASE
#
# The Debian package release - Debian revision number.
#
-# * Mandatory : YES
-# * Default : 1
+# * Mandatory : No
+# * Default : -
#
# This is the numbering of the DEB package itself, i.e. the version of the
# packaging and not the version of the content (see
@@ -738,6 +753,32 @@ function(cpack_deb_prepare_package_vars)
set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
endif()
+ if(NOT CPACK_DEBIAN_PACKAGE_VERSION MATCHES "^[0-9][A-Za-z0-9.+-~]*$")
+ message(FATAL_ERROR
+ "CPackDeb: Debian package version must confirm to \"^[0-9][A-Za-z0-9.+-~]*$\" regex!")
+ endif()
+
+ if(CPACK_DEBIAN_PACKAGE_RELEASE)
+ if(NOT CPACK_DEBIAN_PACKAGE_RELEASE MATCHES "^[A-Za-z0-9.+~]+$")
+ message(FATAL_ERROR
+ "CPackDeb: Debian package release must confirm to \"^[A-Za-z0-9.+~]+$\" regex!")
+ endif()
+ string(APPEND CPACK_DEBIAN_PACKAGE_VERSION
+ "-${CPACK_DEBIAN_PACKAGE_RELEASE}")
+ elseif(CPACK_DEBIAN_PACKAGE_VERSION MATCHES ".*-.*")
+ message(FATAL_ERROR
+ "CPackDeb: Debian package version must not contain hyphens when CPACK_DEBIAN_PACKAGE_RELEASE is not provided!")
+ endif()
+
+ if(CPACK_DEBIAN_PACKAGE_EPOCH)
+ if(NOT CPACK_DEBIAN_PACKAGE_EPOCH MATCHES "^[0-9]+$")
+ message(FATAL_ERROR
+ "CPackDeb: Debian package epoch must confirm to \"^[0-9]+$\" regex!")
+ endif()
+ set(CPACK_DEBIAN_PACKAGE_VERSION
+ "${CPACK_DEBIAN_PACKAGE_EPOCH}:${CPACK_DEBIAN_PACKAGE_VERSION}")
+ endif()
+
# Architecture: (mandatory)
if(CPACK_DEB_PACKAGE_COMPONENT AND CPACK_DEBIAN_${_local_component_name}_PACKAGE_ARCHITECTURE)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_ARCHITECTURE}")
@@ -961,11 +1002,6 @@ function(cpack_deb_prepare_package_vars)
set(CPACK_DEBIAN_GENERATE_POSTRM 0)
endif()
- if(NOT CPACK_DEBIAN_PACKAGE_RELEASE)
- set(CPACK_DEBIAN_PACKAGE_RELEASE 1)
- endif()
-
-
cpack_deb_variable_fallback("CPACK_DEBIAN_FILE_NAME"
"CPACK_DEBIAN_${_local_component_name}_FILE_NAME"
"CPACK_DEBIAN_FILE_NAME")
@@ -974,7 +1010,7 @@ function(cpack_deb_prepare_package_vars)
# Patch package file name to be in corrent debian format:
# <foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
set(CPACK_OUTPUT_FILE_NAME
- "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
+ "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
else()
cmake_policy(PUSH)
cmake_policy(SET CMP0010 NEW)
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index a770f04..9f77ec3 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -106,6 +106,16 @@
# group rpm package is generated without component suffix in filename and
# package name.
#
+# .. variable:: CPACK_RPM_PACKAGE_EPOCH
+#
+# The RPM package epoch
+#
+# * Mandatory : No
+# * Default : -
+#
+# Optional number that should be incremented when changing versioning schemas
+# or fixing mistakes in the version numbers of older packages.
+#
# .. variable:: CPACK_RPM_PACKAGE_VERSION
#
# The RPM package version.
@@ -1895,11 +1905,16 @@ function(cpack_rpm_generate_package)
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "\n" ";" RPMBUILD_TAG_LIST "${RPMBUILD_TAG_LIST}")
+ if(CPACK_RPM_PACKAGE_EPOCH)
+ set(TMP_RPM_EPOCH "Epoch: ${CPACK_RPM_PACKAGE_EPOCH}")
+ endif()
+
# Check if additional fields for RPM spec header are given
# There may be some COMPONENT specific variables as well
# If component specific var is not provided we use the global one
# for each component
foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN)
+
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}")
endif()
@@ -2505,6 +2520,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_AUTOREQPROV\@
\@TMP_RPM_BUILDARCH\@
\@TMP_RPM_PREFIXES\@
+\@TMP_RPM_EPOCH\@
%description -n \@CPACK_RPM_PACKAGE_NAME\@
\@CPACK_RPM_PACKAGE_DESCRIPTION\@
@@ -2564,6 +2580,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_AUTOREQPROV\@
\@TMP_RPM_BUILDARCH\@
\@TMP_RPM_PREFIXES\@
+\@TMP_RPM_EPOCH\@
\@TMP_RPM_DEBUGINFO\@