summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@qt.io>2022-04-25 19:43:15 +0200
committerDominik Holland <dominik.holland@qt.io>2022-05-17 16:14:43 +0200
commitc34a0a1e748f1a7a6391a3954e152cea6483d2d2 (patch)
tree53a19083b790252346873ed41c93b665902c7e05
parentc4eddc6a1fbfe8d6df7f9977dda63e02d1c223d7 (diff)
downloadqtapplicationmanager-c34a0a1e748f1a7a6391a3954e152cea6483d2d2.tar.gz
Don't rely on the system environment to be UTF-8 when building packages
Instead, set a well-known UTF-8 locale ourselves. Change-Id: I67e4eaa9dbadf690924b091f93cf1d61425ea451 Reviewed-by: Dominik Holland <dominik.holland@qt.io> (cherry picked from commit 5f053ea7f609a269457ff1cd75aeb924a8a0d60f) Reviewed-by: Robert Griebl <robert.griebl@qt.io>
-rwxr-xr-xtests/data/create-test-packages.sh11
-rw-r--r--tests/tests.pro5
2 files changed, 7 insertions, 9 deletions
diff --git a/tests/data/create-test-packages.sh b/tests/data/create-test-packages.sh
index 9f621f46..71741939 100755
--- a/tests/data/create-test-packages.sh
+++ b/tests/data/create-test-packages.sh
@@ -43,11 +43,12 @@ isMac=0
# unconditionally in the build environment, overriding a potentially valid $LANG setting.
[ "$LC_ALL" = "C" ] && { echo "WARNING: unsetting \$LC_ALL, since it is set to \"C\" (most likely by a wrapper script or QtCreator)"; unset LC_ALL; }
-# let the c-library resolve all the indirect settings
-eval "x$(locale | grep LC_CTYPE= | head -n1)"
-
-# now check for character encoding
-[ "${xLC_CTYPE%%UTF-8}" = "$xLC_CTYPE" ] && { echo "The appman-packager needs to be run within an UTF-8 locale variant"; exit 1; }
+# set a well-known UTF-8 locale: C.UTF-8 is the obvious choice, but macOS doesn't support it
+if [ "$isMac" = "1" ]; then
+ export LC_ALL=en_US.UTF-8
+else
+ export LC_ALL=C.UTF-8
+fi
. utilities.sh
diff --git a/tests/tests.pro b/tests/tests.pro
index 808c386a..1f8e0284 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -39,13 +39,10 @@ OTHER_FILES += \
qtPrepareTool(APPMAN_PACKAGER, appman-packager)
unix {
- macos:ctype=UTF-8
- else:ctype=C.UTF-8
-
# create test data on the fly - this is needed for the CI server
testdata.target = testdata
testdata.depends = $$PWD/data/create-test-packages.sh $$APPMAN_PACKAGER_EXE
- testdata.commands = (cd $$PWD/data ; LC_CTYPE=$$ctype ./create-test-packages.sh $$APPMAN_PACKAGER)
+ testdata.commands = (cd $$PWD/data ; ./create-test-packages.sh $$APPMAN_PACKAGER)
QMAKE_EXTRA_TARGETS += testdata
# qmake would create a default check target implicitly, but since we need 'testdata' as an