Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sun, 03 Jul 2016 16:09:05
Message-Id: 1467562115.4cd5b18679a3e4bcb1049c4213fca6570639851a.mgorny@gentoo
1 commit: 4cd5b18679a3e4bcb1049c4213fca6570639851a
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 30 17:26:21 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 3 16:08:35 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4cd5b186
7
8 kde4-*.eclass: Migrate to L10N flags
9
10 eclass/kde4-base.eclass | 4 ++--
11 eclass/kde4-functions.eclass | 43 +++++++++++++++++++++++++++----------------
12 2 files changed, 29 insertions(+), 18 deletions(-)
13
14 diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
15 index b6ee447..6f71dea 100644
16 --- a/eclass/kde4-base.eclass
17 +++ b/eclass/kde4-base.eclass
18 @@ -333,13 +333,13 @@ fi
19
20 # add a dependency over kde4-l10n
21 if [[ ${KDEBASE} != "kde-base" && -n ${KDE_LINGUAS} ]]; then
22 - for _lingua in ${KDE_LINGUAS}; do
23 + for _lingua in $(kde4_lingua_to_l10n ${KDE_LINGUAS}); do
24 # if our package has linguas, pull in kde4-l10n with selected lingua enabled,
25 # but only for selected ones.
26 # this can't be done on one line because if user doesn't use any localisation
27 # then he is probably not interested in kde4-l10n at all.
28 kderdepend+="
29 - linguas_${_lingua}? ( $(add_kdeapps_dep kde4-l10n "linguas_${_lingua}(+)") )
30 + l10n_${_lingua}? ( $(add_kdeapps_dep kde4-l10n "l10n_${_lingua}(+)") )
31 "
32 done
33 unset _lingua
34
35 diff --git a/eclass/kde4-functions.eclass b/eclass/kde4-functions.eclass
36 index 8c2fa4a..a600d55 100644
37 --- a/eclass/kde4-functions.eclass
38 +++ b/eclass/kde4-functions.eclass
39 @@ -76,6 +76,27 @@ case ${KDE_SCM} in
40 *) die "KDE_SCM: ${KDE_SCM} is not supported" ;;
41 esac
42
43 +# @FUNCTION: kde4_lingua_to_l10n
44 +# @USAGE: <lingua>...
45 +# @INTERNAL
46 +# @DESCRIPTION:
47 +# Output l10n flag name(s) (without prefix(es)) appropriate for given KDE
48 +# locale(s).
49 +kde4_lingua_to_l10n() {
50 + local l
51 + for l; do
52 + case ${l} in
53 + ca@valencia) echo ca-valencia;;
54 + sr@ijekavian) echo sr-ijekavsk;;
55 + sr@ijekavianlatin) echo sr-Latn-ijekavsk;;
56 + sr@latin|sr@Latn) echo sr-Latn;;
57 + uz@cyrillic) echo uz-Cyrl;;
58 + *@*) die "${FUNCNAME}: Unhandled KDE_LINGUAS: ${l}";;
59 + *) echo "${l/_/-}";;
60 + esac
61 + done
62 +}
63 +
64 # @ECLASS-VARIABLE: KDE_LINGUAS
65 # @DESCRIPTION:
66 # This is a whitespace-separated list of translations this ebuild supports.
67 @@ -86,8 +107,8 @@ esac
68 #
69 # Example: KDE_LINGUAS="de en_GB nl"
70 if [[ ${KDE_BUILD_TYPE} != live || -n ${KDE_LINGUAS_LIVE_OVERRIDE} ]]; then
71 - for _lingua in ${KDE_LINGUAS}; do
72 - IUSE="${IUSE} linguas_${_lingua}"
73 + for _lingua in $(kde4_lingua_to_l10n ${KDE_LINGUAS}); do
74 + IUSE="${IUSE} l10n_${_lingua}"
75 done
76 fi
77
78 @@ -139,7 +160,7 @@ comment_all_add_subdirectory() {
79
80 # @FUNCTION: enable_selected_linguas
81 # @DESCRIPTION:
82 -# Enable translations based on LINGUAS settings and translations supported by
83 +# Enable translations based on L10N settings and translations supported by
84 # the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po
85 # but this default can be overridden by defining KDE_LINGUAS_DIR.
86 enable_selected_linguas() {
87 @@ -147,11 +168,6 @@ enable_selected_linguas() {
88
89 local x
90
91 - # if there is no linguas defined we enable everything
92 - if ! $(env | grep -q "^LINGUAS="); then
93 - return 0
94 - fi
95 -
96 # @ECLASS-VARIABLE: KDE_LINGUAS_DIR
97 # @DESCRIPTION:
98 # Specified folder where application translations are located.
99 @@ -171,7 +187,7 @@ enable_selected_linguas() {
100
101 # @FUNCTION: enable_selected_doc_linguas
102 # @DESCRIPTION:
103 -# Enable only selected linguas enabled doc folders.
104 +# Enable only selected L10N enabled doc folders.
105 enable_selected_doc_linguas() {
106 debug-print-function ${FUNCNAME} "$@"
107
108 @@ -195,11 +211,6 @@ enable_selected_doc_linguas() {
109 -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \
110 -i CMakeLists.txt || die 'failed to comment out all handbooks'
111 else
112 - # if there is no linguas defined we enable everything (i.e. comment out nothing)
113 - if ! $(env | grep -q "^LINGUAS="); then
114 - return 0
115 - fi
116 -
117 # Disable subdirectories recursively
118 comment_all_add_subdirectory "${handbookdir}"
119
120 @@ -213,7 +224,7 @@ enable_selected_doc_linguas() {
121 # Add requested translations
122 local lingua
123 for lingua in en ${KDE_LINGUAS}; do
124 - if [[ ${lingua} = en ]] || use linguas_${lingua}; then
125 + if [[ ${lingua} = en ]] || use "l10n_$(kde4_lingua_to_l10n "${lingua}")"; then
126 if [[ -d ${handbookdir}/${translationdir//%lingua/${lingua}} ]]; then
127 sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${translationdir//%lingua/${lingua}}/s/^#DONOTCOMPILE //" \
128 -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${translationdir//%lingua/${lingua}}/s/^#DONOTCOMPILE //" \
129 @@ -376,7 +387,7 @@ _enable_selected_linguas_dir() {
130 done
131
132 for lingua in ${KDE_LINGUAS}; do
133 - if use linguas_${lingua} ; then
134 + if use "l10n_$(kde4_lingua_to_l10n ${lingua})" ; then
135 if [[ -d ${lingua} ]]; then
136 linguas="${linguas} ${lingua}"
137 sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \