Gentoo Archives: gentoo-dev

From: "Marty E. Plummer" <hanetzer@×××××××××.com>
To: gentoo-dev@l.g.o
Cc: "Marty E. Plummer" <hanetzer@×××××××××.com>
Subject: [gentoo-dev] [PATCH] freedict.eclass: rename dict.eclass, generalize
Date: Wed, 25 Apr 2018 04:04:01
Message-Id: 20180425040344.26168-1-hanetzer@startmail.com
1 Reworked to be usable with app-dicts/dictd-* ebuilds to avoid code
2 duplication
3
4 You can reference this pull request to get an idea as to the usage.
5
6 https://github.com/gentoo/gentoo/pull/8106
7
8 Package-Manager: Portage-2.3.31, Repoman-2.3.9
9 ---
10 eclass/dict.eclass | 75 ++++++++++++++++++++++++++++++++++++++++++
11 eclass/freedict.eclass | 51 ----------------------------
12 2 files changed, 75 insertions(+), 51 deletions(-)
13 create mode 100644 eclass/dict.eclass
14 delete mode 100644 eclass/freedict.eclass
15
16 diff --git a/eclass/dict.eclass b/eclass/dict.eclass
17 new file mode 100644
18 index 00000000000..8d523e3863e
19 --- /dev/null
20 +++ b/eclass/dict.eclass
21 @@ -0,0 +1,75 @@
22 +# Copyright 1999-2018 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +# @ECLASS: dict.eclass
26 +# @MAINTAINER:
27 +# maintainer-needed@g.o
28 +# @AUTHOR:
29 +# Original author: Seemant Kulleen
30 +# @BLURB: Ease the installation of dict and freedict translation dictionaries
31 +# @DESCRIPTION:
32 +# This eclass exists to ease the installation of dictd and freedictd translation
33 +# dictionaries. The only variables which need to be defined in the actual
34 +# ebuilds are FORLANG and TOLANG for the source and target languages,
35 +# respectively, and DICTS if the package ships more than one dictionary
36 +# and cannot be determined from ${PN}.
37 +
38 +# @ECLASS-VARIABLE: DICTS
39 +# @DESCRIPTION:
40 +# Array of dictionary files (foo.dict.dz and foo.index) to be installed during
41 +# dict_src_install.
42 +
43 +# @ECLASS-VARIABLE: FORLANG
44 +# @DESCRIPTION:
45 +# Please see above for a description.
46 +
47 +# @ECLASS-VARIABLE: TOLANG
48 +# @DESCRIPTION:
49 +# Please see above for a description.
50 +
51 +if [[ -z ${_DICT_ECLASS} ]]; then
52 +_DICT_ECLASS=1
53 +
54 +case ${EAPI:-0} in
55 + 6) ;;
56 + *) die "${ECLASS}.eclass is banned in EAPI=${EAPI}" ;;
57 +esac
58 +
59 +if [[ ${PN} == *freedict-* ]]; then
60 + MY_P=${PN/freedict-/}
61 + DICTS=( ${MY_P} )
62 +
63 + DESCRIPTION="Freedict for language translation from ${FORLANG} to ${TOLANG}"
64 + HOMEPAGE="http://freedict.sourceforge.net/"
65 + SRC_URI="http://freedict.sourceforge.net/download/linux/${MY_P}.tar.gz"
66 +elif [[ ${PN} == *dictd-* ]]; then
67 + MY_P=${PN/dictd-/}
68 + DICTS=( ${MY_P} )
69 +
70 + DESCRIPTION="${MY_P} dictionary for dictd"
71 + HOMEPAGE="http://www.dict.org/"
72 +fi
73 +
74 +LICENSE="GPL-2+"
75 +SLOT="0"
76 +IUSE=""
77 +
78 +RDEPEND="app-text/dictd"
79 +
80 +S="${WORKDIR}"
81 +
82 +# @FUNCTION: dict_src_install
83 +# @DESCRIPTION:
84 +# The freedict src_install function, which is exported
85 +dict_src_install() {
86 + insinto /usr/$(get_libdir)/dict
87 + for dict in "${DICTS[@]}"; do
88 + doins ${dict}.dict.dz
89 + doins ${dict}.index
90 + done
91 + einstalldocs
92 +}
93 +
94 +EXPORT_FUNCTIONS src_install
95 +
96 +fi
97 diff --git a/eclass/freedict.eclass b/eclass/freedict.eclass
98 deleted file mode 100644
99 index b795f53f954..00000000000
100 --- a/eclass/freedict.eclass
101 +++ /dev/null
102 @@ -1,51 +0,0 @@
103 -# Copyright 1999-2018 Gentoo Foundation
104 -# Distributed under the terms of the GNU General Public License v2
105 -
106 -# @ECLASS: freedict.eclass
107 -# @MAINTAINER:
108 -# maintainer-needed@g.o
109 -# @AUTHOR:
110 -# Original author: Seemant Kulleen
111 -# @BLURB: Ease the installation of freedict translation dictionaries
112 -# @DESCRIPTION:
113 -# This eclass exists to ease the installation of freedict translation
114 -# dictionaries. The only variables which need to be defined in the actual
115 -# ebuilds are FORLANG and TOLANG for the source and target languages,
116 -# respectively.
117 -
118 -# @ECLASS-VARIABLE: FORLANG
119 -# @DESCRIPTION:
120 -# Please see above for a description.
121 -
122 -# @ECLASS-VARIABLE: TOLANG
123 -# @DESCRIPTION:
124 -# Please see above for a description.
125 -
126 -case ${EAPI:-0} in
127 - 6) ;;
128 - *) die "${ECLASS}.eclass is banned in EAPI=${EAPI}" ;;
129 -esac
130 -
131 -MY_P=${PN/freedict-/}
132 -
133 -DESCRIPTION="Freedict for language translation from ${FORLANG} to ${TOLANG}"
134 -HOMEPAGE="http://freedict.sourceforge.net/"
135 -SRC_URI="http://freedict.sourceforge.net/download/linux/${MY_P}.tar.gz"
136 -
137 -LICENSE="GPL-2+"
138 -SLOT="0"
139 -
140 -RDEPEND="app-text/dictd"
141 -
142 -S="${WORKDIR}"
143 -
144 -# @FUNCTION: freedict_src_install
145 -# @DESCRIPTION:
146 -# The freedict src_install function, which is exported
147 -freedict_src_install() {
148 - insinto /usr/$(get_libdir)/dict
149 - doins ${MY_P}.dict.dz
150 - doins ${MY_P}.index
151 -}
152 -
153 -EXPORT_FUNCTIONS src_install
154 --
155 2.17.0

Replies