cmake: Fix gettext pot update check.

When the feature was added in d93f6350, I did not adequately test for
the normal case when the pot is not updated.

This does not work because the pot has a timestamp in the
POT-Creation-Date: field.

Fix check-pot-update.cmake to ignore the pot timestamp and not report
the pot as changed when it has not been.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2020-02-20 23:46:09 +00:00
parent 2504596140
commit 89d378eb71
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 15 additions and 2 deletions

View File

@ -2,9 +2,22 @@ if(NOT EXISTS ${BIN_DIR}/wxvbam.pot)
return()
endif()
file(READ ${SRC_DIR}/wxvbam.pot src_ver)
macro(read_pot path var)
file(READ ${path} ${var}_file)
file(READ ${BIN_DIR}/wxvbam.pot new_ver)
string(REGEX REPLACE ";" "\\\\;" ${var}_file ${${var}_file})
string(REGEX REPLACE "\r?\n" ";" ${var}_file ${${var}_file})
# Ignore timestamp.
foreach(line IN LISTS ${var}_file)
if(NOT line MATCHES [=[^"POT-Creation-Date: ]=])
list(APPEND ${var} ${line})
endif()
endforeach()
endmacro()
read_pot(${SRC_DIR}/wxvbam.pot src_ver)
read_pot(${BIN_DIR}/wxvbam.pot new_ver)
if(NOT src_ver STREQUAL new_ver)
file(COPY ${BIN_DIR}/wxvbam.pot DESTINATION ${SRC_DIR})