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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.45 - (show annotations) (download)
Sat Oct 2 20:01:39 2004 UTC (14 years, 8 months ago) by plasmaroo
Branch: MAIN
Changes since 1.44: +4 -6 lines
Removing extra "Copyright: " line, the first line of the file and the header is for that.

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.44 2004/09/11 23:26:16 agriffis 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 #
10 # Please direct your bugs to the current eclass maintainer :)
11
12 # added functionality:
13 # unipatch - a flexible, singular method to extract, add and remove patches.
14
15 # A Couple of env vars are available to effect usage of this eclass
16 # These are as follows:
17 #
18 # K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be automatically set within the kernel Makefile
19 # K_NOUSENAME - if this is set then EXTRAVERSION will not include the first part of ${PN} in EXTRAVERSION
20 # K_PREPATCHED - if the patchset is prepatched (ie: mm-sources, ck-sources, ac-sources) it will use PR (ie: -r5) as the patchset version for
21 # - and not use it as a true package revision
22 # K_EXTRAEINFO - this is a new-line seperated list of einfo displays in postinst and can be used to carry additional postinst messages
23 # K_EXTRAEWARN - same as K_EXTRAEINFO except ewarn's instead of einfo's
24
25 # H_SUPPORTEDARCH - this should be a space separated list of ARCH's which can be supported by the headers ebuild
26
27 # UNIPATCH_LIST - space delimetered list of patches to be applied to the kernel
28 # UNIPATCH_EXCLUDE - an addition var to support exlusion based completely on "<passedstring>*" and not "<passedno#>_*"
29 # - this should _NOT_ be used from the ebuild as this is reserved for end users passing excludes from the cli
30 # UNIPATCH_DOCS - space delimemeted list of docs to be installed to the doc dir
31 # UNIPATCH_STRICTORDER - if this is set places patches into directories of order, so they are applied in the order passed
32
33 ECLASS="kernel-2"
34 INHERITED="$INHERITED $ECLASS"
35 EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst
36
37 # to prevent errors if theres no sources in /usr/src
38 # we set KV and re-set it later on as well.
39 [ -z "${KV}" ] && KV=${PV}
40
41 HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/"
42 LICENSE="GPL-2"
43 IUSE="${IUSE} build doc"
44 SLOT="${KV}"
45
46 # Grab kernel version from KV
47 KV_MAJOR=$(echo ${KV} | cut -d. -f1)
48 KV_MINOR=$(echo ${KV} | cut -d. -f2)
49 KV_PATCH=$(echo ${KV} | cut -d. -f3)
50 KV_PATCH=${KV_PATCH/[-_]*/}
51
52 # set LINUX_HOSTCFLAGS if not already set
53 [ -z "$LINUX_HOSTCFLAGS" ] && LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"
54
55 #Eclass functions only from here onwards...
56 #==============================================================
57 kernel_is() {
58 local RESULT
59 RESULT=1
60
61 if [ -n "${1}" ]
62 then
63 [ "${1}" = "${KV_MAJOR}" ] && RESULT=0
64 fi
65
66 if [ -n "${2}" ]
67 then
68 RESULT=1
69 [ "${2}" = "${KV_MINOR}" ] && RESULT=0
70 fi
71
72 if [ -n "${3}" ]
73 then
74 RESULT=1
75 [ "${3}" = "${KV_PATCH}" ] && RESULT=0
76 fi
77 return ${RESULT}
78 }
79
80 kernel_is_2_4() {
81 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 4 ] && return 0 || return 1
82 }
83
84 kernel_is_2_6() {
85 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 5 -o ${KV_MINOR} -eq 6 ] && return 0 || return 1
86 }
87
88 # Capture the sources type and set DEPENDs
89 if [ "${ETYPE}" == "sources" ]
90 then
91 #console-tools is needed to solve the loadkeys fiasco; binutils version needed to avoid Athlon/PIII/SSE assembler bugs.
92 DEPEND="!build? ( sys-apps/sed
93 >=sys-devel/binutils-2.11.90.0.31 )
94 doc? ( !arm? ( !s390? ( app-text/docbook-sgml-utils ) ) )"
95
96 RDEPEND="${DEPEND}
97 !build? ( >=sys-libs/ncurses-5.2
98 dev-lang/perl
99 sys-apps/module-init-tools
100 sys-devel/make )"
101
102 [ $(kernel_is_2_4) $? == 0 ] && PROVIDE="virtual/linux-sources" || PROVIDE="virtual/linux-sources virtual/alsa"
103
104 elif [ "${ETYPE}" == "headers" ]
105 then
106 PROVIDE="virtual/kernel virtual/os-headers"
107 else
108 eerror "Unknown ETYPE=\"${ETYPE}\", must be either \"sources\" or \"headers\""
109 die
110 fi
111
112 # Unpack functions
113 #==============================================================
114 unpack_2_4() {
115 cd ${S}
116 # this file is required for other things to build properly,
117 # so we autogenerate it
118 make mrproper || die "make mrproper died"
119 make include/linux/version.h || die "make include/linux/version.h failed"
120 echo ">>> version.h compiled successfully."
121 }
122
123 universal_unpack() {
124 [ -z "${OKV}" ] && OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
125
126 cd ${WORKDIR}
127 unpack linux-${OKV}.tar.bz2
128 if [ "${OKV}" != "${KV}" ]
129 then
130 mv linux-${OKV} linux-${KV} || die "Unable to move source tree to ${KV}."
131 fi
132 cd ${S}
133
134 # change incorrect install path
135 mv Makefile Makefile.orig
136 sed -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' \
137 Makefile.orig > Makefile
138 rm Makefile.orig
139
140 # remove all backup files
141 find . -iname "*~" -exec rm {} \; 2> /dev/null
142
143 if [ -d "${S}/Documentation/DocBook" ]
144 then
145 cd ${S}/Documentation/DocBook
146 sed -e "s:db2:docbook2:g" Makefile > Makefile.new \
147 && mv Makefile.new Makefile
148 cd ${S}
149 fi
150 }
151
152 unpack_set_extraversion() {
153 # Gentoo Linux uses /boot, so fix 'make install' to work properly and fix EXTRAVERSION
154 cd ${S}
155 mv Makefile Makefile.orig
156 sed -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" \
157 Makefile.orig > Makefile
158 rm Makefile.orig
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 -i -e "s#/usr/local/man#${D}/usr/man#g" scripts/makeman
262 make installmandocs
263 eend $?
264 sed -i -e "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} ${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="${ROOT}usr/src/linux-${KV}/security/selinux/include/security.h"
309 if use selinux && [ -f "$secfile" ]
310 then
311 local polver=$(awk '/POLICYDB_VERSION /{print $3}' $secfile)
312 einfo "The SELinux policy version of this kernel is $polver."
313 echo
314 fi
315
316 # if K_EXTRAEWARN is set then lets display it now
317 if [ -n "${K_EXTRAEWARN}" ]
318 then
319 echo ${K_EXTRAEWARN} | fmt |
320 while read -s ELINE
321 do
322 ewarn "${ELINE}"
323 done
324
325 echo
326 fi
327 }
328
329 postinst_headers() {
330 echo
331 einfo "Kernel headers are usually only used when recompiling glibc."
332 einfo "Following the installation of newer headers it is advised that"
333 einfo "you re-merge glibc as follows:"
334 einfo "# emerge glibc"
335 einfo "Failure to do so will cause glibc to not make use of newer"
336 einfo "features present in the updated kernelheaders."
337 echo
338 }
339
340 # pkg_setup functions
341 #==============================================================
342 setup_headers() {
343 ARCH=$(uname -m | sed -e s/[i].86/i386/ -e s/x86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/amd64/x86_64/)
344 [ "$ARCH" == "sparc" -a "$PROFILE_ARCH" == "sparc64" ] && ARCH="sparc64"
345
346 [ -z "${H_SUPPORTEDARCH}" ] && H_SUPPORTEDARCH="${PN/-*/}"
347 for i in ${H_SUPPORTEDARCH}
348 do
349 [ "${ARCH}" == "${i}" ] && H_ACCEPT_ARCH="yes"
350 done
351
352 if [ "${H_ACCEPT_ARCH}" != "yes" ]
353 then
354 echo
355 eerror "This version of ${PN} does not support ${ARCH}."
356 eerror "Please merge the appropriate sources, in most cases"
357 eerror "this will be ${ARCH}-headers."
358 die "incorrect headers"
359 fi
360 }
361
362 # unipatch
363 #==============================================================
364 unipatch() {
365 local i
366 local x
367 local extention
368 local PIPE_CMD
369 local UNIPATCH_DROP
370 local KPATCH_DIR
371 local PATCH_DEPTH
372 local ELINE
373 local STRICT_COUNT
374 local PATCH_LEVEL
375
376 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
377 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
378
379 # We're gonna need it when doing patches with a predefined patchlevel
380 shopt -s extglob
381
382 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers
383 # usage can be either via an env var or by params
384 # although due to the nature we pass this within this eclass
385 # it shall be by param only.
386 # -z "${UNIPATCH_LIST}" ] && UNIPATCH_LIST="${@}"
387 UNIPATCH_LIST="${@}"
388
389 #unpack any passed tarballs
390 for i in ${UNIPATCH_LIST}
391 do
392 if [ -n "$(echo ${i} | grep -e "\.tar" -e "\.tbz" -e "\.tgz")" ]
393 then
394 extention=${i/*./}
395 extention=${extention/:*/}
396 case ${extention} in
397 tbz2) PIPE_CMD="tar -xvjf";;
398 bz2) PIPE_CMD="tar -xvjf";;
399 tgz) PIPE_CMD="tar -xvzf";;
400 gz) PIPE_CMD="tar -xvzf";;
401 *) eerror "Unrecognized tarball compression"
402 die "Unrecognized tarball compression";;
403 esac
404
405 if [ -n "${UNIPATCH_STRICTORDER}" ]
406 then
407 STRICT_COUNT=$((${STRICT_COUNT} + 1))
408 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
409 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR}/${STRICT_COUNT}/ 1>/dev/null
410 else
411 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR} 1>/dev/null
412 fi
413
414 if [ $? == 0 ]
415 then
416 einfo "${i/*\//} unpacked"
417 [ -n "$(echo ${i} | grep ':')" ] && echo ">>> Strict patch levels not currently supported for tarballed patchsets"
418 else
419 eerror "Failed to unpack ${i/:*/}"
420 die "unable to unpack patch tarball"
421 fi
422 else
423 extention=${i/*./}
424 extention=${extention/:*/}
425 PIPE_CMD=""
426 case ${extention} in
427 bz2) PIPE_CMD="bzip2 -dc";;
428 patch) PIPE_CMD="cat";;
429 diff) PIPE_CMD="cat";;
430 gz|Z|z) PIPE_CMD="gzip -dc";;
431 ZIP|zip) PIPE_CMD="unzip -p";;
432 *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i/:*/}";;
433 esac
434
435 PATCH_LEVEL=${i/*([^:])?(:)}
436 i=${i/:*/}
437 x=${i/*\//}
438 x=${x/\.${extention}/}
439
440 if [ -n "${PIPE_CMD}" ]
441 then
442 if [ ! -r "${i}" ]
443 then
444 echo
445 eerror "FATAL: unable to locate:"
446 eerror "${i}"
447 eerror "for read-only. The file either has incorrect permissions"
448 eerror "or does not exist."
449 die Unable to locate ${i}
450 fi
451
452 if [ -n "${UNIPATCH_STRICTORDER}" ]
453 then
454 STRICT_COUNT=$((${STRICT_COUNT} + 1))
455 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
456 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${STRICT_COUNT}/${x}.patch${PATCH_LEVEL})
457 else
458 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL})
459 fi
460 fi
461 fi
462 done
463
464 #populate KPATCH_DIRS so we know where to look to remove the excludes
465 x=${KPATCH_DIR}
466 KPATCH_DIR=""
467 LC_ALL="C"
468 for i in $(find ${x} -type d | sort -n)
469 do
470 KPATCH_DIR="${KPATCH_DIR} ${i}"
471 done
472
473 #so now lets get rid of the patchno's we want to exclude
474 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
475 for i in ${UNIPATCH_DROP}
476 do
477 for x in ${KPATCH_DIR}
478 do
479 rm -f ${x}/${i}* 2>/dev/null
480 if [ $? == 0 ]
481 then
482 einfo "Excluding Patch #${i}"
483 einfo "From: ${x/${WORKDIR}/}"
484 fi
485 done
486 done
487
488 # and now, finally, we patch it :)
489 for x in ${KPATCH_DIR}
490 do
491 for i in $(find ${x} -maxdepth 1 -iname "*.patch*" -or -iname "*.diff" | sort -n)
492 do
493 STDERR_T="${T}/${i/*\//}"
494 STDERR_T="${STDERR_T/.patch*/.err}"
495
496 PATCH_DEPTH=${i/*.patch/}
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 OKV=${PV/_beta/-test}
554 OKV=${OKV/_rc/-rc}
555 OKV=${OKV/_pre*/}
556 OKV=${OKV/-r*/}
557
558 KV_MAJOR=$(echo ${OKV} | cut -d. -f1)
559 KV_MINOR=$(echo ${OKV} | cut -d. -f2)
560 KV_PATCH=$(echo ${OKV} | cut -d. -f3)
561 KV_PATCH=${KV_PATCH/[-_]*/}
562
563 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
564
565 RELEASE=${PV/${OKV}/}
566 RELEASE=${RELEASE/_beta/}
567 RELEASE=${RELEASE/_rc/-rc}
568 if [ $(kernel_is_2_4) $? == 0 ]
569 then
570 RELEASE=${RELEASE/_pre/-pre}
571 else
572 RELEASE=${RELEASE/_pre/-bk}
573 fi
574 RELEASETYPE=${RELEASE//[0-9]/}
575
576 EXTRAVERSION="${RELEASE}"
577
578 if [ -n "${K_PREPATCHED}" ]
579 then
580 EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}${PR/r/}"
581 else
582 [ -z "${K_NOUSENAME}" ] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}"
583 [ "${PR}" != "r0" ] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
584 fi
585
586 KV=${OKV}${EXTRAVERSION}
587
588 # -rcXX-bkXX pulls are *IMPOSSIBLE* to support within the portage naming convention
589 # these cannot be supported, but the code here can handle it up until this point
590 # and theoretically thereafter.
591
592 if [ "${RELEASETYPE}" == "-rc" -o "${RELEASETYPE}" == "-pre" ]
593 then
594 OKV="${KV_MAJOR}.${KV_MINOR}.$([ $((${KV_PATCH} - 1)) -lt 0 ] && echo ${KV_PATCH} || echo $((${KV_PATCH} - 1)))"
595 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/patch-${PV//_/-}.bz2
596 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
597 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${PV//_/-}.bz2"
598 KV=${PV/[-_]*/}${EXTRAVERSION}
599 fi
600
601 if [ "${RELEASETYPE}" == "-bk" ]
602 then
603 OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
604 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
605 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
606 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
607 KV=${PV/[-_]*/}${EXTRAVERSION}
608 fi
609
610 if [ "${RELEASETYPE}" == "-rc-bk" ]
611 then
612 OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))-${RELEASE/-bk*}"
613 EXTRAVERSION="$([ -n "${RELEASE}" ] && echo ${RELEASE/*-bk/-bk})$([ -n "${K_USENAME}" ] && echo -${PN/-*/})$([ ! "${PR}" == "r0" ] && echo -${PR})"
614
615 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
616 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
617 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
618 KV=${PV/[-_]*/}${EXTRAVERSION}
619 fi
620
621 S=${WORKDIR}/linux-${KV}
622 }
623
624 detect_arch() {
625 # This function sets ARCH_URI and ARCH_PATCH
626 # with the neccessary info for the arch sepecific compatibility
627 # patchsets.
628
629 local ALL_ARCH
630 local LOOP_ARCH
631 local COMPAT_URI
632 local i
633
634 # COMPAT_URI is the contents of ${ARCH}_URI
635 # ARCH_URI is the URI for all the ${ARCH}_URI patches
636 # ARCH_PATCH is ARCH_URI broken into files for UNIPATCH
637
638 ARCH_URI=""
639 ARCH_PATCH=""
640 ALL_ARCH="X86 PPC PPC64 SPARC MIPS ALPHA ARM HPPA AMD64 IA64 X86OBSD S390"
641
642 for LOOP_ARCH in ${ALL_ARCH}
643 do
644 COMPAT_URI="${LOOP_ARCH}_URI"
645 COMPAT_URI="${!COMPAT_URI}"
646
647 [ -n "${COMPAT_URI}" ] && ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr '[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )"
648
649 if [ "${LOOP_ARCH}" == "$(echo ${ARCH} | tr '[:lower:]' '[:upper:]')" ]
650 then
651 for i in ${COMPAT_URI}
652 do
653 ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
654 done
655 fi
656 done
657 }
658
659
660 # common functions
661 #==============================================================
662 kernel-2_src_unpack() {
663 universal_unpack
664 [ -n "${UNIPATCH_LIST}" -o -n "${UNIPATCH_LIST_DEFAULT}" ] && unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST}"
665 [ -z "${K_NOSETEXTRAVERSION}" ] && unpack_set_extraversion
666 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4
667 }
668
669 kernel-2_src_compile() {
670 [ "${ETYPE}" == "headers" ] && compile_headers
671 [ "${ETYPE}" == "sources" ] && use doc && ! use arm && ! use s390 && compile_manpages
672 }
673
674 kernel-2_pkg_preinst() {
675 [ "${ETYPE}" == "headers" ] && preinst_headers
676 }
677
678 kernel-2_src_install() {
679 install_universal
680 [ "${ETYPE}" == "headers" ] && install_headers
681 [ "${ETYPE}" == "sources" ] && install_sources
682 }
683
684 kernel-2_pkg_postinst() {
685 [ "${ETYPE}" == "headers" ] && postinst_headers
686 [ "${ETYPE}" == "sources" ] && postinst_sources
687 }
688
689 kernel-2_pkg_setup() {
690 [ "${ETYPE}" == "headers" ] && setup_headers
691
692 # This is to fix some weird portage bug? in stable versions of portage.
693 [ "${ETYPE}" == "sources" ] && echo ">>> Preparing to unpack..."
694 }

  ViewVC Help
Powered by ViewVC 1.1.20