Skip to content

Commit a148aa8

Browse files
committed
CMake: Update man pages with addition only updates
Before this update the build system would not update generated man pages in the folder `doc/man` if we only added lines to the source file of the man page.
1 parent cac326c commit a148aa8

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

doc/news/_preparation_next_release.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ you up to date with the multi-language support provided by Elektra.
308308
- The variable `ELEKTRA_STAT_ST_SIZE_F` now contains the correct format specifier for the `st_size` member of the `stat` struct on macOS. _(René Schwaiger)_
309309
- We simplified and unified the CMake code for the [Shell Tests](../../tests/shell) and the [Shell Recorder](../../tests/shell/shell_recorder). _(René Schwaiger)_
310310
- CMake now prints warnings about missing man pages. _(René Schwaiger)_
311-
- The build system now reverts man pages generated by `ronn`, if only the creation date of the man page changed. _(René Schwaiger)_
311+
- The build system does not update a man page in the folder [doc/man](../man) any more, if ronn only changed the creation date of the man page. _(René Schwaiger)_
312312

313313
### Compilation
314314

scripts/cmake/ElektraManPage.cmake

+7-5
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,21 @@ endif (NOT EXISTS "${OLD_MAN_PAGE_COPY}")
2525

2626
# We revert newly generated man pages, where only the date has changed.
2727
execute_process (COMMAND ${DIFF_COMMAND}
28-
-u
28+
-e
2929
${MANPAGE}
3030
${OLD_MAN_PAGE_COPY}
3131
OUTPUT_VARIABLE DIFF_OUTPUT)
32-
string (FIND "${DIFF_OUTPUT}" "\n+.TH" DIFF_POSITION_DATE_ADDED)
33-
string (FIND "${DIFF_OUTPUT}" "\n+" DIFF_LAST_POSITION_ADDED REVERSE)
32+
string (REGEX MATCH
33+
"^4c\n\\.TH [^\n]+\n\\.\n$"
34+
ONLY_DATE_CHANGED
35+
"${DIFF_OUTPUT}")
3436

35-
if (NOT "${DIFF_POSITION_DATE_ADDED}" STREQUAL -1 AND "${DIFF_POSITION_DATE_ADDED}" STREQUAL "${DIFF_LAST_POSITION_ADDED}")
37+
if (NOT "${ONLY_DATE_CHANGED}" STREQUAL "")
3638
execute_process (COMMAND ${CMAKE_COMMAND}
3739
-E
3840
copy
3941
${OLD_MAN_PAGE_COPY}
4042
${MANPAGE})
41-
endif (NOT "${DIFF_POSITION_DATE_ADDED}" STREQUAL -1 AND "${DIFF_POSITION_DATE_ADDED}" STREQUAL "${DIFF_LAST_POSITION_ADDED}")
43+
endif (NOT "${ONLY_DATE_CHANGED}" STREQUAL "")
4244

4345
file (REMOVE "${OLD_MAN_PAGE_COPY}")

0 commit comments

Comments
 (0)