/[gentoo-x86]/eclass/kernel-2.eclass
Gentoo

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.58 - (show annotations) (download)
Mon Nov 29 13:44:31 2004 UTC (14 years, 6 months ago) by johnm
Branch: MAIN
Changes since 1.57: +1 -7 lines
Removing obsolete checks for KV_*

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/www/www.gentoo.org/raw_cvs/gentoo-x86/eclass/kernel-2.eclass,v 1.46 2004/10/19 19:51:12 vapier Exp $
4
5 # Description: kernel.eclass rewrite for a clean base regarding the 2.6
6 # series of kernel with back-compatibility for 2.4
7 #
8 # Maintainer: John Mylchreest <johnm@gentoo.org>
9 # Copyright 2004 Gentoo Linux
10 #
11 # Please direct your bugs to the current eclass maintainer :)
12
13 # added functionality:
14 # unipatch - a flexible, singular method to extract, add and remove patches.
15
16 # A Couple of env vars are available to effect usage of this eclass
17 # These are as follows:
18 #
19 # K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be
20 # automatically set within the kernel Makefile
21 # K_NOUSENAME - if this is set then EXTRAVERSION will not include the
22 # first part of ${PN} in EXTRAVERSION
23 # K_PREPATCHED - if the patchset is prepatched (ie: mm-sources,
24 # ck-sources, ac-sources) it will use PR (ie: -r5) as
25 # the patchset version for
26 # - and not use it as a true package revision
27 # K_EXTRAEINFO - this is a new-line seperated list of einfo displays in
28 # postinst and can be used to carry additional postinst
29 # messages
30 # K_EXTRAEWARN - same as K_EXTRAEINFO except ewarn's instead of einfo's
31
32 # H_SUPPORTEDARCH - this should be a space separated list of ARCH's which
33 # can be supported by the headers ebuild
34
35 # UNIPATCH_LIST - space delimetered list of patches to be applied to the
36 # kernel
37 # UNIPATCH_EXCLUDE - an addition var to support exlusion based completely
38 # on "<passedstring>*" and not "<passedno#>_*"
39 # - this should _NOT_ be used from the ebuild as this is
40 # reserved for end users passing excludes from the cli
41 # UNIPATCH_DOCS - space delimemeted list of docs to be installed to
42 # the doc dir
43 # UNIPATCH_STRICTORDER - if this is set places patches into directories of
44 # order, so they are applied in the order passed
45
46 ECLASS="kernel-2"
47 INHERITED="$INHERITED $ECLASS"
48 EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst
49
50 HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/"
51 LICENSE="GPL-2"
52 IUSE="${IUSE} build doc"
53 SLOT="${PV}"
54
55 # set LINUX_HOSTCFLAGS if not already set
56 [ -z "$LINUX_HOSTCFLAGS" ] && LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"
57
58 #Eclass functions only from here onwards ...
59 #==============================================================
60 kernel_is() {
61 local RESULT
62 RESULT=1
63
64 if [ -n "${1}" ]
65 then
66 [ "${1}" = "${KV_MAJOR}" ] && RESULT=0
67 fi
68
69 if [ -n "${2}" ]
70 then
71 RESULT=1
72 [ "${2}" = "${KV_MINOR}" ] && RESULT=0
73 fi
74
75 if [ -n "${3}" ]
76 then
77 RESULT=1
78 [ "${3}" = "${KV_PATCH}" ] && RESULT=0
79 fi
80 return ${RESULT}
81 }
82
83 kernel_is_2_4() {
84 kernel_is 2 4
85 return $?
86 }
87
88 kernel_is_2_6() {
89 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 5 -o ${KV_MINOR} -eq 6 ] && \
90 return 0 || return 1
91 }
92
93 # Capture the sources type and set DEPENDs
94 if [ "${ETYPE}" == "sources" ]
95 then
96 # binutils version needed to avoid Athlon/PIII/SSE assembler bugs.
97 DEPEND="!build? ( sys-apps/sed
98 >=sys-devel/binutils-2.11.90.0.31 )
99 doc? ( !arm? ( !s390? ( app-text/docbook-sgml-utils ) ) )"
100
101 RDEPEND="${DEPEND}
102 !build? ( >=sys-libs/ncurses-5.2
103 dev-lang/perl
104 sys-apps/module-init-tools
105 sys-devel/make )"
106
107 [ $(kernel_is_2_4) $? == 0 ] && PROVIDE="virtual/linux-sources" \
108 || PROVIDE="virtual/linux-sources virtual/alsa"
109
110 elif [ "${ETYPE}" == "headers" ]
111 then
112 PROVIDE="virtual/kernel virtual/os-headers"
113 else
114 eerror "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\""
115 die
116 fi
117
118 # Unpack functions
119 #==============================================================
120 unpack_2_4() {
121 cd ${S}
122 # this file is required for other things to build properly,
123 # so we autogenerate it
124 make mrproper || die "make mrproper died"
125 make include/linux/version.h || die "make include/linux/version.h failed"
126 echo ">>> version.h compiled successfully."
127 }
128
129 universal_unpack() {
130 [ -z "${OKV}" ] && OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
131
132 cd ${WORKDIR}
133 unpack linux-${OKV}.tar.bz2
134 if [ "${OKV}" != "${KV_FULL}" ]
135 then
136 mv linux-${OKV} linux-${KV_FULL} \
137 || die "Unable to move source tree to ${KV_FULL}."
138 fi
139 cd ${S}
140
141 # change incorrect install path
142 sed -ie 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
143
144 # remove all backup files
145 find . -iname "*~" -exec rm {} \; 2> /dev/null
146
147 if [ -d "${S}/Documentation/DocBook" ]
148 then
149 cd ${S}/Documentation/DocBook
150 sed -e "s:db2:docbook2:g" Makefile > Makefile.new \
151 && mv Makefile.new Makefile
152 cd ${S}
153 fi
154 }
155
156 unpack_set_extraversion() {
157 cd ${S}
158 sed -ie "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
159 }
160
161 # Compile Functions
162 #==============================================================
163 compile_headers() {
164 local MY_ARCH
165
166 MY_ARCH=${ARCH}
167 unset ${ARCH}
168 yes "" | make oldconfig
169 echo ">>> make oldconfig complete"
170 ARCH=${MY_ARCH}
171 }
172
173 compile_manpages() {
174 local MY_ARCH
175
176 einfo "Making manpages ..."
177 MY_ARCH=${ARCH}
178 unset ARCH
179 make mandocs
180 ARCH=${MY_ARCH}
181 }
182
183 # install functions
184 #==============================================================
185 install_universal() {
186 #fix silly permissions in tarball
187 cd ${WORKDIR}
188 chown -R root:root *
189 chmod -R a+r-w+X,u+w *
190 }
191
192 install_headers() {
193 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4
194
195 cd ${S}
196 dodir /usr/include/linux
197 ln -sf ${S}/include/asm-${ARCH} ${S}/include/asm
198 cp -ax ${S}/include/linux/* ${D}/usr/include/linux
199 rm -rf ${D}/usr/include/linux/modules
200
201 dodir /usr/include/asm
202 cp -ax ${S}/include/asm/* ${D}/usr/include/asm
203
204 if [ $(kernel_is_2_6) $? == 0 ]
205 then
206 dodir /usr/include/asm-generic
207 cp -ax ${S}/include/asm-generic/* ${D}/usr/include/asm-generic
208 fi
209 }
210
211 install_sources() {
212 local doc
213 local docs
214 local file
215
216 cd ${S}
217 dodir /usr/src
218 echo ">>> Copying sources ..."
219 file="$(find ${WORKDIR} -iname "docs" -type d)"
220 if [ -n "${file}" ]
221 then
222 for file in $(find ${file} -type f)
223 do
224 echo "${file/*docs\//}" >> ${S}/patches.txt
225 echo "===================================================" >> ${S}/patches.txt
226 cat ${file} >> ${S}/patches.txt
227 echo "===================================================" >> ${S}/patches.txt
228 echo "" >> ${S}/patches.txt
229 done
230 fi
231
232 if [ ! -f ${S}/patches.txt ]
233 then
234 # patches.txt is empty so lets use our ChangeLog
235 [ -f ${FILESDIR}/../ChangeLog ] && echo "Please check the ebuild ChangeLog for more details." > ${S}/patches.txt
236 fi
237
238 for doc in ${UNIPATCH_DOCS}
239 do
240 [ -f ${doc} ] && docs="${docs} ${doc}"
241 done
242
243 if [ -f ${S}/patches.txt ]; then
244 docs="${docs} ${S}/patches.txt"
245 fi
246
247 if use doc && ! use arm && ! use s390; then
248 install_manpages
249 fi
250
251 dodoc ${docs}
252 mv ${WORKDIR}/linux* ${D}/usr/src
253 }
254
255 install_manpages() {
256 local MY_ARCH
257
258 ebegin "Installing manpages"
259 MY_ARCH=${ARCH}
260 unset ARCH
261 sed -ie "s#/usr/local/man#${D}/usr/man#g" scripts/makeman
262 make installmandocs
263 eend $?
264 sed -ie "s#${D}/usr/man#/usr/local/man#g" scripts/makeman
265 ARCH=${MY_ARCH}
266 }
267
268 # pkg_preinst functions
269 #==============================================================
270 preinst_headers() {
271 [ -L ${ROOT}usr/include/linux ] && rm ${ROOT}usr/include/linux
272 [ -L ${ROOT}usr/include/asm ] && rm ${ROOT}usr/include/asm
273 }
274
275 # pkg_postinst functions
276 #==============================================================
277 postinst_sources() {
278 if [ ! -h ${ROOT}usr/src/linux ]
279 then
280 ln -sf ${ROOT}usr/src/linux-${KV_FULL} ${ROOT}usr/src/linux
281 fi
282
283 # Don't forget to make directory for sysfs
284 [ ! -d "${ROOT}/sys" -a $(kernel_is_2_6) $? == 0 ] && mkdir /sys
285
286 echo
287 einfo "After installing a new kernel of any version, it is important"
288 einfo "that you have the appropriate /etc/modules.autoload.d/kernel-X.Y"
289 einfo "created (X.Y is the first 2 parts of your new kernel version)"
290 echo
291 einfo "For example, this kernel will require:"
292 einfo "/etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}"
293 echo
294
295 # if K_EXTRAEINFO is set then lets display it now
296 if [ -n "${K_EXTRAEINFO}" ]
297 then
298 echo ${K_EXTRAEINFO} | fmt |
299 while read -s ELINE
300 do
301 einfo "${ELINE}"
302 done
303
304 echo
305 fi
306
307 # Show policy version, if this kernel has SELinux ...
308 local secfile
309 secfile="${ROOT}usr/src/linux-${KV_FULL}/security/selinux/include/security.h"
310 if use selinux && [ -f "$secfile" ]
311 then
312 local polver=$(awk '/POLICYDB_VERSION /{print $3}' $secfile)
313 einfo "The SELinux policy version of this kernel is $polver."
314 echo
315 fi
316
317 # if K_EXTRAEWARN is set then lets display it now
318 if [ -n "${K_EXTRAEWARN}" ]
319 then
320 echo ${K_EXTRAEWARN} | fmt |
321 while read -s ELINE
322 do
323 ewarn "${ELINE}"
324 done
325
326 echo
327 fi
328 }
329
330 postinst_headers() {
331 echo
332 einfo "Kernel headers are usually only used when recompiling glibc."
333 einfo "Following the installation of newer headers it is advised that"
334 einfo "you re-merge glibc as follows:"
335 einfo "# emerge glibc"
336 einfo "Failure to do so will cause glibc to not make use of newer"
337 einfo "features present in the updated kernelheaders."
338 echo
339 }
340
341 # pkg_setup functions
342 #==============================================================
343 setup_headers() {
344 ARCH=$(uname -m | sed -e s/[i].86/i386/ -e s/x86/i386/ -e s/sun4u/sparc64/ \
345 -e s/arm.*/arm/ -e s/sa110/arm/ -e s/amd64/x86_64/)
346 [ "$ARCH" == "sparc" -a "$PROFILE_ARCH" == "sparc64" ] && ARCH="sparc64"
347
348 [ -z "${H_SUPPORTEDARCH}" ] && H_SUPPORTEDARCH="${PN/-*/}"
349 for i in ${H_SUPPORTEDARCH}
350 do
351 [ "${ARCH}" == "${i}" ] && H_ACCEPT_ARCH="yes"
352 done
353
354 if [ "${H_ACCEPT_ARCH}" != "yes" ]
355 then
356 echo
357 eerror "This version of ${PN} does not support ${ARCH}."
358 eerror "Please merge the appropriate sources, in most cases"
359 eerror "this will be ${ARCH}-headers."
360 die "incorrect headers"
361 fi
362 }
363
364 # unipatch
365 #==============================================================
366 unipatch() {
367 local i
368 local x
369 local extention
370 local PIPE_CMD
371 local UNIPATCH_DROP
372 local KPATCH_DIR
373 local PATCH_DEPTH
374 local ELINE
375 local STRICT_COUNT
376 local PATCH_LEVEL
377
378 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
379 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
380
381 # We're gonna need it when doing patches with a predefined patchlevel
382 shopt -s extglob
383
384 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers
385 # usage can be either via an env var or by params
386 # although due to the nature we pass this within this eclass
387 # it shall be by param only.
388 # -z "${UNIPATCH_LIST}" ] && UNIPATCH_LIST="${@}"
389 UNIPATCH_LIST="${@}"
390
391 #unpack any passed tarballs
392 for i in ${UNIPATCH_LIST}
393 do
394 if [ -n "$(echo ${i} | grep -e "\.tar" -e "\.tbz" -e "\.tgz")" ]
395 then
396 extention=${i/*./}
397 extention=${extention/:*/}
398 case ${extention} in
399 tbz2) PIPE_CMD="tar -xvjf";;
400 bz2) PIPE_CMD="tar -xvjf";;
401 tgz) PIPE_CMD="tar -xvzf";;
402 gz) PIPE_CMD="tar -xvzf";;
403 *) eerror "Unrecognized tarball compression"
404 die "Unrecognized tarball compression";;
405 esac
406
407 if [ -n "${UNIPATCH_STRICTORDER}" ]
408 then
409 STRICT_COUNT=$((${STRICT_COUNT} + 1))
410 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
411 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR}/${STRICT_COUNT}/ 1>/dev/null
412 else
413 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR} 1>/dev/null
414 fi
415
416 if [ $? == 0 ]
417 then
418 einfo "${i/*\//} unpacked"
419 [ -n "$(echo ${i} | grep ':')" ] && echo ">>> Strict patch levels not currently supported for tarballed patchsets"
420 else
421 eerror "Failed to unpack ${i/:*/}"
422 die "unable to unpack patch tarball"
423 fi
424 else
425 extention=${i/*./}
426 extention=${extention/:*/}
427 PIPE_CMD=""
428 case ${extention} in
429 bz2) PIPE_CMD="bzip2 -dc";;
430 patch) PIPE_CMD="cat";;
431 diff) PIPE_CMD="cat";;
432 gz|Z|z) PIPE_CMD="gzip -dc";;
433 ZIP|zip) PIPE_CMD="unzip -p";;
434 *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i/:*/}";;
435 esac
436
437 PATCH_LEVEL=${i/*([^:])?(:)}
438 i=${i/:*/}
439 x=${i/*\//}
440 x=${x/\.${extention}/}
441
442 if [ -n "${PIPE_CMD}" ]
443 then
444 if [ ! -r "${i}" ]
445 then
446 echo
447 eerror "FATAL: unable to locate:"
448 eerror "${i}"
449 eerror "for read-only. The file either has incorrect permissions"
450 eerror "or does not exist."
451 die Unable to locate ${i}
452 fi
453
454 if [ -n "${UNIPATCH_STRICTORDER}" ]
455 then
456 STRICT_COUNT=$((${STRICT_COUNT} + 1))
457 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
458 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${STRICT_COUNT}/${x}.patch${PATCH_LEVEL})
459 else
460 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL})
461 fi
462 fi
463 fi
464 done
465
466 #populate KPATCH_DIRS so we know where to look to remove the excludes
467 x=${KPATCH_DIR}
468 KPATCH_DIR=""
469 LC_ALL="C"
470 for i in $(find ${x} -type d | sort -n)
471 do
472 KPATCH_DIR="${KPATCH_DIR} ${i}"
473 done
474
475 #so now lets get rid of the patchno's we want to exclude
476 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
477 for i in ${UNIPATCH_DROP}
478 do
479 ebegin "Excluding Patch #${i}"
480 for x in ${KPATCH_DIR}
481 do
482 rm -f ${x}/${i}* 2>/dev/null
483 done
484 eend $?
485 done
486
487 # and now, finally, we patch it :)
488 for x in ${KPATCH_DIR}
489 do
490 for i in $(find ${x} -maxdepth 1 -iname "*.patch*" -or -iname "*.diff*" | sort -n)
491 do
492 STDERR_T="${T}/${i/*\//}"
493 STDERR_T="${STDERR_T/.patch*/.err}"
494
495 [ -z ${i/*.patch*/} ] && PATCH_DEPTH=${i/*.patch/}
496 [ -z ${i/*.diff*/} ] && PATCH_DEPTH=${i/*.diff/}
497
498 if [ -z "${PATCH_DEPTH}" ]; then
499 PATCH_DEPTH=0
500 fi
501
502 ebegin "Applying ${i/*\//} (-p${PATCH_DEPTH}+)"
503 while [ ${PATCH_DEPTH} -lt 5 ]
504 do
505 echo "Attempting Dry-run:" >> ${STDERR_T}
506 echo "cmd: patch -p${PATCH_DEPTH} --dry-run -f < ${i}" >> ${STDERR_T}
507 echo "=======================================================" >> ${STDERR_T}
508 if [ $(patch -p${PATCH_DEPTH} --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ]
509 then
510 echo "Attempting patch:" > ${STDERR_T}
511 echo "cmd: patch -p${PATCH_DEPTH} -f < ${i}" >> ${STDERR_T}
512 echo "=======================================================" >> ${STDERR_T}
513 if [ $(patch -p${PATCH_DEPTH} -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ]
514 then
515 eend 0
516 rm ${STDERR_T}
517 break
518 else
519 eend 1
520 eerror "Failed to apply patch ${i/*\//}"
521 eerror "Please attach ${STDERR_T} to any bug you may post."
522 die "Failed to apply ${i/*\//}"
523 fi
524 else
525 PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
526 fi
527 done
528 if [ ${PATCH_DEPTH} -eq 5 ]
529 then
530 eend 1
531 eerror "Please attach ${STDERR_T} to any bug you may post."
532 die "Unable to dry-run patch."
533 fi
534 done
535 done
536
537 # clean up KPATCH_DIR's - fixes bug #53610
538 for x in ${KPATCH_DIR}
539 do
540 rm -Rf ${x}
541 done
542 unset LC_ALL
543 }
544
545 # custom functions
546 #==============================================================
547 detect_version() {
548 # this function will detect and set
549 # - OKV: Original Kernel Version (2.6.0/2.6.0-test11)
550 # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
551 # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1)
552
553 if [ -n "${KV_FULL}" ] ;
554 then
555 # we will set this for backwards compatibility.
556 KV=${KV_FULL}
557
558 # we know KV_FULL so lets stop here. but not without resetting S
559 S=${WORKDIR}/linux-${KV_FULL}
560 return
561 fi
562
563 OKV=${PV/_beta/-test}
564 OKV=${OKV/_rc/-rc}
565 OKV=${OKV/_pre*/}
566 OKV=${OKV/-r*/}
567
568 KV_MAJOR=$(echo ${OKV} | cut -d. -f1)
569 KV_MINOR=$(echo ${OKV} | cut -d. -f2)
570 KV_PATCH=$(echo ${OKV} | cut -d. -f3-)
571 KV_PATCH=${KV_PATCH/[-_]*/}
572
573 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
574
575 RELEASE=${PV/${OKV}/}
576 RELEASE=${RELEASE/_beta/}
577 RELEASE=${RELEASE/_rc/-rc}
578 if [ $(kernel_is_2_4) $? == 0 ]
579 then
580 RELEASE=${RELEASE/_pre/-pre}
581 else
582 RELEASE=${RELEASE/_pre/-bk}
583 fi
584 RELEASETYPE=${RELEASE//[0-9]/}
585 EXTRAVERSION="${RELEASE}"
586
587 if [ -n "${K_PREPATCHED}" ]
588 then
589 EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}${PR/r/}"
590 else
591 [ -z "${K_NOUSENAME}" ] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}"
592 [ "${PR}" != "r0" ] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
593 fi
594
595 KV_FULL=${OKV}${EXTRAVERSION}
596
597 # -rcXX-bkXX pulls are *IMPOSSIBLE* to support within the portage naming convention
598 # these cannot be supported, but the code here can handle it up until this point
599 # and theoretically thereafter.
600
601 if [ "${RELEASETYPE}" == "-rc" -o "${RELEASETYPE}" == "-pre" ]
602 then
603 OKV="${KV_MAJOR}.${KV_MINOR}.$([ $((${KV_PATCH} - 1)) -lt 0 ] && echo ${KV_PATCH} || echo $((${KV_PATCH} - 1)))"
604 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/patch-${PV//_/-}.bz2
605 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
606 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${PV//_/-}.bz2"
607 KV_FULL=${PV/[-_]*/}${EXTRAVERSION}
608 fi
609
610 if [ "${RELEASETYPE}" == "-bk" ]
611 then
612 OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
613 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
614 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
615 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
616 KV_FULL=${PV/[-_]*/}${EXTRAVERSION}
617 fi
618
619 if [ "${RELEASETYPE}" == "-rc-bk" ]
620 then
621 OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))-${RELEASE/-bk*}"
622 EXTRAVERSION="$([ -n "${RELEASE}" ] && echo ${RELEASE/*-bk/-bk})$([ -n "${K_USENAME}" ] && echo -${PN/-*/})$([ ! "${PR}" == "r0" ] && echo -${PR})"
623
624 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
625 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
626 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
627 KV_FULL=${PV/[-_]*/}${EXTRAVERSION}
628 fi
629
630 S=${WORKDIR}/linux-${KV_FULL}
631 # we will set this for backwards compatibility.
632 KV=${KV_FULL}
633 }
634
635 detect_arch() {
636 # This function sets ARCH_URI and ARCH_PATCH
637 # with the neccessary info for the arch sepecific compatibility
638 # patchsets.
639
640 local ALL_ARCH
641 local LOOP_ARCH
642 local COMPAT_URI
643 local i
644
645 # COMPAT_URI is the contents of ${ARCH}_URI
646 # ARCH_URI is the URI for all the ${ARCH}_URI patches
647 # ARCH_PATCH is ARCH_URI broken into files for UNIPATCH
648
649 ARCH_URI=""
650 ARCH_PATCH=""
651 ALL_ARCH="X86 PPC PPC64 SPARC MIPS ALPHA ARM HPPA AMD64 IA64 X86OBSD S390"
652
653 for LOOP_ARCH in ${ALL_ARCH}
654 do
655 COMPAT_URI="${LOOP_ARCH}_URI"
656 COMPAT_URI="${!COMPAT_URI}"
657
658 [ -n "${COMPAT_URI}" ] && \
659 ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr '[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )"
660
661 if [ "${LOOP_ARCH}" == "$(echo ${ARCH} | tr '[:lower:]' '[:upper:]')" ]
662 then
663 for i in ${COMPAT_URI}
664 do
665 ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
666 done
667 fi
668 done
669 }
670
671
672 # common functions
673 #==============================================================
674 kernel-2_src_unpack() {
675 universal_unpack
676
677 [ -n "${UNIPATCH_LIST}" -o -n "${UNIPATCH_LIST_DEFAULT}" ] && \
678 unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST}"
679
680 [ -z "${K_NOSETEXTRAVERSION}" ] && \
681 unpack_set_extraversion
682
683 kernel_is 2 4 && unpack_2_4
684 }
685
686 kernel-2_src_compile() {
687 [ "${ETYPE}" == "headers" ] && compile_headers
688 [ "${ETYPE}" == "sources" ] && \
689 use doc && ! use arm && ! use s390 && compile_manpages
690 }
691
692 kernel-2_pkg_preinst() {
693 [ "${ETYPE}" == "headers" ] && preinst_headers
694 }
695
696 kernel-2_src_install() {
697 install_universal
698 [ "${ETYPE}" == "headers" ] && install_headers
699 [ "${ETYPE}" == "sources" ] && install_sources
700 }
701
702 kernel-2_pkg_postinst() {
703 [ "${ETYPE}" == "headers" ] && postinst_headers
704 [ "${ETYPE}" == "sources" ] && postinst_sources
705 }
706
707 kernel-2_pkg_setup() {
708 [ "${ETYPE}" == "headers" ] && setup_headers
709
710 # This is to fix some weird portage bug? in stable versions of portage.
711 [ "${ETYPE}" == "sources" ] && echo ">>> Preparing to unpack ..."
712 }
713
714

  ViewVC Help
Powered by ViewVC 1.1.20