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