Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o, NP-Hardass <NP-Hardass@g.o>
Subject: Re: [gentoo-dev] [RFC] New eclass: mate
Date: Fri, 10 Jun 2016 10:44:39
Message-Id: 064C1A6F-4859-403C-A02F-81A5D9308CA0@gentoo.org
In Reply to: Re: [gentoo-dev] [RFC] New eclass: mate by NP-Hardass
1 Dnia 9 czerwca 2016 14:19:43 CEST, NP-Hardass <NP-Hardass@g.o> napisał(a):
2 >Greetings all,
3 >
4 >Sorry for the delay, had lots of recurrent hardware issues the last
5 >month or so.
6 >I will be adding this to the MATE project repo after I get your
7 >feedback, and then into Gentoo repo after I've had some users test out
8 >the new packages/eclass.
9 >
10 >Just a reminder/summary:
11 >There are 40-50 ebuilds in the MATE desktop environment, with a fair
12 >bit
13 >of overlap in the ebuild code, so I thought it best to create an eclass
14 >to handle that. MATE is a fork of GNOME 2 so I used the gnome.org
15 >eclass as a reference for the mate-desktop.org eclass. Additionally,
16 >there is much in MATE that is still very much in line with the gnome2
17 >eclass. Rather than having to edit 40-50 ebuilds if we become
18 >divergent, I thought it more purdent to just create a separete mate_*
19 >namespace. For functions that are currently equivalent, my phase
20 >functions are stubs to the gnome2 phase functions.
21 >
22 >
23 >Thanks for taking the time to look these over and give your feedback.
24 >(Also, apologies for the thrown together email, I was having trouble
25 >getting git-send working to the mailing list)
26 >
27 >--
28 >NP-Hardass
29 >
30 >###############################################################################
31 >mate-desktop.org.eclass
32 >###############################################################################
33 >
34 >
35 ># Copyright 1999-2016 Gentoo Foundation
36 ># Distributed under the terms of the GNU General Public License v2
37 ># $Id$
38 >
39 ># @ECLASS: mate-desktop.org.eclass
40 ># @MAINTAINER:
41 ># mate@g.o
42 ># @AUTHOR:
43 ># Authors: NP-Hardass <NP-Hardass@g.o> based upon the gnome.org
44 >eclass.
45 ># @BLURB: Helper eclass for mate-desktop.org hosted archives
46 ># @DESCRIPTION:
47 ># Provide a default SRC_URI and EGIT_REPO_URI for MATE packages as well
48 >as
49 ># exporting some useful values like the MATE_BRANCH
50 >
51 ># Old EAPIs are banned.
52 >case "${EAPI:-0}" in
53 > 5|6) ;;
54 > *) die "EAPI=${EAPI} is not supported" ;;
55 >esac
56 >
57 >if [[ ${PV} == 9999 ]]; then
58 > inherit git-r3
59 >else
60 > inherit versionator
61 >fi
62 >
63 ># Ensure availibility of xz-utils on old EAPIs
64 >if [[ "${EAPI:-0}" -lt "6" ]]; then
65
66 EAPI is not a number and must not be treated like a number.
67
68 > DEPEND="app-arch/xz-utils"
69 >fi
70 >
71 ># @ECLASS-VARIABLE: MATE_TARBALL_SUFFIX
72 ># @INTERNAL
73 ># @DESCRIPTION:
74 ># All projects hosted on mate-desktop.org provide tarballs as tar.xz.
75 ># Undefined in live ebuilds.
76 >[[ ${PV} != 9999 ]] && : ${MATE_TARBALL_SUFFIX:="xz"}
77
78 You should ask upstream to supply .tar.lz instead, so they don't harm their users.
79
80 >
81 ># @ECLASS-VARIABLE: MATE_DESKTOP_ORG_PN
82 ># @DESCRIPTION:
83 ># Name of the package as hosted on mate-desktop.org.
84 ># Leave unset if package name matches PN.
85 >: ${MATE_DESKTOP_ORG_PN:=$PN}
86 >
87 ># @ECLASS-VARIABLE: MATE_DESKTOP_ORG_PV
88 ># @DESCRIPTION:
89 ># Package version string as listed on mate-desktop.org.
90 ># Leave unset if package version string matches PV.
91 >: ${MATE_DESKTOP_ORG_PV:=$PV}
92 >
93 ># @ECLASS-VARIABLE: MATE_BRANCH
94 ># @DESCRIPTION:
95 ># Major and minor numbers of the version number, unless live.
96 ># If live ebuild, will be set to '9999'.
97 >if [[ ${PV} == 9999 ]]; then
98 > : ${MATE_BRANCH:=9999}
99 >else
100 > : ${MATE_BRANCH:=$(get_version_component_range 1-2)}
101 >fi
102
103 Unless I'm missing something, the 1-2 range will return 9999 in live version as well. Unless you are trying to avoid the inherit in the live ebuild -- then I don't think it's worth the extra code.
104
105 >
106 ># Set SRC_URI or EGIT_REPO_URI based on whether live
107 >if [[ ${PV} == 9999 ]]; then
108 > EGIT_REPO_URI="
109 > https://github.com/mate-desktop/${MATE_DESKTOP_ORG_PN}.git
110 > git://github.com/mate-desktop/${MATE_DESKTOP_ORG_PN}.git
111 > http://github.com/mate-desktop/${MATE_DESKTOP_ORG_PN}.git
112
113 Does github actually support http?
114
115 > "
116 > SRC_URI=""
117 >else
118 > SRC_URI="http://pub.mate-desktop.org/releases/${MATE_BRANCH}/${MATE_DESKTOP_ORG_PN}-${MATE_DESKTOP_ORG_PV}.tar.${MATE_TARBALL_SUFFIX}"
119 >fi
120 >
121 ># Set HOMEPAGE for all ebuilds
122 >HOMEPAGE="http://mate-desktop.org"
123 >
124 ># Set default SLOT for all ebuilds
125 >SLOT="0"
126
127 Don't do that. Ebuilds without explicit SLOT are less readable.
128
129 >
130 >
131 >###############################################################################
132 >mate.eclass
133 >###############################################################################
134 >
135 >
136 ># Copyright 1999-2016 Gentoo Foundation
137 ># Distributed under the terms of the GNU General Public License v2
138 ># $Id$
139 >
140 ># @ECLASS: mate.eclass
141 ># @MAINTAINER:
142 ># mate@g.o
143 ># @AUTHOR:
144 ># Authors: NP-Hardass <NP-Hardass@g.o> based upon the gnome2
145 ># and autotools-utils eclasses
146 ># @BLURB: Provides phases for MATE based packages.
147 ># @DESCRIPTION:
148 ># Exports portage base functions used by ebuilds written for packages
149 >using the
150 ># MATE framework. Occassionally acts as a wrapper to gnome2 due to the
151 ># fact that MATE is a GNOME fork. For additional functions, see
152 >gnome2-utils.eclass.
153 >
154 ># Check EAPI only
155 >case "${EAPI:-0}" in
156 > 5|6) ;;
157 > *) die "EAPI=${EAPI} is not supported" ;;
158 >esac
159 >
160 ># Inherit happens below after declaration of GNOME2_LA_PUNT
161 >
162 ># @ECLASS-VARIABLE: MATE_LA_PUNT
163 ># @DESCRIPTION:
164 ># Available values for MATE_LA_PUNT:
165 ># - "no": will not clean any .la files
166 ># - "yes": will run prune_libtool_files --modules
167 ># - If it is not set, it will run prune_libtool_files
168 ># MATE_LA_PUNT is a stub to GNOME2_LA_PUNT
169 >GNOME2_LA_PUNT=${MATE_LA_PUNT:-""}
170 >
171 >inherit gnome2 autotools mate-desktop.org
172 >
173 >case "${EAPI:-0}" in
174 > 5|6)
175 > EXPORT_FUNCTIONS src_prepare src_configure src_install pkg_preinst
176 >pkg_postinst pkg_postrm
177 > ;;
178 > *) die "EAPI=${EAPI} is not supported" ;;
179
180 It is already dead after the first check.
181
182 >esac
183 >
184 ># Autotools requires our MATE m4 files
185 >DEPEND=">=mate-base/mate-common-${MATE_BRANCH}"
186 >
187 ># @FUNCTION: python_cond_func_wrap
188 ># @DESCRIPTION: Wraps a function for conditional python use, to run for
189 >each
190 ># python implementation in the build directory.
191 >python_cond_func_wrap() {
192 > if use python; then
193 > python_foreach_impl run_in_build_dir "$@"
194 > else
195 > $@
196 > fi
197 >}
198 >
199 ># @ECLASS-VARIABLE: FORCE_AUTORECONF
200
201 Namespace needed.
202
203 ># @DESCRIPTION:
204 ># Available values for FORCE_AUTORECONF:
205 ># - true: will always run eautoreconf
206 ># - false: will default to automatic detect
207 ># - If it is not set, it will default to false
208 >FORCE_AUTORECONF=${FORCE_AUTORECONF:-""}
209 >
210 ># @FUNCTION: ematedocize
211 ># @DESCRIPTION: A wrapper around mate-doc-common
212 >ematedocize() {
213 > ebegin "Running mate-doc-common --copy"
214 > mate-doc-common --copy || die
215 > eend $?
216 >}
217 >
218 ># @FUNCTION: want_mate_doc
219 ># @DESCRIPTION:
220 ># Returns true/false based on whether eautoreconf should call
221 ># ematedocize
222 >want_mate_doc() {
223 > grep -q USE_COMMON_DOC_BUILD autogen.sh
224
225 Did you really intend to match autogen.sh and not configure.ac or alike?
226
227 >}
228 >
229 ># @FUNCTION: mate_src_prepare
230 ># @DESCRIPTION:
231 ># Call gnome2_src_prepare to handle environment setup and patching,
232 >then
233 ># call eautoreconf if necessary
234 >mate_src_prepare() {
235 > debug-print-function ${FUNCNAME} "$@"
236 >
237 > local force_autoreconf=${FORCE_AUTORECONF:-false}
238 > [[ ${PV} == 9999 ]] && force_autoreconf=true
239 >
240 > gen_chksum() {
241 > find '(' -name 'Makefile.am' \
242 > -o -name 'configure.ac' \
243 > -o -name 'configure.in' ')' \
244 > -exec cksum {} + | sort -k2
245 > }
246 >
247 > local chksum=$(gen_chksum)
248 >
249 > gnome2_src_prepare "$@"
250 >
251 > if ${force_autoreconf}
252
253 Don't execute random user-provided data.
254
255 > || [[ ${chksum} != $(gen_chksum) ]]; then
256 > [[ want_mate_doc ]] && ematedocize
257
258 Missing ${}.
259
260 > eautoreconf
261 > fi
262 >}
263 >
264 ># @FUNCTION: mate_src_configure
265 ># @DESCRIPTION:
266 ># MATE specific configure handling
267 ># Stub to gnome2_src_configure()
268 >mate_src_configure() {
269 > gnome2_src_configure "$@"
270 >}
271 >
272 ># @FUNCTION: mate_src_install
273 ># @DESCRIPTION:
274 ># MATE specific install. Stub to gnome2_src_install
275 >mate_src_install() {
276 > gnome2_src_install "$@"
277 >}
278 >
279 ># @FUNCTION: mate_pkg_preinst
280 ># @DESCRIPTION:
281 ># Finds Icons, GConf and GSettings schemas for later handling in
282 >pkg_postinst
283 ># Stub to gnome2_pkg_preinst
284 >mate_pkg_preinst() {
285 > gnome2_pkg_preinst "$@"
286 >}
287 >
288 ># @FUNCTION: mate_pkg_postinst
289 ># @DESCRIPTION:
290 ># Handle scrollkeeper, GConf, GSettings, Icons, desktop and mime
291 ># database updates.
292 ># Stub to gnome2_pkg_postinst
293 >mate_pkg_postinst() {
294 > gnome2_pkg_postinst "$@"
295 >}
296 >
297 ># @FUNCTION: mate_pkg_postrm
298 ># @DESCRIPTION:
299 ># Handle scrollkeeper, GSettings, Icons, desktop and mime database
300 >updates.
301 ># Stub to gnome2_pkg_postrm
302 >mate_pkg_postrm() {
303 > gnome2_pkg_postrm "$@"
304 >}
305
306
307 --
308 Best regards,
309 Michał Górny (by phone)

Replies

Subject Author
Re: [gentoo-dev] [RFC] New eclass: mate NP-Hardass <NP-Hardass@g.o>