summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2021-06-23 15:24:29 +0200
committerUlrich Müller <ulm@gentoo.org>2021-06-26 19:06:00 +0200
commit48651ecc0d4444536ed15b06736e331238b6f92b (patch)
treed78b1514a1fa404d3d33383e7cdfcd2a6c09db82 /eclass/l10n.eclass
parentl10n.eclass: Minor touchup of EAPI conditional (diff)
downloadgentoo-48651ecc0d4444536ed15b06736e331238b6f92b.tar.gz
gentoo-48651ecc0d4444536ed15b06736e331238b6f92b.tar.bz2
gentoo-48651ecc0d4444536ed15b06736e331238b6f92b.zip
strip-linguas.eclass: New eclass, split off from l10n
Originally strip-linguas() was part of eutils.eclass. It was moved to l10n.eclass in late 2020, but there are few (if any) ebuilds using strip-linguas and the other functions from l10n. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'eclass/l10n.eclass')
-rw-r--r--eclass/l10n.eclass49
1 files changed, 2 insertions, 47 deletions
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
index a9d7d2f76be9..b1dff96ded12 100644
--- a/eclass/l10n.eclass
+++ b/eclass/l10n.eclass
@@ -20,6 +20,8 @@ case ${EAPI} in
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
+inherit strip-linguas
+
if [[ -z ${_L10N_ECLASS} ]]; then
_L10N_ECLASS=1
@@ -130,51 +132,4 @@ 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