summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-01-24 13:50:43 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-01-24 13:50:43 (GMT)
commitbaec299ecd350f0b82489e928a770c3ce081958a (patch)
tree6744d4bde46e41e742d9afb0fd481afed17948fc
parent74588925229cb4b3df319fd084c2481c2f962fbc (diff)
downloadCMake-baec299ecd350f0b82489e928a770c3ce081958a.zip
CMake-baec299ecd350f0b82489e928a770c3ce081958a.tar.gz
CMake-baec299ecd350f0b82489e928a770c3ce081958a.tar.bz2
CPack: Fix regression in Deb description
Fixes: #20254
-rw-r--r--Modules/CPack.cmake3
-rw-r--r--Modules/Internal/CPack/CPackDeb.cmake3
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake10
-rw-r--r--Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake9
6 files changed, 20 insertions, 9 deletions
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index a1cc71d..c2ed3de 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -458,12 +458,13 @@ if(NOT DEFINED CPACK_PACKAGE_VERSION)
endif()
_cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity")
+set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_NAME} built using CMake")
if(CMAKE_PROJECT_DESCRIPTION)
_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"${CMAKE_PROJECT_DESCRIPTION}")
else()
_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY
- "${CMAKE_PROJECT_NAME} built using CMake")
+ "${CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY}")
endif()
if(CMAKE_PROJECT_HOMEPAGE_URL)
_cpack_set_default(CPACK_PACKAGE_HOMEPAGE_URL
diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake
index 3927b1a..97906ca 100644
--- a/Modules/Internal/CPack/CPackDeb.cmake
+++ b/Modules/Internal/CPack/CPackDeb.cmake
@@ -540,7 +540,8 @@ function(cpack_deb_prepare_package_vars)
# Ok, description has set. According to the `Debian Policy Manual`_ the frist
# line is a pacakge summary. Try to get it as well...
# See also: https://www.debian.org/doc/debian-policy/ch-controlfields.html#description
- elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+ elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY AND
+ NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY STREQUAL CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY)
# Merge summary w/ the detailed description
string(PREPEND CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n")
endif()
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 745bc8a..c2382b0 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -38,7 +38,7 @@ run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_B
run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT")
run_cpack_test_subtests(
DEB_DESCRIPTION
- "CPACK_DEBIAN_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION_FILE;CPACK_NO_PACKAGE_DESCRIPTION"
+ "CPACK_DEBIAN_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION;CPACK_COMPONENT_COMP_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION_FILE;CPACK_NO_PACKAGE_DESCRIPTION"
"DEB.DEB_DESCRIPTION"
false
"MONOLITHIC;COMPONENT"
diff --git a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake
index a8e2e7a..bfe2059 100644
--- a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake
@@ -58,6 +58,8 @@ if(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION_FILE" AND PACKAGI
string(APPEND _expected_description "\n ." )
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_NO_PACKAGE_DESCRIPTION")
set(_expected_description [[ Description: This is the summary line]])
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_COMPONENT_COMP_DESCRIPTION")
+ set(_expected_description [[ Description: One line description]])
endif()
foreach(_file_no RANGE 1 ${EXPECTED_FILES_COUNT})
diff --git a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake
index ce3f651..893eb01 100644
--- a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake
+++ b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake
@@ -34,6 +34,16 @@ elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION")
set(CPACK_PACKAGE_DESCRIPTION "${_description}")
endif()
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_COMPONENT_COMP_DESCRIPTION")
+ # NOTE Documented fallback variable without CPACK_PACKAGE_DESCRIPTION_SUMMARY
+ if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(CPACK_COMPONENT_SATU_DESCRIPTION "One line description")
+ set(CPACK_COMPONENT_DUA_DESCRIPTION "One line description")
+ else()
+ set(CPACK_PACKAGE_DESCRIPTION "One line description")
+ endif()
+ unset(CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION_FILE")
# NOTE Getting the description from the file
set(_file "${CMAKE_CURRENT_BINARY_DIR}/description.txt")
diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
index c47b40e..b4bdb61 100644
--- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
@@ -8,9 +8,6 @@ endfunction()
if(GENERATOR_TYPE STREQUAL "DEB")
set(name_ "Package")
set(group_ "Section")
- # NOTE For a Debian package the first line of the `Description`
- # field is generated by CMake and gonna be ignored
- set(ignore_rest_cond_ ".*\n")
elseif(GENERATOR_TYPE STREQUAL "RPM")
set(name_ "Name")
set(group_ "Group")
@@ -36,6 +33,6 @@ if(GENERATOR_TYPE STREQUAL "RPM")
endif()
# check package description
-checkPackageInfo_("description" "${FOUND_FILE_1}" ".*Description${whitespaces_}:${ignore_rest_cond_}${whitespaces_}Description for pkg_1")
-checkPackageInfo_("description" "${FOUND_FILE_2}" ".*Description${whitespaces_}:${ignore_rest_cond_}${whitespaces_}Description for pkg_2")
-checkPackageInfo_("description" "${FOUND_FILE_3}" ".*Description${whitespaces_}:${ignore_rest_cond_}${whitespaces_}Description for pkg_3")
+checkPackageInfo_("description" "${FOUND_FILE_1}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_1")
+checkPackageInfo_("description" "${FOUND_FILE_2}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_2")
+checkPackageInfo_("description" "${FOUND_FILE_3}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_3")