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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.55 - (show annotations) (download)
Fri Nov 26 15:06:17 2004 UTC (13 years, 11 months ago) by johnm
Branch: MAIN
Changes since 1.54: +81 -65 lines
Changing all KV calls to KV_FULL to stop portage conflicts. currently still setting KV to stop breakages

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