summaryrefslogtreecommitdiffstats
path: root/Tests/CPackComponentsDEB
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2019-07-11 16:31:59 (GMT)
committerAlex Turbov <i.zaufi@gmail.com>2019-09-21 22:31:24 (GMT)
commit33c7ea513dc8a7e1322c5c37003c7c515bd8ad99 (patch)
tree1b0f529e7083387374ecd536f24a9311a06be33b /Tests/CPackComponentsDEB
parent53be31e19c0dc0f517825d1be056c55d7729a4b7 (diff)
downloadCMake-33c7ea513dc8a7e1322c5c37003c7c515bd8ad99.zip
CMake-33c7ea513dc8a7e1322c5c37003c7c515bd8ad99.tar.gz
CMake-33c7ea513dc8a7e1322c5c37003c7c515bd8ad99.tar.bz2
CPackDeb: Use `CPACK_PACKAGE_DESCRIPTION_FILE`
Also, handle per-component description nicely.
Diffstat (limited to 'Tests/CPackComponentsDEB')
-rw-r--r--Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in7
-rw-r--r--Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in10
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake18
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake20
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake25
5 files changed, 50 insertions, 30 deletions
diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in
index 74d816c..67b108b 100644
--- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in
+++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in
@@ -15,8 +15,9 @@ set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
# overriding previous descriptions
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description")
-set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "applications_description")
-set(CPACK_COMPONENT_HEADERS_DESCRIPTION "headers_description")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description") # This become a summary line (the first one) of all descriptions
+set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "applications_description")
+set(CPACK_COMPONENT_HEADERS_DESCRIPTION "headers_description")
# libraries does not have any description and should inherit from CPACK_PACKAGE_DESCRIPTION_SUMMARY
+# plus content of the `CPACK_PACKAGE_DESCRIPTION_FILE`.
unset(CPACK_COMPONENT_LIBRARIES_DESCRIPTION)
diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in
index cda79bc..d877325 100644
--- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in
+++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in
@@ -15,12 +15,12 @@ set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
# overriding previous descriptions
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description 2")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description 2")
-# Components do not have any description
+# Components do not have any description.
+# So, content of `CPACK_PACKAGE_DESCRIPTION_FILE` gonna used
+# after summary line.
unset(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION)
unset(CPACK_COMPONENT_HEADERS_DESCRIPTION)
-unset(CPACK_COMPONENT_LIBRARIES_DESCRIPTION)
-
-set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "library description")
+set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "library description")
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake
index f74137c..86a74b2 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake
@@ -48,26 +48,26 @@ if(DPKGDEB_EXECUTABLE)
DPKGDEB_OUTPUT "${dpkg_output}"
METAENTRY "Package:")
- dpkgdeb_return_specific_metaentry(dpkg_description
- DPKGDEB_OUTPUT "${dpkg_output}"
- METAENTRY "Description:")
+ get_package_description("${dpkg_output}" dpkg_description)
message(STATUS "package='${dpkg_package_name}', description='${dpkg_description}'")
if(dpkg_package_name STREQUAL "mylib-applications")
- if(NOT "${dpkg_description}" STREQUAL "applications_description")
+ set(expected_description "main description\n applications_description")
+ if(NOT dpkg_description STREQUAL expected_description)
set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all}
- "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != applications_description")
+ "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: `${dpkg_description}` != `${expected_description}`")
endif()
elseif(dpkg_package_name STREQUAL "mylib-headers")
- if(NOT dpkg_description STREQUAL "headers_description")
+ set(expected_description "main description\n headers_description")
+ if(NOT dpkg_description STREQUAL expected_description)
set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all}
- "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != headers_description")
+ "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: `${dpkg_description}` != `${expected_description}`")
endif()
elseif(dpkg_package_name STREQUAL "mylib-libraries")
- if(NOT dpkg_description STREQUAL "main description")
+ if(NOT dpkg_description MATCHES "main description\n.*")
set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all}
- "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != 'main description'")
+ "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: `${dpkg_description}` =~ `main description.*`")
endif()
else()
set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all}
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake
index 241dda5..d53c73d 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake
@@ -48,26 +48,20 @@ if(DPKGDEB_EXECUTABLE)
DPKGDEB_OUTPUT "${dpkg_output}"
METAENTRY "Package:")
- dpkgdeb_return_specific_metaentry(dpkg_description
- DPKGDEB_OUTPUT "${dpkg_output}"
- METAENTRY "Description:")
+ get_package_description("${dpkg_output}" dpkg_description)
message(STATUS "package='${dpkg_package_name}', description='${dpkg_description}'")
- if(dpkg_package_name STREQUAL "mylib-applications")
- if(NOT dpkg_description STREQUAL "main description 2")
- set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all}
- "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != applications_description")
- endif()
- elseif(dpkg_package_name STREQUAL "mylib-headers")
- if(NOT dpkg_description STREQUAL "main description 2")
+ if(dpkg_package_name STREQUAL "mylib-applications" OR dpkg_package_name STREQUAL "mylib-headers")
+ if(NOT dpkg_description MATCHES "main description 2\n.*")
set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all}
- "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != headers_description")
+ "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: `${dpkg_description}` =~ `main description 2`")
endif()
elseif(dpkg_package_name STREQUAL "mylib-libraries")
- if(NOT dpkg_description STREQUAL "library description")
+ set(expected_description "main description 2\n library description")
+ if(NOT dpkg_description STREQUAL expected_description)
set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all}
- "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != 'main description'")
+ "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: `${dpkg_description}` != `${expected_description}`")
endif()
else()
set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all}
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake
index 2093e7e..b172da2 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake
@@ -200,4 +200,29 @@ function(dpkgdeb_return_specific_metaentry output)
endif()
endfunction()
+function(get_package_description DPKG_OUTPUT RESULT_VAR)
+ string(UUID uuid NAMESPACE 00000000-0000-0000-0000-000000000000 TYPE SHA1)
+ string(REPLACE ";" "${uuid}" DPKG_OUTPUT "${DPKG_OUTPUT}")
+ string(REPLACE "\n" ";" DPKG_OUTPUT "${DPKG_OUTPUT}")
+
+ unset(_actual_description)
+ set(_parse_description FALSE)
+ foreach(_line IN LISTS DPKG_OUTPUT)
+ if(_line MATCHES " Description:.*")
+ set(_parse_description TRUE)
+ string(REPLACE " Description: " "" _line "${_line}")
+ list(APPEND _actual_description "${_line}")
+ elseif(_parse_description)
+ if(_line MATCHES " [A-Z][A-Za-z\-]+: .*")
+ set(_parse_description FALSE)
+ else()
+ list(APPEND _actual_description "${_line}")
+ endif()
+ endif()
+ endforeach()
+ list(JOIN _actual_description "\n" _actual_description)
+
+ set(${RESULT_VAR} "${_actual_description}" PARENT_SCOPE)
+endfunction()
+
cmake_policy(POP)