From 89d378eb7167538fa8fd1fb2d01de44aa3168887 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Thu, 20 Feb 2020 23:46:09 +0000 Subject: [PATCH] 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 --- src/wx/check-pot-updated.cmake | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/wx/check-pot-updated.cmake b/src/wx/check-pot-updated.cmake index 7793dcb9..0183cd77 100644 --- a/src/wx/check-pot-updated.cmake +++ b/src/wx/check-pot-updated.cmake @@ -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})