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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.41 - (show annotations) (download)
Sun Aug 22 11:38:02 2004 UTC (14 years, 9 months ago) by johnm
Branch: MAIN
Changes since 1.40: +34 -14 lines
added support for strict patch level for patch files. no support for tarballs as yet. moved the sed for INSTALL_PATCH to universal_unpack

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

  ViewVC Help
Powered by ViewVC 1.1.20