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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.36 - (show annotations) (download)
Sun Jul 4 23:48:19 2004 UTC (14 years, 10 months ago) by tseng
Branch: MAIN
Changes since 1.35: +2 -2 lines
Trivial fix for kernel-2.eclass when excluding a read-only patch.

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

  ViewVC Help
Powered by ViewVC 1.1.20