summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2020-09-09 17:22:54 +0200
committerUlrich Müller <ulm@gentoo.org>2020-09-12 18:03:01 +0200
commit7f7a5fcd36ef44dab65639809f49590760f49b68 (patch)
tree0614fa0b1f252eeb066f71d474ae0a5be9c15cdd /eclass
parentl10n.eclass: Add conditional to prevent multiple inclusion. (diff)
downloadgentoo-7f7a5fcd36ef44dab65639809f49590760f49b68.tar.gz
gentoo-7f7a5fcd36ef44dab65639809f49590760f49b68.tar.bz2
gentoo-7f7a5fcd36ef44dab65639809f49590760f49b68.zip
l10n.eclass: strip-linguas() moved from eutils to here.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/eutils.eclass53
-rw-r--r--eclass/l10n.eclass47
2 files changed, 49 insertions, 51 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 0072f4ccf3e7..cd59d3f9ccc4 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -21,10 +21,10 @@ _EUTILS_ECLASS=1
# implicitly inherited (now split) eclasses
case ${EAPI:-0} in
0|1|2|3|4|5|6)
- inherit desktop edos2unix epatch estack ltprune multilib \
+ inherit desktop edos2unix epatch estack l10n ltprune multilib \
preserve-libs toolchain-funcs vcs-clean wrapper
;;
- 7) inherit edos2unix wrapper ;;
+ 7) inherit edos2unix l10n wrapper ;;
*) die "${ECLASS} is banned in EAPI ${EAPI}" ;;
esac
@@ -63,55 +63,6 @@ emktemp() {
fi
}
-# @FUNCTION: strip-linguas
-# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
-# @DESCRIPTION:
-# Make sure that LINGUAS only contains languages that
-# a package can support. The first form allows you to
-# specify a list of LINGUAS. The -i builds a list of po
-# files found in all the directories and uses the
-# intersection of the lists. The -u builds a list of po
-# files found in all the directories and uses the union
-# of the lists.
-strip-linguas() {
- local ls newls nols
- if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
- local op=$1; shift
- ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift
- local d f
- for d in "$@" ; do
- if [[ ${op} == "-u" ]] ; then
- newls=${ls}
- else
- newls=""
- fi
- for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do
- if [[ ${op} == "-i" ]] ; then
- has ${f} ${ls} && newls="${newls} ${f}"
- else
- has ${f} ${ls} || newls="${newls} ${f}"
- fi
- done
- ls=${newls}
- done
- else
- ls="$@"
- fi
-
- nols=""
- newls=""
- for f in ${LINGUAS} ; do
- if has ${f} ${ls} ; then
- newls="${newls} ${f}"
- else
- nols="${nols} ${f}"
- fi
- done
- [[ -n ${nols} ]] \
- && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols}
- export LINGUAS=${newls:1}
-}
-
path_exists() {
eerror "path_exists has been removed. Please see the following post"
eerror "for a replacement snippet:"
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
index 73d54ec22334..7bd8f382fbe3 100644
--- a/eclass/l10n.eclass
+++ b/eclass/l10n.eclass
@@ -124,4 +124,51 @@ l10n_get_locales() {
printf "%s" "${locs}"
}
+# @FUNCTION: strip-linguas
+# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
+# @DESCRIPTION:
+# Make sure that LINGUAS only contains languages that a package can
+# support. The first form allows you to specify a list of LINGUAS.
+# The -i builds a list of po files found in all the directories and uses
+# the intersection of the lists. The -u builds a list of po files found
+# in all the directories and uses the union of the lists.
+strip-linguas() {
+ local ls newls nols
+ if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
+ local op=$1; shift
+ ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift
+ local d f
+ for d in "$@" ; do
+ if [[ ${op} == "-u" ]] ; then
+ newls=${ls}
+ else
+ newls=""
+ fi
+ for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do
+ if [[ ${op} == "-i" ]] ; then
+ has ${f} ${ls} && newls="${newls} ${f}"
+ else
+ has ${f} ${ls} || newls="${newls} ${f}"
+ fi
+ done
+ ls=${newls}
+ done
+ else
+ ls="$@"
+ fi
+
+ nols=""
+ newls=""
+ for f in ${LINGUAS} ; do
+ if has ${f} ${ls} ; then
+ newls="${newls} ${f}"
+ else
+ nols="${nols} ${f}"
+ fi
+ done
+ [[ -n ${nols} ]] \
+ && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols}
+ export LINGUAS=${newls:1}
+}
+
fi