1 |
Signed-off-by: Ulrich Müller <ulm@g.o> |
2 |
--- |
3 |
eclass/eutils.eclass | 53 ++------------------------------------------ |
4 |
eclass/l10n.eclass | 47 +++++++++++++++++++++++++++++++++++++++ |
5 |
2 files changed, 49 insertions(+), 51 deletions(-) |
6 |
|
7 |
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass |
8 |
index 0072f4ccf3e7..cd59d3f9ccc4 100644 |
9 |
--- a/eclass/eutils.eclass |
10 |
+++ b/eclass/eutils.eclass |
11 |
@@ -21,10 +21,10 @@ _EUTILS_ECLASS=1 |
12 |
# implicitly inherited (now split) eclasses |
13 |
case ${EAPI:-0} in |
14 |
0|1|2|3|4|5|6) |
15 |
- inherit desktop edos2unix epatch estack ltprune multilib \ |
16 |
+ inherit desktop edos2unix epatch estack l10n ltprune multilib \ |
17 |
preserve-libs toolchain-funcs vcs-clean wrapper |
18 |
;; |
19 |
- 7) inherit edos2unix wrapper ;; |
20 |
+ 7) inherit edos2unix l10n wrapper ;; |
21 |
*) die "${ECLASS} is banned in EAPI ${EAPI}" ;; |
22 |
esac |
23 |
|
24 |
@@ -63,55 +63,6 @@ emktemp() { |
25 |
fi |
26 |
} |
27 |
|
28 |
-# @FUNCTION: strip-linguas |
29 |
-# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>] |
30 |
-# @DESCRIPTION: |
31 |
-# Make sure that LINGUAS only contains languages that |
32 |
-# a package can support. The first form allows you to |
33 |
-# specify a list of LINGUAS. The -i builds a list of po |
34 |
-# files found in all the directories and uses the |
35 |
-# intersection of the lists. The -u builds a list of po |
36 |
-# files found in all the directories and uses the union |
37 |
-# of the lists. |
38 |
-strip-linguas() { |
39 |
- local ls newls nols |
40 |
- if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then |
41 |
- local op=$1; shift |
42 |
- ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift |
43 |
- local d f |
44 |
- for d in "$@" ; do |
45 |
- if [[ ${op} == "-u" ]] ; then |
46 |
- newls=${ls} |
47 |
- else |
48 |
- newls="" |
49 |
- fi |
50 |
- for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do |
51 |
- if [[ ${op} == "-i" ]] ; then |
52 |
- has ${f} ${ls} && newls="${newls} ${f}" |
53 |
- else |
54 |
- has ${f} ${ls} || newls="${newls} ${f}" |
55 |
- fi |
56 |
- done |
57 |
- ls=${newls} |
58 |
- done |
59 |
- else |
60 |
- ls="$@" |
61 |
- fi |
62 |
- |
63 |
- nols="" |
64 |
- newls="" |
65 |
- for f in ${LINGUAS} ; do |
66 |
- if has ${f} ${ls} ; then |
67 |
- newls="${newls} ${f}" |
68 |
- else |
69 |
- nols="${nols} ${f}" |
70 |
- fi |
71 |
- done |
72 |
- [[ -n ${nols} ]] \ |
73 |
- && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols} |
74 |
- export LINGUAS=${newls:1} |
75 |
-} |
76 |
- |
77 |
path_exists() { |
78 |
eerror "path_exists has been removed. Please see the following post" |
79 |
eerror "for a replacement snippet:" |
80 |
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass |
81 |
index 73d54ec22334..7bd8f382fbe3 100644 |
82 |
--- a/eclass/l10n.eclass |
83 |
+++ b/eclass/l10n.eclass |
84 |
@@ -124,4 +124,51 @@ l10n_get_locales() { |
85 |
printf "%s" "${locs}" |
86 |
} |
87 |
|
88 |
+# @FUNCTION: strip-linguas |
89 |
+# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>] |
90 |
+# @DESCRIPTION: |
91 |
+# Make sure that LINGUAS only contains languages that a package can |
92 |
+# support. The first form allows you to specify a list of LINGUAS. |
93 |
+# The -i builds a list of po files found in all the directories and uses |
94 |
+# the intersection of the lists. The -u builds a list of po files found |
95 |
+# in all the directories and uses the union of the lists. |
96 |
+strip-linguas() { |
97 |
+ local ls newls nols |
98 |
+ if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then |
99 |
+ local op=$1; shift |
100 |
+ ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift |
101 |
+ local d f |
102 |
+ for d in "$@" ; do |
103 |
+ if [[ ${op} == "-u" ]] ; then |
104 |
+ newls=${ls} |
105 |
+ else |
106 |
+ newls="" |
107 |
+ fi |
108 |
+ for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do |
109 |
+ if [[ ${op} == "-i" ]] ; then |
110 |
+ has ${f} ${ls} && newls="${newls} ${f}" |
111 |
+ else |
112 |
+ has ${f} ${ls} || newls="${newls} ${f}" |
113 |
+ fi |
114 |
+ done |
115 |
+ ls=${newls} |
116 |
+ done |
117 |
+ else |
118 |
+ ls="$@" |
119 |
+ fi |
120 |
+ |
121 |
+ nols="" |
122 |
+ newls="" |
123 |
+ for f in ${LINGUAS} ; do |
124 |
+ if has ${f} ${ls} ; then |
125 |
+ newls="${newls} ${f}" |
126 |
+ else |
127 |
+ nols="${nols} ${f}" |
128 |
+ fi |
129 |
+ done |
130 |
+ [[ -n ${nols} ]] \ |
131 |
+ && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols} |
132 |
+ export LINGUAS=${newls:1} |
133 |
+} |
134 |
+ |
135 |
fi |
136 |
-- |
137 |
2.28.0 |