Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Marty E. Plummer" <hanetzer@×××××××××.com>
Subject: Re: [gentoo-dev] [PATCH] freedict.eclass: rename dict.eclass, generalize
Date: Wed, 25 Apr 2018 07:00:25
Message-Id: 1524639604.1104.19.camel@gentoo.org
In Reply to: [gentoo-dev] [PATCH] freedict.eclass: rename dict.eclass, generalize by "Marty E. Plummer"
1 W dniu wto, 24.04.2018 o godzinie 23∶03 -0500, użytkownik Marty E.
2 Plummer napisał:
3 > Reworked to be usable with app-dicts/dictd-* ebuilds to avoid code
4 > duplication
5 >
6 > You can reference this pull request to get an idea as to the usage.
7 >
8 > https://github.com/gentoo/gentoo/pull/8106
9 >
10 > Package-Manager: Portage-2.3.31, Repoman-2.3.9
11 > ---
12 > eclass/dict.eclass | 75 ++++++++++++++++++++++++++++++++++++++++++
13 > eclass/freedict.eclass | 51 ----------------------------
14 > 2 files changed, 75 insertions(+), 51 deletions(-)
15 > create mode 100644 eclass/dict.eclass
16 > delete mode 100644 eclass/freedict.eclass
17 >
18 > diff --git a/eclass/dict.eclass b/eclass/dict.eclass
19 > new file mode 100644
20 > index 00000000000..8d523e3863e
21 > --- /dev/null
22 > +++ b/eclass/dict.eclass
23 > @@ -0,0 +1,75 @@
24 > +# Copyright 1999-2018 Gentoo Foundation
25 > +# Distributed under the terms of the GNU General Public License v2
26 > +
27 > +# @ECLASS: dict.eclass
28 > +# @MAINTAINER:
29 > +# maintainer-needed@g.o
30 > +# @AUTHOR:
31 > +# Original author: Seemant Kulleen
32 > +# @BLURB: Ease the installation of dict and freedict translation dictionaries
33 > +# @DESCRIPTION:
34 > +# This eclass exists to ease the installation of dictd and freedictd translation
35 > +# dictionaries. The only variables which need to be defined in the actual
36 > +# ebuilds are FORLANG and TOLANG for the source and target languages,
37 > +# respectively, and DICTS if the package ships more than one dictionary
38 > +# and cannot be determined from ${PN}.
39 > +
40 > +# @ECLASS-VARIABLE: DICTS
41 > +# @DESCRIPTION:
42 > +# Array of dictionary files (foo.dict.dz and foo.index) to be installed during
43 > +# dict_src_install.
44 > +
45 > +# @ECLASS-VARIABLE: FORLANG
46 > +# @DESCRIPTION:
47 > +# Please see above for a description.
48 > +
49 > +# @ECLASS-VARIABLE: TOLANG
50 > +# @DESCRIPTION:
51 > +# Please see above for a description.
52
53 I don't see those two being used anywhere.
54
55 > +
56 > +if [[ -z ${_DICT_ECLASS} ]]; then
57 > +_DICT_ECLASS=1
58 > +
59 > +case ${EAPI:-0} in
60 > + 6) ;;
61 > + *) die "${ECLASS}.eclass is banned in EAPI=${EAPI}" ;;
62 > +esac
63 > +
64 > +if [[ ${PN} == *freedict-* ]]; then
65 > + MY_P=${PN/freedict-/}
66 > + DICTS=( ${MY_P} )
67 > +
68 > + DESCRIPTION="Freedict for language translation from ${FORLANG} to ${TOLANG}"
69 > + HOMEPAGE="http://freedict.sourceforge.net/"
70 > + SRC_URI="http://freedict.sourceforge.net/download/linux/${MY_P}.tar.gz"
71 > +elif [[ ${PN} == *dictd-* ]]; then
72 > + MY_P=${PN/dictd-/}
73 > + DICTS=( ${MY_P} )
74 > +
75 > + DESCRIPTION="${MY_P} dictionary for dictd"
76 > + HOMEPAGE="http://www.dict.org/"
77 > +fi
78 > +
79 > +LICENSE="GPL-2+"
80 > +SLOT="0"
81 > +IUSE=""
82 > +
83 > +RDEPEND="app-text/dictd"
84
85 Why the RDEPEND? The packages seem only to install data files (without
86 calling any extra tools or anything), so I don't see why they need to
87 depend on anything.
88
89 >
90 > +
91 > +S="${WORKDIR}"
92 > +
93 > +# @FUNCTION: dict_src_install
94 > +# @DESCRIPTION:
95 > +# The freedict src_install function, which is exported
96 > +dict_src_install() {
97 > + insinto /usr/$(get_libdir)/dict
98 > + for dict in "${DICTS[@]}"; do
99 > + doins ${dict}.dict.dz
100 > + doins ${dict}.index
101 > + done
102 > + einstalldocs
103 > +}
104 > +
105 > +EXPORT_FUNCTIONS src_install
106 > +
107 > +fi
108
109 That said, I don't really see any gain from having this eclass, really.
110
111 --
112 Best regards,
113 Michał Górny