Skip to content

Commit 1b8b98a

Browse files
bradkingkwrobot
authored andcommitted
Merge topic 'fix-cpack-deb-generating-empty-paragraph' into release-3.17
6ba8421 CPack-deb: don't add a line with a dot to pkg desc Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4806
2 parents 6fce0cb + 6ba8421 commit 1b8b98a

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Modules/Internal/CPack/CPackDeb.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ function(cpack_deb_format_package_description TEXT OUTPUT_VAR)
8383
string(REPLACE "\n" ";" _lines "${_text}")
8484
list(POP_FRONT _lines _summary)
8585

86+
# If the description ends with a newline (e.g. typically if it was read
87+
# from a file) the last line will be empty. We drop it here, otherwise
88+
# it would be replaced by a `.` which would lead to the package violating
89+
# the extended-description-contains-empty-paragraph debian policy
90+
list(POP_BACK _lines _last_line)
91+
string(STRIP "${_last_line}" _last_line_strip)
92+
if(_last_line_strip)
93+
list(APPEND _lines "${_last_line_strip}")
94+
endif()
95+
8696
# Check if reformatting required
8797
cpack_deb_check_description("${_summary}" "${_lines}" _result)
8898
if(_result)

Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
1616

1717
# overriding previous descriptions
1818
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description") # This become a summary line (the first one) of all descriptions
19-
set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "applications_description")
19+
set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "applications_description\n")
2020
set(CPACK_COMPONENT_HEADERS_DESCRIPTION "headers_description")
2121
# libraries does not have any description and should inherit from CPACK_PACKAGE_DESCRIPTION_SUMMARY
2222
# plus content of the `CPACK_PACKAGE_DESCRIPTION_FILE`.

Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,7 @@ set(_expected_description [[ Description: This is the summary line
4646
.
4747
See also: https://www.debian.org/doc/debian-policy/ch-controlfields.html#description]])
4848

49-
# ATTENTION The code in `cmCPackGenerator.cxx` to read `CPACK_PACKAGE_DESCRIPTION_FILE`
50-
# has a BUG: it appends the `\n` character to every line of the
51-
# input, even if there was no EOL (e.g. at the last line of the file).
52-
# That is WHY for this sub-test the one more pre-formatted "empty"
53-
# line required!
54-
# NOTE For component based installers content of the file gonna read by
55-
# `CPackDeb` module and the `file(READ...)` command so no the mentioned
56-
# workaround required!
57-
if(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION_FILE" AND PACKAGING_TYPE STREQUAL "MONOLITHIC")
58-
string(APPEND _expected_description "\n ." )
59-
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_NO_PACKAGE_DESCRIPTION")
49+
if(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_NO_PACKAGE_DESCRIPTION")
6050
set(_expected_description [[ Description: This is the summary line]])
6151
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_COMPONENT_COMP_DESCRIPTION")
6252
set(_expected_description [[ Description: One line description]])

0 commit comments

Comments
 (0)