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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.56 - (show annotations) (download)
Fri Nov 26 16:01:46 2004 UTC (14 years, 6 months ago) by johnm
Branch: MAIN
Changes since 1.55: +10 -4 lines
changing the way we call kernel_is_2_4

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

  ViewVC Help
Powered by ViewVC 1.1.20