Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] l10n.eclass: Disabled locales are the complement of enabled ones.
Date: Fri, 12 Jan 2018 21:50:58
Message-Id: 23129.11703.230929.302098@a1i15.kph.uni-mainz.de
1 Disabled locales returned by l10n_get_locales() should be the
2 complement of enabled locales: disabled = PLOCALES \ enabled.
3
4 So far, in the case of the enabled set falling back to PLOCALE_BACKUP,
5 the backup locale would end up being both enabled and disabled.
6
7 Closes: https://bugs.gentoo.org/547790
8 ---
9 eclass/l10n.eclass | 26 +++++++++++---------------
10 1 file changed, 11 insertions(+), 15 deletions(-)
11
12 diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
13 index 4b0111934d72..82f4ab113f52 100644
14 --- a/eclass/l10n.eclass
15 +++ b/eclass/l10n.eclass
16 @@ -1,4 +1,4 @@
17 -# Copyright 1999-2017 Gentoo Foundation
18 +# Copyright 1999-2018 Gentoo Foundation
19 # Distributed under the terms of the GNU General Public License v2
20
21 # @ECLASS: l10n.eclass
22 @@ -102,26 +102,22 @@ l10n_find_plocales_changes() {
23 # are selected, fall back on PLOCALE_BACKUP. When the disabled argument
24 # is given, return the disabled locales instead of the enabled ones.
25 l10n_get_locales() {
26 - local disabled_locales enabled_locales loc locs
27 + local loc locs
28 if [[ -z ${LINGUAS+set} ]]; then
29 # enable all if unset
30 - enabled_locales=${PLOCALES}
31 - elif [[ -z ${LINGUAS} ]]; then
32 - # disable all if empty
33 - disabled_locales=${PLOCALES}
34 + locs=${PLOCALES}
35 else
36 - for loc in ${PLOCALES}; do
37 - if has ${loc} ${LINGUAS}; then
38 - enabled_locales+="${loc} "
39 - else
40 - disabled_locales+="${loc} "
41 - fi
42 + for loc in ${LINGUAS}; do
43 + has ${loc} ${PLOCALES} && locs+="${loc} "
44 done
45 fi
46 + [[ -z ${locs} ]] && locs=${PLOCALE_BACKUP}
47 if [[ ${1} == disabled ]]; then
48 - locs=${disabled_locales}
49 - else
50 - locs=${enabled_locales:-${PLOCALE_BACKUP}}
51 + local disabled_locs
52 + for loc in ${PLOCALES}; do
53 + has ${loc} ${locs} || disabled_locs+="${loc} "
54 + done
55 + locs=${disabled_locs}
56 fi
57 printf "%s" "${locs}"
58 }
59 --
60 2.15.1

Replies