teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 9e35f5e32eeacdeeb0d2b520320b08daafc11c72 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Jun 2022 09:13:00 +0900
Subject: [PATCH] test: install C.UTF-8 and English locales

(cherry picked from commit 4ce68ea9b3707fde8c4be20e164fc2a41197fdda)

Related: #2087652
---
 test/test-functions | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/test/test-functions b/test/test-functions
index 644c3a8613..cab3e3c015 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -684,6 +684,7 @@ setup_basic_environment() {
     install_pam
     install_dbus
     install_fonts
+    install_locales
     install_keymaps
     install_x11_keymaps
     install_terminfo
@@ -1847,6 +1848,29 @@ install_pam() {
     done
 }
 
+install_locales() {
+    # install only C.UTF-8 and English locales
+    dinfo "Install locales"
+
+    if command -v meson >/dev/null \
+            && (meson configure "${BUILD_DIR:?}" | grep 'localegen-path */') \
+            || get_bool "$LOOKS_LIKE_DEBIAN"; then
+        # locale-gen support
+        image_install -o locale-gen localedef
+        inst /etc/locale.gen || :
+        inst /usr/share/i18n/SUPPORTED || :
+        inst_recursive /usr/share/i18n/charmaps
+        inst_recursive /usr/share/i18n/locales
+        inst_recursive /usr/share/locale/en
+        inst_recursive /usr/share/locale/en_*
+    fi
+
+    inst_recursive /usr/lib/locale/C.utf8
+    inst_recursive /usr/lib/locale/C.UTF-8
+    inst_recursive /usr/lib/locale/en_*.utf8
+    inst_recursive /usr/lib/locale/en_*.UTF-8
+}
+
 # shellcheck disable=SC2120
 install_keymaps() {
     local i p