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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.33 - (hide annotations) (download)
Fri Apr 16 18:14:00 2004 UTC (15 years, 2 months ago) by plasmaroo
Branch: MAIN
Changes since 1.32: +85 -30 lines
Added in johnm's changes to fix issues with development Portage versions.

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

  ViewVC Help
Powered by ViewVC 1.1.20