Gentoo Archives: gentoo-dev

From: Mike Pagano <mpagano@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH 1/1] kernel-2.eclass: Convert eclass to use documentation standards.
Date: Sat, 03 Dec 2016 21:47:29
Message-Id: 595774df-b564-ddea-adc0-241f647f8502@gentoo.org
1 This patch modifies, removes and adds comments only. No code was harmed
2 in the creation of this patch.
3 This is to conform with ECLASS documentation standards.
4
5 ---
6 eclass/kernel-2.eclass | 442
7 +++++++++++++++++++++++++++++++++++++------------
8 1 file changed, 333 insertions(+), 109 deletions(-)
9
10 diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
11 index 91a24e9..b19a396 100644
12 --- a/eclass/kernel-2.eclass
13 +++ b/eclass/kernel-2.eclass
14 @@ -2,89 +2,199 @@
15 # Distributed under the terms of the GNU General Public License v2
16 # $Id$
17
18 -# Description: kernel.eclass rewrite for a clean base regarding the 2.6
19 -# series of kernel with back-compatibility for 2.4
20 -#
21 -# Original author: John Mylchreest <johnm@g.o>
22 -# Maintainer: kernel@g.o
23 -#
24 +# @ECLASS: kernel-2.eclass
25 +# @MAINTAINER:
26 +# Gentoo Kernel project <kernel@g.o>
27 +# @AUTHOR:
28 +# John Mylchreest <johnm@g.o>
29 +# Mike Pagano <mpagano@g.o>
30 +# <so many, many others, please add yourself>
31 +# @BLURB: Eclass for kernel packages
32 +# @DESCRIPTION:
33 +# This ia the kernel.eclass rewrite for a clean base regarding the 2.6
34 +# series of kernel with back-compatibility for 2.4
35 # Please direct your bugs to the current eclass maintainer :)
36 -
37 # added functionality:
38 # unipatch - a flexible, singular method to extract, add and remove
39 patches.
40
41 -# A Couple of env vars are available to effect usage of this eclass
42 -# These are as follows:
43 -#
44 -# K_USEPV - When setting the EXTRAVERSION variable, it should
45 -# add PV to the end.
46 -# this is useful for thigns like wolk. IE:
47 -# EXTRAVERSION would be something like : -wolk-4.19-r1
48 -# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be
49 -# automatically set within the kernel Makefile
50 -# K_NOUSENAME - if this is set then EXTRAVERSION will not include the
51 -# first part of ${PN} in EXTRAVERSION
52 -# K_NOUSEPR - if this is set then EXTRAVERSION will not include the
53 -# anything based on ${PR}.
54 -# K_PREPATCHED - if the patchset is prepatched (ie: mm-sources,
55 -# ck-sources, ac-sources) it will use PR (ie: -r5) as
56 -# the patchset version for
57 -# and not use it as a true package revision
58 -# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in
59 -# postinst and can be used to carry additional postinst
60 -# messages
61 -# K_EXTRAELOG - same as K_EXTRAEINFO except using elog instead of einfo
62 -# K_EXTRAEWARN - same as K_EXTRAEINFO except using ewarn instead of einfo
63 -# K_SYMLINK - if this is set, then forcably create symlink anyway
64 -#
65 -# K_BASE_VER - for git-sources, declare the base version this patch is
66 -# based off of.
67 -# K_DEFCONFIG - Allow specifying a different defconfig target.
68 -# If length zero, defaults to "defconfig".
69 -# K_WANT_GENPATCHES - Apply genpatches to kernel source. Provide any
70 -# combination of "base", "extras" or "experimental".
71 -# K_EXP_GENPATCHES_PULL - If set, we pull "experimental" regardless of
72 the USE FLAG
73 -# but expect the ebuild maintainer to use K_EXP_GENPATCHES_LIST.
74 -# K_EXP_GENPATCHES_NOUSE - If set, no USE flag will be provided for
75 "experimental";
76 -# as a result the user cannot choose to apply those patches.
77 -# K_EXP_GENPATCHES_LIST - A list of patches to pick from "experimental"
78 to apply when
79 -# the USE flag is unset and K_EXP_GENPATCHES_PULL is set.
80 -# K_FROM_GIT - If set, this variable signals that the kernel sources
81 derives from a git tree and special
82 -# handling will be applied so that any patches that are applied
83 will actually apply.
84 -#
85 -# K_GENPATCHES_VER - The version of the genpatches tarball(s) to apply.
86 -# A value of "5" would apply genpatches-2.6.12-5 to
87 -# my-sources-2.6.12.ebuild
88 -# K_SECURITY_UNSUPPORTED- If set, this kernel is unsupported by Gentoo
89 Security
90 -# K_DEBLOB_AVAILABLE - A value of "0" will disable all of the optional
91 deblob
92 -# code. If empty, will be set to "1" if deblobbing is
93 -# possible. Test ONLY for "1".
94 -# K_DEBLOB_TAG - This will be the version of deblob script. It's
95 a upstream SVN tag
96 -# such asw -gnu or -gnu1.
97 -# K_PREDEBLOBBED - This kernel was already deblobbed elsewhere.
98 -# If false, either optional deblobbing will be available
99 -# or the license will note the inclusion of freedist
100 -# code.
101 -# K_LONGTERM - If set, the eclass will search for the kernel source
102 -# in the long term directories on the upstream servers
103 -# as the location has been changed by upstream
104 -# K_KDBUS_AVAILABLE - If set, the ebuild contains the option of
105 installing the
106 -# kdbus patch. This patch is not installed without the 'kdbus'
107 -# and 'experimental' use flags.
108 -# H_SUPPORTEDARCH - this should be a space separated list of ARCH's which
109 -# can be supported by the headers ebuild
110 -
111 -# UNIPATCH_LIST - space delimetered list of patches to be applied to the
112 -# kernel
113 -# UNIPATCH_EXCLUDE - an addition var to support exlusion based completely
114 -# on "<passedstring>*" and not "<passedno#>_*"
115 -# - this should _NOT_ be used from the ebuild as this is
116 -# reserved for end users passing excludes from the cli
117 -# UNIPATCH_DOCS - space delimemeted list of docs to be installed to
118 -# the doc dir
119 -# UNIPATCH_STRICTORDER - if this is set places patches into directories of
120 -# order, so they are applied in the order passed
121 +# @ECLASS-VARIABLE: K_USEPV
122 +# @DEFAULT_UNSET
123 +# @DESCRIPTION:
124 +# When setting the EXTRAVERSION variable, it should
125 +# add PV to the end.
126 +# this is useful for thigns like wolk. IE:
127 +# EXTRAVERSION would be something like : -wolk-4.19-r1
128 +
129 +# @ECLASS-VARIABLE: K_NOSETEXTRAVERSION
130 +# @DEFAULT_UNSET
131 +# @DESCRIPTION:
132 +# if this is set then EXTRAVERSION will not be
133 +# automatically set within the kernel Makefile
134 +
135 +# @ECLASS-VARIABLE: K_NOUSENAME
136 +# @DEFAULT_UNSET
137 +# @DESCRIPTION:
138 +# if this is set then EXTRAVERSION will not include the
139 +# first part of ${PN} in EXTRAVERSION
140 +
141 +# @ECLASS-VARIABLE: K_NOUSEPR
142 +# @DEFAULT_UNSET
143 +# @DESCRIPTION:
144 +# if this is set then EXTRAVERSION will not include the
145 +# anything based on ${PR}.
146 +
147 +# @ECLASS-VARIABLE: K_PREPATCHED
148 +# @DEFAULT_UNSET
149 +# @DESCRIPTION:
150 +# if the patchset is prepatched (ie: mm-sources,
151 +# ck-sources, ac-sources) it will use PR (ie: -r5) as
152 +# the patchset version for
153 +# and not use it as a true package revision
154 +
155 +# @ECLASS-VARIABLE: K_EXTRAEINFO
156 +# @DEFAULT_UNSET
157 +# @DESCRIPTION:
158 +# this is a new-line seperated list of einfo displays in
159 +# postinst and can be used to carry additional postinst
160 +# messages
161 +
162 +# @ECLASS-VARIABLE: K_EXTRAELOG
163 +# @DEFAULT_UNSET
164 +# @DESCRIPTION:
165 +# same as K_EXTRAEINFO except using elog instead of einfo
166 +
167 +# @ECLASS-VARIABLE: K_EXTRAEWARN
168 +# @DEFAULT_UNSET
169 +# @DESCRIPTION:
170 +# same as K_EXTRAEINFO except using ewarn instead of einfo
171 +
172 +# @ECLASS-VARIABLE: K_SYMLINK
173 +# @DEFAULT_UNSET
174 +# @DESCRIPTION:
175 +# if this is set, then forcably create symlink anyway
176 +
177 +# @ECLASS-VARIABLE: K_BASE_VER
178 +# @DEFAULT_UNSET
179 +# @DESCRIPTION:
180 +# for git-sources, declare the base version this patch is
181 +# based off of.
182 +
183 +# @ECLASS-VARIABLE: K_DEFCONFIG
184 +# @DEFAULT_UNSET
185 +# @DESCRIPTION:
186 +# Allow specifying a different defconfig target.
187 +# If length zero, defaults to "defconfig".
188 +
189 +# @ECLASS-VARIABLE: K_WANT_GENPATCHES
190 +# @DEFAULT_UNSET
191 +# @DESCRIPTION:
192 +# Apply genpatches to kernel source. Provide any
193 +# combination of "base", "extras" or "experimental".
194 +
195 +# @ECLASS-VARIABLE: K_EXP_GENPATCHES_PULL
196 +# @DEFAULT_UNSET
197 +# @DESCRIPTION:
198 +# If set, we pull "experimental" regardless of the USE FLAG
199 +# but expect the ebuild maintainer to use K_EXP_GENPATCHES_LIST.
200 +
201 +# @ECLASS-VARIABLE: K_EXP_GENPATCHES_NOUSE
202 +# @DEFAULT_UNSET
203 +# @DESCRIPTION:
204 +# If set, no USE flag will be provided for "experimental";
205 +# as a result the user cannot choose to apply those patches.
206 +
207 +# @ECLASS-VARIABLE: K_EXP_GENPATCHES_LIST
208 +# @DEFAULT_UNSET
209 +# @DESCRIPTION:
210 +# A list of patches to pick from "experimental" to apply when
211 +# the USE flag is unset and K_EXP_GENPATCHES_PULL is set.
212 +
213 +# @ECLASS-VARIABLE: K_FROM_GIT
214 +# @DEFAULT_UNSET
215 +# @DESCRIPTION:
216 +# If set, this variable signals that the kernel sources derives
217 +# from a git tree and special handling will be applied so that
218 +# any patches that are applied will actually apply.
219 +
220 +# @ECLASS-VARIABLE: K_GENPATCHES_VER
221 +# @DEFAULT_UNSET
222 +# @DESCRIPTION:
223 +# The version of the genpatches tarball(s) to apply.
224 +# A value of "5" would apply genpatches-2.6.12-5 to
225 +# my-sources-2.6.12.ebuild
226 +
227 +# @ECLASS-VARIABLE: K_SECURITY_UNSUPPORTED
228 +# @DEFAULT_UNSET
229 +# @DESCRIPTION:
230 +# If set, this kernel is unsupported by Gentoo Security
231 +# to the current eclass maintainer :)
232 +# added functionality:
233 +# unipatch - a flexible, singular method to extract, add and
234 remove patches.
235 +
236 +# @ECLASS-VARIABLE: K_DEBLOB_AVAILABLE
237 +# @DEFAULT_UNSET
238 +# @DESCRIPTION:
239 +# A value of "0" will disable all of the optional deblob
240 +# code. If empty, will be set to "1" if deblobbing is
241 +# possible. Test ONLY for "1".
242 +
243 +# @ECLASS-VARIABLE: K_DEBLOB_TAG
244 +# @DEFAULT_UNSET
245 +# @DESCRIPTION:
246 +# This will be the version of deblob script. It's a upstream SVN tag
247 +# such asw -gnu or -gnu1.
248 +
249 +# @ECLASS-VARIABLE: K_PREDEBLOBBED
250 +# @DEFAULT_UNSET
251 +# @DESCRIPTION:
252 +# This kernel was already deblobbed elsewhere.
253 +# If false, either optional deblobbing will be available
254 +# or the license will note the inclusion of freedist code.
255 +
256 +# @ECLASS-VARIABLE: K_LONGTERM
257 +# @DEFAULT_UNSET
258 +# @DESCRIPTION:
259 +# If set, the eclass will search for the kernel source
260 +# in the long term directories on the upstream servers
261 +# as the location has been changed by upstream
262
263 +# @ECLASS-VARIABLE: K_KDBUS_AVAILABLE
264 +# @DEFAULT_UNSET
265 +# @DESCRIPTION:
266 +# If set, the ebuild contains the option of installing the
267 +# kdbus patch. This patch is not installed without the 'kdbus'
268 +# and 'experimental' use flags.
269 +
270 +# @ECLASS-VARIABLE: H_SUPPORTEDARCH
271 +# @DEFAULT_UNSET
272 +# @DESCRIPTION:
273 +# this should be a space separated list of ARCH's which
274 +# can be supported by the headers ebuild
275 +
276 +# @ECLASS-VARIABLE: UNIPATCH_LIST
277 +# @DEFAULT_UNSET
278 +# @DESCRIPTION:
279 +# space delimetered list of patches to be applied to the kernel
280 +
281 +# @ECLASS-VARIABLE: UNIPATCH_EXCLUDE
282 +# @DEFAULT_UNSET
283 +# @DESCRIPTION:
284 +# An addition var to support exlusion based completely
285 +# on "<passedstring>*" and not "<passedno#>_*"
286 +# this should _NOT_ be used from the ebuild as this is
287 +# reserved for end users passing excludes from the cli
288 +
289 +# @ECLASS-VARIABLE: UNIPATCH_DOCS
290 +# @DEFAULT_UNSET
291 +# @DESCRIPTION:
292 +# space delimemeted list of docs to be installed to
293 +# the doc dir
294 +
295 +# @ECLASS-VARIABLE: UNIPATCH_STRICTORDER
296 +# @DEFAULT_UNSET
297 +# @DESCRIPTION:
298 +# if this is set places patches into directories of
299 +# order, so they are applied in the order passed
300 # Changing any other variable in this eclass is not supported; you can
301 request
302 # for additional variables to be added by contacting the current
303 maintainer.
304 # If you do change them, there is a chance that we will not fix
305 resulting bugs;
306 @@ -129,11 +239,13 @@ RESTRICT="binchecks strip"
307 # set LINUX_HOSTCFLAGS if not already set
308 : ${LINUX_HOSTCFLAGS:="-Wall -Wstrict-prototypes -Os
309 -fomit-frame-pointer -I${S}/include"}
310
311 -# debugging functions
312 -#==============================================================
313 +
314 +# @FUNCTION: debug-print-kernel2-variables
315 +# @DESCRIPTION:
316 # this function exists only to help debug kernel-2.eclass
317 # if you are adding new functionality in, put a call to it
318 # at the start of src_unpack, or during SRC_URI/dep generation.
319 +
320 debug-print-kernel2-variables() {
321 for v in PVR CKV OKV KV KV_FULL KV_MAJOR KV_MINOR KV_PATCH RELEASETYPE \
322 RELEASE UNIPATCH_LIST_DEFAULT UNIPATCH_LIST_GENPATCHES \
323 @@ -142,8 +254,10 @@ debug-print-kernel2-variables() {
324 done
325 }
326
327 -#Eclass functions only from here onwards ...
328 -#==============================================================
329 +# @FUNCTION: handle_genpatches
330 +# @DESCRIPTION:
331 +# add genpatches to list of patches to apply uf wanted
332 +
333 handle_genpatches() {
334 local tarball want_unipatch_list
335 [[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1
336 @@ -197,11 +311,13 @@ handle_genpatches() {
337 done
338 }
339
340 +# @FUNCTION: detect_version
341 +# @DESCRIPTION:
342 +# this function will detect and set
343 +# - OKV: Original Kernel Version (2.6.0/2.6.0-test11)
344 +# - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
345 +# - EXTRAVERSION: The additional version appended to OKV
346 (-gentoo/-gentoo-r1)
347 detect_version() {
348 - # this function will detect and set
349 - # - OKV: Original Kernel Version (2.6.0/2.6.0-test11)
350 - # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
351 - # - EXTRAVERSION: The additional version appended to OKV
352 (-gentoo/-gentoo-r1)
353
354 # We've already run, so nothing to do here.
355 [[ -n ${KV_FULL} ]] && return 0
356 @@ -426,6 +542,12 @@ detect_version() {
357 handle_genpatches
358 }
359
360 +# @FUNCTION: kernel_is
361 +# @DESCRIPTION:
362 +# user for comparing kernel versions
363 +# or just identifying a version
364 +# e.g kernel_is 2 4
365 +# e.g kernel_is ge 4.8.11
366 # Note: duplicated in linux-info.eclass
367 kernel_is() {
368 # ALL of these should be set before we can safely continue this function.
369 @@ -453,10 +575,16 @@ kernel_is() {
370 [ ${test} ${operator} ${value} ]
371 }
372
373 +# @FUNCTION: kernel_is_2_4
374 +# @DESCRIPTION:
375 +# return true if kernel is version 2.4
376 kernel_is_2_4() {
377 kernel_is 2 4
378 }
379
380 +# @FUNCTION: kernel_is_2_6
381 +# @DESCRIPTION:
382 +# return true if kernel is version 2.6
383 kernel_is_2_6() {
384 kernel_is 2 6 || kernel_is 2 5
385 }
386 @@ -547,17 +675,27 @@ elif [[ ${ETYPE} == headers ]]; then
387 fi
388
389 # Cross-compile support functions
390 -#==============================================================
391 +
392 +# @FUNCTION: kernel_header_destdir
393 +# @DESCRIPTION:
394 +# return header destination directory
395 kernel_header_destdir() {
396 [[ ${CTARGET} == ${CHOST} ]] \
397 && echo /usr/include \
398 || echo /usr/${CTARGET}/usr/include
399 }
400
401 +# @FUNCTION: cross_pre_c_headers
402 +# @DESCRIPTION:
403 +# set use if neccesary for cross compile support
404 cross_pre_c_headers() {
405 use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
406 }
407
408 +# @FUNCTION: env_setup_xmakeopts
409 +# @DESCRIPTION:
410 +# set the ARCH/CROSS_COMPILE when cross compiling
411 +
412 env_setup_xmakeopts() {
413 # Kernel ARCH != portage ARCH
414 export KARCH=$(tc-arch-kernel)
415 @@ -573,8 +711,10 @@ env_setup_xmakeopts() {
416 export xmakeopts
417 }
418
419 -# Unpack functions
420 -#==============================================================
421 +# @FUNCTION: unpack_2_4
422 +# @DESCRIPTION:
423 +# unpack and generate .config for 2.4 kernels
424 +
425 unpack_2_4() {
426 # this file is required for other things to build properly,
427 # so we autogenerate it
428 @@ -584,6 +724,10 @@ unpack_2_4() {
429 echo ">>> version.h compiled successfully."
430 }
431
432 +# @FUNCTION: unpack_2_6
433 +# @DESCRIPTION:
434 +# unpack and generate .config for 2.6 kernels
435 +
436 unpack_2_6() {
437 # this file is required for other things to build properly, so we
438 # autogenerate it ... generate a .config to keep version.h build from
439 @@ -605,6 +749,10 @@ unpack_2_6() {
440 rm -f .config >/dev/null
441 }
442
443 +# @FUNCTION: universal_unpack
444 +# @DESCRIPTION:
445 +# unpack kernel sources
446 +
447 universal_unpack() {
448 debug-print "Inside universal_unpack"
449
450 @@ -644,21 +792,32 @@ universal_unpack() {
451
452 }
453
454 +# @FUNCTION: unpack_set_extraversion
455 +# @DESCRIPTION:
456 +# handle EXTRAVERSION
457 +
458 unpack_set_extraversion() {
459 cd "${S}"
460 sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
461 cd "${OLDPWD}"
462 }
463
464 +# @FUNCTION: unpack_fix_install_path
465 +# @DESCRIPTION:
466 # Should be done after patches have been applied
467 # Otherwise patches that modify the same area of Makefile will fail
468 +
469 unpack_fix_install_path() {
470 cd "${S}"
471 sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
472 }
473
474 # Compile Functions
475 -#==============================================================
476 +
477 +# @FUNCTION: compile_headers
478 +# @DESCRIPTION:
479 +# header compilation
480 +
481 compile_headers() {
482 env_setup_xmakeopts
483
484 @@ -711,9 +870,12 @@ compile_headers() {
485 fi
486 }
487
488 +# @FUNCTION: compile_headers_tweak_config
489 +# @DESCRIPTION:
490 +# some targets can be very very picky, so let's finesse the
491 +# .config based upon any info we may have
492 +
493 compile_headers_tweak_config() {
494 - # some targets can be very very picky, so let's finesse the
495 - # .config based upon any info we may have
496 case ${CTARGET} in
497 sh*)
498 sed -i '/CONFIG_CPU_SH/d' .config || die
499 @@ -726,15 +888,22 @@ compile_headers_tweak_config() {
500 }
501
502 # install functions
503 -#==============================================================
504 +
505 +# @FUNCTION: install_universal
506 +# @DESCRIPTION:
507 +# Fix permissions in tarball
508 +
509 install_universal() {
510 - # Fix silly permissions in tarball
511 cd "${WORKDIR}"
512 chown -R 0:0 * >& /dev/null
513 chmod -R a+r-w+X,u+w *
514 cd ${OLDPWD}
515 }
516
517 +# @FUNCTION: install_headers
518 +# @DESCRIPTION:
519 +# Install headers
520 +
521 install_headers() {
522 local ddir=$(kernel_header_destdir)
523
524 @@ -770,6 +939,10 @@ install_headers() {
525 popd >/dev/null
526 }
527
528 +# @FUNCTION: install_sources
529 +# @DESCRIPTION:
530 +# Install sources
531 +
532 install_sources() {
533 local file
534
535 @@ -804,16 +977,21 @@ install_sources() {
536 fi
537 }
538
539 -# pkg_preinst functions
540 -#==============================================================
541 +# @FUNCTION: preinst_headers
542 +# @DESCRIPTION:
543 +# Headers preinst steps
544 +
545 preinst_headers() {
546 local ddir=$(kernel_header_destdir)
547 [[ -L ${EPREFIX}${ddir}/linux ]] && { rm "${EPREFIX}"${ddir}/linux ||
548 die; }
549 [[ -L ${EPREFIX}${ddir}/asm ]] && { rm "${EPREFIX}"${ddir}/asm || die; }
550 }
551
552 -# pkg_postinst functions
553 -#==============================================================
554 +# @FUNCTION: postinst_sources
555 +# @DESCRIPTION:
556 +# Sources post installation function.
557 +# see inline comments
558 +
559 postinst_sources() {
560 local MAKELINK=0
561
562 @@ -902,7 +1080,11 @@ postinst_sources() {
563 }
564
565 # pkg_setup functions
566 -#==============================================================
567 +
568 +# @FUNCTION: setup_headers
569 +# @DESCRIPTION:
570 +# Determine if ${PN} supports arch
571 +
572 setup_headers() {
573 [[ -z ${H_SUPPORTEDARCH} ]] && H_SUPPORTEDARCH=${PN/-*/}
574 for i in ${H_SUPPORTEDARCH}; do
575 @@ -918,8 +1100,10 @@ setup_headers() {
576 fi
577 }
578
579 -# unipatch
580 -#==============================================================
581 +# @FUNCTION: unipatch
582 +# @DESCRIPTION:
583 +# Universal function that will apply patches to source
584 +
585 unipatch() {
586 local i x y z extention PIPE_CMD UNIPATCH_DROP KPATCH_DIR PATCH_DEPTH
587 ELINE
588 local STRICT_COUNT PATCH_LEVEL myLC_ALL myLANG
589 @@ -936,7 +1120,8 @@ unipatch() {
590 # We're gonna need it when doing patches with a predefined patchlevel
591 eshopts_push -s extglob
592
593 - # This function will unpack all passed tarballs, add any passed
594 patches, and remove any passed patchnumbers
595 + # This function will unpack all passed tarballs, add any passed patches,
596 + # and remove any passed patchnumbers
597 # usage can be either via an env var or by params
598 # although due to the nature we pass this within this eclass
599 # it shall be by param only.
600 @@ -1178,6 +1363,8 @@ unipatch() {
601 eshopts_pop
602 }
603
604 +# @FUNCTION: getfilevar
605 +# @DESCRIPTION:
606 # getfilevar accepts 2 vars as follows:
607 # getfilevar <VARIABLE> <CONFIGFILE>
608 # pulled from linux-info
609 @@ -1204,10 +1391,13 @@ getfilevar() {
610 fi
611 }
612
613 +# @FUNCTION: detect_arch
614 +# @DESCRIPTION:
615 +# This function sets ARCH_URI and ARCH_PATCH
616 +# with the neccessary info for the arch sepecific compatibility
617 +# patchsets.
618 +
619 detect_arch() {
620 - # This function sets ARCH_URI and ARCH_PATCH
621 - # with the neccessary info for the arch sepecific compatibility
622 - # patchsets.
623
624 local ALL_ARCH LOOP_ARCH COMPAT_URI i
625
626 @@ -1234,9 +1424,12 @@ detect_arch() {
627 done
628 }
629
630 +# @FUNCTION: headers___fix
631 +# @DESCRIPTION:
632 +# Voodoo to partially fix broken upstream headers.
633 +# note: do not put inline/asm/volatile together (breaks "inline asm
634 volatile")
635 +
636 headers___fix() {
637 - # Voodoo to partially fix broken upstream headers.
638 - # note: do not put inline/asm/volatile together (breaks "inline asm
639 volatile")
640 sed -i \
641 -e '/^\#define.*_TYPES_H/{:loop n; bloop}' \
642 -e 's:\<\([us]\(8\|16\|32\|64\)\)\>:__\1:g' \
643 @@ -1246,8 +1439,10 @@ headers___fix() {
644 "$@"
645 }
646
647 -# common functions
648 -#==============================================================
649 +# @FUNCTION: kernel-2_src_unpack()
650 +# @DESCRIPTION:
651 +# unpack sources, handle genpatches, deblob
652 +
653 kernel-2_src_unpack() {
654 universal_unpack
655 debug-print "Doing unipatch"
656 @@ -1308,6 +1503,7 @@ kernel-2_src_unpack() {
657 # @FUNCTION: kernel-2_src_prepare
658 # @DESCRIPTION:
659 # Apply any user patches
660 +
661 kernel-2_src_prepare() {
662
663 debug-print "Applying any user patches"
664 @@ -1319,6 +1515,10 @@ kernel-2_src_prepare() {
665 esac
666 }
667
668 +# @FUNCTION: kernel-2_src_compile
669 +# @DESCRIPTION:
670 +# conpile headers or run deblob script
671 +
672 kernel-2_src_compile() {
673 cd "${S}"
674 [[ ${ETYPE} == headers ]] && compile_headers
675 @@ -1330,6 +1530,8 @@ kernel-2_src_compile() {
676 fi
677 }
678
679 +# @FUNCTION: kernel-2_src_test
680 +# @DESCRIPTION:
681 # if you leave it to the default src_test, it will run make to
682 # find whether test/check targets are present; since "make test"
683 # actually produces a few support files, they are installed even
684 @@ -1338,20 +1540,37 @@ kernel-2_src_compile() {
685 # Avoid this altogether by making the function moot.
686 kernel-2_src_test() { :; }
687
688 +# @FUNCTION: kernel-2_pkg_preinst
689 +# @DESCRIPTION:
690 +# if ETYPE = headers, call preinst_headers
691 +
692 kernel-2_pkg_preinst() {
693 [[ ${ETYPE} == headers ]] && preinst_headers
694 }
695
696 +# @FUNCTION: kernel-2_src_install
697 +# @DESCRIPTION:
698 +# Install headers or sources dependant on ETYPE
699 +
700 kernel-2_src_install() {
701 install_universal
702 [[ ${ETYPE} == headers ]] && install_headers
703 [[ ${ETYPE} == sources ]] && install_sources
704 }
705
706 +# @FUNCTION: kernel-2_pkg_postinst
707 +# @DESCRIPTION:
708 +# call postinst_sources for ETYPE = sources
709 +
710 kernel-2_pkg_postinst() {
711 [[ ${ETYPE} == sources ]] && postinst_sources
712 }
713
714 +# @FUNCTION: kernel-2_pkg_setup
715 +# @DESCRIPTION:
716 +# check for supported kernel version, die if ETYPE is unknown, call
717 setup_headers
718 +# if necessary
719 +
720 kernel-2_pkg_setup() {
721 if kernel_is 2 4; then
722 if [[ $(gcc-major-version) -ge 4 ]] ; then
723 @@ -1377,6 +1596,11 @@ kernel-2_pkg_setup() {
724 [[ ${ETYPE} == sources ]] && echo ">>> Preparing to unpack ..."
725 }
726
727 +# @FUNCTION: kernel-2_pkg_postrm
728 +# @DESCRIPTION:
729 +# Notify the user that after a depclean, there may be sources
730 +# left behind that need to be manually cleaned
731 +
732 kernel-2_pkg_postrm() {
733 # This warning only makes sense for kernel sources.
734 [[ ${ETYPE} == headers ]] && return 0
735 --
736 2.7.3

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies