Gentoo Archives: gentoo-commits

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