W dniu wto, 24.04.2018 o godzinie 23∶03 -0500, użytkownik Marty E.
Plummer napisał:
> Reworked to be usable with app-dicts/dictd-* ebuilds to avoid code
> duplication
> 
> You can reference this pull request to get an idea as to the usage.
> 
> https://github.com/gentoo/gentoo/pull/8106
> 
> Package-Manager: Portage-2.3.31, Repoman-2.3.9
> ---
>  eclass/dict.eclass     | 75 ++++++++++++++++++++++++++++++++++++++++++
>  eclass/freedict.eclass | 51 ----------------------------
>  2 files changed, 75 insertions(+), 51 deletions(-)
>  create mode 100644 eclass/dict.eclass
>  delete mode 100644 eclass/freedict.eclass
> 
> diff --git a/eclass/dict.eclass b/eclass/dict.eclass
> new file mode 100644
> index 00000000000..8d523e3863e
> --- /dev/null
> +++ b/eclass/dict.eclass
> @@ -0,0 +1,75 @@
> +# Copyright 1999-2018 Gentoo Foundation
> +# Distributed under the terms of the GNU General Public License v2
> +
> +# @ECLASS: dict.eclass
> +# @MAINTAINER:
> +# maintainer-nee...@gentoo.org
> +# @AUTHOR:
> +# Original author: Seemant Kulleen
> +# @BLURB: Ease the installation of dict and freedict translation dictionaries
> +# @DESCRIPTION:
> +# This eclass exists to ease the installation of dictd and freedictd 
> translation
> +# dictionaries.  The only variables which need to be defined in the actual
> +# ebuilds are FORLANG and TOLANG for the source and target languages,
> +# respectively, and DICTS if the package ships more than one dictionary
> +# and cannot be determined from ${PN}.
> +
> +# @ECLASS-VARIABLE: DICTS
> +# @DESCRIPTION:
> +# Array of dictionary files (foo.dict.dz and foo.index) to be installed 
> during
> +# dict_src_install.
> +
> +# @ECLASS-VARIABLE: FORLANG
> +# @DESCRIPTION:
> +# Please see above for a description.
> +
> +# @ECLASS-VARIABLE: TOLANG
> +# @DESCRIPTION:
> +# Please see above for a description.

I don't see those two being used anywhere.

> +
> +if [[ -z ${_DICT_ECLASS} ]]; then
> +_DICT_ECLASS=1
> +
> +case ${EAPI:-0} in
> +     6) ;;
> +     *) die "${ECLASS}.eclass is banned in EAPI=${EAPI}" ;;
> +esac
> +
> +if [[ ${PN} == *freedict-* ]]; then
> +     MY_P=${PN/freedict-/}
> +     DICTS=( ${MY_P} )
> +
> +     DESCRIPTION="Freedict for language translation from ${FORLANG} to 
> ${TOLANG}"
> +     HOMEPAGE="http://freedict.sourceforge.net/";
> +     SRC_URI="http://freedict.sourceforge.net/download/linux/${MY_P}.tar.gz";
> +elif [[ ${PN} == *dictd-* ]]; then
> +     MY_P=${PN/dictd-/}
> +     DICTS=( ${MY_P} )
> +
> +     DESCRIPTION="${MY_P} dictionary for dictd"
> +     HOMEPAGE="http://www.dict.org/";
> +fi
> +
> +LICENSE="GPL-2+"
> +SLOT="0"
> +IUSE=""
> +
> +RDEPEND="app-text/dictd"

Why the RDEPEND?  The packages seem only to install data files (without
calling any extra tools or anything), so I don't see why they need to
depend on anything.

> 
> +
> +S="${WORKDIR}"
> +
> +# @FUNCTION: dict_src_install
> +# @DESCRIPTION:
> +# The freedict src_install function, which is exported
> +dict_src_install() {
> +     insinto /usr/$(get_libdir)/dict
> +     for dict in "${DICTS[@]}"; do
> +             doins ${dict}.dict.dz
> +             doins ${dict}.index
> +     done
> +     einstalldocs
> +}
> +
> +EXPORT_FUNCTIONS src_install
> +
> +fi

That said, I don't really see any gain from having this eclass, really.

-- 
Best regards,
Michał Górny


Reply via email to