[gimp/wip/Jehan/incremental-win-installer-improvements] build: add a test to check the Windows installer languages.



commit c489870f186479171b388f5e7f83e877080b6de7
Author: Jehan <jehan girinstud io>
Date:   Tue May 18 20:18:14 2021 +0200

    build: add a test to check the Windows installer languages.
    
    This way, we will avoid in the future any discrepancies between
    languages set in the Windows installer and available translations (po
    files in po-windows-installer/) because `make check`/`ninja test` will
    fail.

 build/windows/installer/lang/Makefile.am            |  6 ++++++
 build/windows/installer/lang/meson.build            |  7 +++++++
 .../windows/installer/lang/test-installer-langs.sh  | 21 +++++++++++++++++++++
 3 files changed, 34 insertions(+)
---
diff --git a/build/windows/installer/lang/Makefile.am b/build/windows/installer/lang/Makefile.am
index 60dfd0a836..8f466686a3 100644
--- a/build/windows/installer/lang/Makefile.am
+++ b/build/windows/installer/lang/Makefile.am
@@ -71,3 +71,9 @@ clean-local:
                echo "  RM       $$isl";                \
                rm -f "$$isl";                          \
        done
+
+TESTS_ENVIRONMENT = \
+       chmod +x test-installer-langs.sh; \
+       GIMP_TESTING_ABS_TOP_SRCDIR=@abs_top_srcdir@
+
+TESTS = test-installer-langs.sh
diff --git a/build/windows/installer/lang/meson.build b/build/windows/installer/lang/meson.build
index afbd1e05d6..2b587b2470 100644
--- a/build/windows/installer/lang/meson.build
+++ b/build/windows/installer/lang/meson.build
@@ -59,3 +59,10 @@ foreach language : languages
     build_by_default: true,
   )
 endforeach
+
+test('windows-installer-langs',
+  find_program('test-installer-langs.sh'),
+  env: [
+    'GIMP_TESTING_ABS_TOP_SRCDIR=' + meson.source_root(),
+  ],
+  suite: 'build')
diff --git a/build/windows/installer/lang/test-installer-langs.sh 
b/build/windows/installer/lang/test-installer-langs.sh
new file mode 100755
index 0000000000..795e2c7990
--- /dev/null
+++ b/build/windows/installer/lang/test-installer-langs.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Make sure that the languages specified in the installer match the
+# translations present. This check step is necessary to not forget new
+# installer translations because we have a manual step.
+
+INSTALLER_LANGS=`grep -rI '^Name:.*MessagesFile' 
${GIMP_TESTING_ABS_TOP_SRCDIR}/build/windows/installer/gimp3264.iss | \
+                 sed 's/^Name: *"\([a-zA-Z_]*\)".*$/\1/' | sort`
+# 'en' doesn't have a gettext file because it is the default.
+INSTALLER_LANGS=`echo "$INSTALLER_LANGS" | tr '\n\r' ' ' | sed 's/\<en\> //'`
+
+PO_LANGS=`ls ${GIMP_TESTING_ABS_TOP_SRCDIR}/po-windows-installer/*.po |sed 
's%.*/po-windows-installer/\([a-zA-Z_]*\).po%\1%'`
+PO_LANGS=`echo "$PO_LANGS" | tr '\n\r' ' '`
+
+if [ "$PO_LANGS" = "$INSTALLER_LANGS" ]; then
+  exit 0
+else
+  echo "Error: languages listed in the Windows installer script do not match the .po files in 
po-windows-installer/."
+  echo "Please verify: build/windows/installer/gimp3264.iss"
+  exit 1
+fi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]