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

Diff of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.46 Revision 1.47
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.46 2004/10/19 19:51:12 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.47 2004/11/24 16:36:38 johnm Exp $
4 4
5# Description: kernel.eclass rewrite for a clean base regarding the 2.6 5# kernel.eclass rewrite for a clean base regarding the 2.6 series of kernel
6# series of kernel with back-compatibility for 2.4 6# with back-compatibility for 2.4
7# 7#
8# Maintainer: John Mylchreest <johnm@gentoo.org> 8# Author: John Mylchreest <johnm@gentoo.org>
9# Copyright 2004 Gentoo Linux
9# 10#
10# Please direct your bugs to the current eclass maintainer :) 11# Please direct your bugs to the current eclass maintainer :)
12# thatll be: johnm
11 13
12# added functionality: 14# added functionality:
13# unipatch - a flexible, singular method to extract, add and remove patches. 15# unipatch - a flexible, singular method to extract, add and remove patches.
14 16
15# A Couple of env vars are available to effect usage of this eclass 17# A Couple of env vars are available to effect behaviour of this eclass
16# These are as follows: 18# These are as follows:
17# 19#
20# K_NOFIXINSTALL_PATH - some patches (wolk for example) dont like INSTALL_PATH
21# being fixed prior to patching. therefore having this
22# option set disables the command to change this.
18# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be automatically set within the kernel Makefile 23# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be
24# 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 25# K_NOUSENAME - if this is set then EXTRAVERSION will not include the
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 26# first part of ${PN} in EXTRAVERSION
21# - and not use it as a true package revision 27# K_PREPATCHED - if the patchset is prepatched (ie: mm-sources,
22# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in postinst and can be used to carry additional postinst messages 28# ck-sources, ac-sources) it will use PR (ie: -r5)
29# as the patchset version and not use it as a true
30# package revision
31# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in
32# postinst and can be used to carry additional postinst
33# messages
23# K_EXTRAEWARN - same as K_EXTRAEINFO except ewarn's instead of einfo's 34# 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 35# H_SUPPORTEDARCH - this should be a space separated list of ARCH's which
26 36# can be supported by the headers ebuild
27# UNIPATCH_LIST - space delimetered list of patches to be applied to the kernel 37# UNIPATCH_LIST - space delimetered list of patches to be applied to the
38# kernel
28# UNIPATCH_EXCLUDE - an addition var to support exlusion based completely on "<passedstring>*" and not "<passedno#>_*" 39# UNIPATCH_EXCLUDE - an additional var to support exlusion based completely
29# - this should _NOT_ be used from the ebuild as this is reserved for end users passing excludes from the cli 40# on "<passedstring>*" and not "<passedno#>_*"
41# - this should _NOT_ be used from the ebuild as this is
42# reserved for end users passing excludes from the cli
30# UNIPATCH_DOCS - space delimemeted list of docs to be installed to the doc dir 43# UNIPATCH_DOCS - space delimemeted list of docs to be installed to the
44# doc dir
31# UNIPATCH_STRICTORDER - if this is set places patches into directories of order, so they are applied in the order passed 45# UNIPATCH_STRICTORDER - if this is set places patches into directories of
46# order, so they are applied in the order passed
32 47
33ECLASS="kernel-2" 48ECLASS="kernel-2"
34INHERITED="$INHERITED $ECLASS" 49INHERITED="$INHERITED $ECLASS"
35EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst 50EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst
36 51
44SLOT="${KV}" 59SLOT="${KV}"
45 60
46# Grab kernel version from KV 61# Grab kernel version from KV
47KV_MAJOR=$(echo ${KV} | cut -d. -f1) 62KV_MAJOR=$(echo ${KV} | cut -d. -f1)
48KV_MINOR=$(echo ${KV} | cut -d. -f2) 63KV_MINOR=$(echo ${KV} | cut -d. -f2)
49KV_PATCH=$(echo ${KV} | cut -d. -f3) 64KV_PATCH=$(echo ${KV} | cut -d. -f3-)
50KV_PATCH=${KV_PATCH/[-_]*/} 65KV_PATCH=${KV_PATCH/[-_]*/}
51 66
52# set LINUX_HOSTCFLAGS if not already set 67# set LINUX_HOSTCFLAGS if not already set
53[ -z "$LINUX_HOSTCFLAGS" ] && LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include" 68[ -z "$LINUX_HOSTCFLAGS" ] && LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"
54 69
55#Eclass functions only from here onwards ... 70#Eclass functions only from here onwards...
56#============================================================== 71#==============================================================
57kernel_is() { 72kernel_is() {
58 local RESULT 73 local RESULT
59 RESULT=1 74 RESULT=1
60 75
80kernel_is_2_4() { 95kernel_is_2_4() {
81 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 4 ] && return 0 || return 1 96 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 4 ] && return 0 || return 1
82} 97}
83 98
84kernel_is_2_6() { 99kernel_is_2_6() {
85 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 5 -o ${KV_MINOR} -eq 6 ] && return 0 || return 1 100 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 5 -o ${KV_MINOR} -eq 6 ] && \
101 return 0 || return 1
86} 102}
87 103
88# Capture the sources type and set DEPENDs 104# Capture the sources type and set DEPENDs
89if [ "${ETYPE}" == "sources" ] 105if [ "${ETYPE}" == "sources" ]
90then 106then
91 #console-tools is needed to solve the loadkeys fiasco; binutils version needed to avoid Athlon/PIII/SSE assembler bugs. 107 # binutils version needed to avoid Athlon/PIII/SSE assembler bugs.
92 DEPEND="!build? ( sys-apps/sed 108 DEPEND="!build? ( sys-apps/sed
93 >=sys-devel/binutils-2.11.90.0.31 ) 109 >=sys-devel/binutils-2.11.90.0.31 )
94 doc? ( !arm? ( !s390? ( app-text/docbook-sgml-utils ) ) )" 110 doc? ( !arm? ( !s390? ( app-text/docbook-sgml-utils ) ) )"
95 111
96 RDEPEND="${DEPEND} 112 RDEPEND="${DEPEND}
97 !build? ( >=sys-libs/ncurses-5.2 113 !build? ( >=sys-libs/ncurses-5.2
98 dev-lang/perl 114 dev-lang/perl
99 sys-apps/module-init-tools 115 sys-apps/module-init-tools
100 sys-devel/make )" 116 sys-devel/make )"
101 117
102 [ $(kernel_is_2_4) $? == 0 ] && PROVIDE="virtual/linux-sources" || PROVIDE="virtual/linux-sources virtual/alsa" 118 [ $(kernel_is_2_4) $? == 0 ] && \
119 PROVIDE="virtual/linux-sources" || \
120 PROVIDE="virtual/linux-sources virtual/alsa"
103 121
104elif [ "${ETYPE}" == "headers" ] 122elif [ "${ETYPE}" == "headers" ]
105then 123then
106 PROVIDE="virtual/kernel virtual/os-headers" 124 PROVIDE="virtual/kernel virtual/os-headers"
107else 125else
125 143
126 cd ${WORKDIR} 144 cd ${WORKDIR}
127 unpack linux-${OKV}.tar.bz2 145 unpack linux-${OKV}.tar.bz2
128 if [ "${OKV}" != "${KV}" ] 146 if [ "${OKV}" != "${KV}" ]
129 then 147 then
130 mv linux-${OKV} linux-${KV} || die "Unable to move source tree to ${KV}." 148 mv linux-${OKV} linux-${KV} || \
149 die "Unable to move source tree to ${KV}."
131 fi 150 fi
132 cd ${S} 151 cd ${S}
133 152
134 # change incorrect install path 153 # change incorrect install path
135 mv Makefile Makefile.orig 154 [ -z "${K_NOFIXINSTALL_PATH}" ] && \
136 sed -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' \ 155 sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
137 Makefile.orig > Makefile
138 rm Makefile.orig
139 156
140 # remove all backup files 157 # remove all backup files
141 find . -iname "*~" -exec rm {} \; 2> /dev/null 158 find . -iname "*~" -exec rm {} \; 2> /dev/null
142 159
143 if [ -d "${S}/Documentation/DocBook" ] 160 if [ -d "${S}/Documentation/DocBook" ]
144 then 161 then
145 cd ${S}/Documentation/DocBook 162 cd ${S}/Documentation/DocBook
146 sed -e "s:db2:docbook2:g" Makefile > Makefile.new \ 163 sed -i -e "s:db2:docbook2:g" Makefile
147 && mv Makefile.new Makefile
148 cd ${S} 164 cd ${S}
149 fi 165 fi
150} 166}
151 167
152unpack_set_extraversion() { 168unpack_set_extraversion() {
153 # Gentoo Linux uses /boot, so fix 'make install' to work properly and fix EXTRAVERSION
154 cd ${S} 169 cd ${S}
155 mv Makefile Makefile.orig
156 sed -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" \ 170 sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
157 Makefile.orig > Makefile
158 rm Makefile.orig
159} 171}
160 172
161# Compile Functions 173# Compile Functions
162#============================================================== 174#==============================================================
163compile_headers() { 175compile_headers() {
171} 183}
172 184
173compile_manpages() { 185compile_manpages() {
174 local MY_ARCH 186 local MY_ARCH
175 187
176 einfo "Making manpages ..." 188 einfo "Making manpages..."
177 MY_ARCH=${ARCH} 189 MY_ARCH=${ARCH}
178 unset ARCH 190 unset ARCH
179 make mandocs 191 make mandocs
180 ARCH=${MY_ARCH} 192 ARCH=${MY_ARCH}
181} 193}
213 local docs 225 local docs
214 local file 226 local file
215 227
216 cd ${S} 228 cd ${S}
217 dodir /usr/src 229 dodir /usr/src
218 echo ">>> Copying sources ..." 230 echo ">>> Copying sources..."
219 file="$(find ${WORKDIR} -iname "docs" -type d)" 231 file="$(find ${WORKDIR} -iname "docs" -type d)"
220 if [ -n "${file}" ] 232 if [ -n "${file}" ]
221 then 233 then
222 for file in $(find ${file} -type f) 234 for file in $(find ${file} -type f)
223 do 235 do
224 echo "${file/*docs\//}" >> ${S}/patches.txt 236 echo "${file/*docs\//}" >> ${S}/patches.txt
225 echo "===================================================" >> ${S}/patches.txt 237 echo "=========================================" >> ${S}/patches.txt
226 cat ${file} >> ${S}/patches.txt 238 cat ${file} >> ${S}/patches.txt
227 echo "===================================================" >> ${S}/patches.txt 239 echo "=========================================" >> ${S}/patches.txt
228 echo "" >> ${S}/patches.txt 240 echo "" >> ${S}/patches.txt
229 done 241 done
230 fi 242 fi
231 243
232 if [ ! -f ${S}/patches.txt ] 244 if [ ! -f ${S}/patches.txt ]
233 then 245 then
234 # patches.txt is empty so lets use our ChangeLog 246 # 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 247 [ -f ${FILESDIR}/../ChangeLog ] && \
248 echo "Please check the ebuild ChangeLog for more details." \
249 > ${S}/patches.txt
236 fi 250 fi
237 251
238 for doc in ${UNIPATCH_DOCS} 252 for doc in ${UNIPATCH_DOCS}
239 do 253 do
240 [ -f ${doc} ] && docs="${docs} ${doc}" 254 [ -f ${doc} ] && docs="${docs} ${doc}"
302 done 316 done
303 317
304 echo 318 echo
305 fi 319 fi
306 320
307 # Show policy version, if this kernel has SELinux ... 321 # Show policy version, if this kernel has SELinux...
308 local secfile="${ROOT}usr/src/linux-${KV}/security/selinux/include/security.h" 322 local secfile="${ROOT}usr/src/linux-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}/security/selinux/include/security.h"
309 if use selinux && [ -f "$secfile" ] 323 if use selinux && [ -f "$secfile" ]
310 then 324 then
311 local polver=$(awk '/POLICYDB_VERSION /{print $3}' $secfile) 325 local polver=$(awk '/POLICYDB_VERSION /{print $3}' $secfile)
312 einfo "The SELinux policy version of this kernel is $polver." 326 einfo "The SELinux policy version of this kernel is $polver."
313 echo 327 echo
338} 352}
339 353
340# pkg_setup functions 354# pkg_setup functions
341#============================================================== 355#==============================================================
342setup_headers() { 356setup_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/) 357 ARCH=$(uname -m | sed -e s/[i].86/i386/ -e s/x86/i386/ \
358 -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ \
359 -e s/amd64/x86_64/)
344 [ "$ARCH" == "sparc" -a "$PROFILE_ARCH" == "sparc64" ] && ARCH="sparc64" 360 [ "$ARCH" == "sparc" -a "$PROFILE_ARCH" == "sparc64" ] && ARCH="sparc64"
345 361
346 [ -z "${H_SUPPORTEDARCH}" ] && H_SUPPORTEDARCH="${PN/-*/}" 362 [ -z "${H_SUPPORTEDARCH}" ] && H_SUPPORTEDARCH="${PN/-*/}"
347 for i in ${H_SUPPORTEDARCH} 363 for i in ${H_SUPPORTEDARCH}
348 do 364 do
377 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR} 393 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
378 394
379 # We're gonna need it when doing patches with a predefined patchlevel 395 # We're gonna need it when doing patches with a predefined patchlevel
380 shopt -s extglob 396 shopt -s extglob
381 397
382 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers 398 # This function will unpack all passed tarballs, add any passed patches,
399 # and remove any passed patchnumbers
383 # usage can be either via an env var or by params 400 # usage can be either via an env var or by params
384 # although due to the nature we pass this within this eclass 401 [ -n "${@}" ] && UNIPATCH_LIST="${@} ${UNIPATCH_LIST}"
385 # it shall be by param only.
386 # -z "${UNIPATCH_LIST}" ] && UNIPATCH_LIST="${@}"
387 UNIPATCH_LIST="${@}"
388 402
389 #unpack any passed tarballs 403 #unpack any passed tarballs
390 for i in ${UNIPATCH_LIST} 404 for i in ${UNIPATCH_LIST}
391 do 405 do
392 if [ -n "$(echo ${i} | grep -e "\.tar" -e "\.tbz" -e "\.tgz")" ] 406 if [ -n "$(echo ${i} | grep -e "\.tar" -e "\.tbz" -e "\.tgz")" ]
404 418
405 if [ -n "${UNIPATCH_STRICTORDER}" ] 419 if [ -n "${UNIPATCH_STRICTORDER}" ]
406 then 420 then
407 STRICT_COUNT=$((${STRICT_COUNT} + 1)) 421 STRICT_COUNT=$((${STRICT_COUNT} + 1))
408 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/ 422 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
409 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR}/${STRICT_COUNT}/ 1>/dev/null 423 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR}/${STRICT_COUNT}/ \
424 1>/dev/null
410 else 425 else
411 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR} 1>/dev/null 426 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR} 1>/dev/null
412 fi 427 fi
413 428
414 if [ $? == 0 ] 429 if [ $? == 0 ]
415 then 430 then
416 einfo "${i/*\//} unpacked" 431 einfo "${i/*\//} unpacked"
432 [ -n "$(echo ${i} | grep ':')" ] && \
417 [ -n "$(echo ${i} | grep ':')" ] && echo ">>> Strict patch levels not currently supported for tarballed patchsets" 433 echo ">>> Strict patch levels not currently supported for tarballed patchsets"
418 else 434 else
419 eerror "Failed to unpack ${i/:*/}" 435 eerror "Failed to unpack ${i/:*/}"
420 die "unable to unpack patch tarball" 436 die "unable to unpack patch tarball"
421 fi 437 fi
422 else 438 else
442 if [ ! -r "${i}" ] 458 if [ ! -r "${i}" ]
443 then 459 then
444 echo 460 echo
445 eerror "FATAL: unable to locate:" 461 eerror "FATAL: unable to locate:"
446 eerror "${i}" 462 eerror "${i}"
447 eerror "for read-only. The file either has incorrect permissions" 463 eerror "for read-only. The file either has incorrect"
448 eerror "or does not exist." 464 eerror "permissions or does not exist."
449 die Unable to locate ${i} 465 die Unable to locate ${i}
450 fi 466 fi
451 467
452 if [ -n "${UNIPATCH_STRICTORDER}" ] 468 if [ -n "${UNIPATCH_STRICTORDER}" ]
453 then 469 then
454 STRICT_COUNT=$((${STRICT_COUNT} + 1)) 470 STRICT_COUNT=$((${STRICT_COUNT} + 1))
455 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/ 471 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
472 $(${PIPE_CMD} ${i} > \
456 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${STRICT_COUNT}/${x}.patch${PATCH_LEVEL}) 473 ${KPATCH_DIR}/${STRICT_COUNT}/${x}.patch${PATCH_LEVEL})
457 else 474 else
458 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL}) 475 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL})
459 fi 476 fi
460 fi 477 fi
461 fi 478 fi
472 489
473 #so now lets get rid of the patchno's we want to exclude 490 #so now lets get rid of the patchno's we want to exclude
474 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}" 491 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
475 for i in ${UNIPATCH_DROP} 492 for i in ${UNIPATCH_DROP}
476 do 493 do
494 einfo "Excluding Patch #${i}"
477 for x in ${KPATCH_DIR} 495 for x in ${KPATCH_DIR}
478 do 496 do
479 rm -f ${x}/${i}* 2>/dev/null 497 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 498 done
486 done 499 done
487 500
488 # and now, finally, we patch it :) 501 # and now, finally, we patch it :)
489 for x in ${KPATCH_DIR} 502 for x in ${KPATCH_DIR}
490 do 503 do
491 for i in $(find ${x} -maxdepth 1 -iname "*.patch*" -or -iname "*.diff" | sort -n) 504 for i in $(find ${x} -maxdepth 1 -iname "*.patch*" -or -iname "*.diff*" | sort -n)
492 do 505 do
506 unset PATCH_DEPTH
507
493 STDERR_T="${T}/${i/*\//}" 508 STDERR_T="${T}/${i/*\//}"
494 STDERR_T="${STDERR_T/.patch*/.err}" 509 STDERR_T="${STDERR_T/.patch*/.err}"
510 STDERR_T="${STDERR_T/.diff*/.err}"
495 511
496 PATCH_DEPTH=${i/*.patch/} 512 [ -z ${i/*.patch*/} ] && PATCH_DEPTH=${i/*.patch/}
513 [ -z ${i/*.diff*/} ] && PATCH_DEPTH=${i/*.diff/}
497 514
498 if [ -z "${PATCH_DEPTH}" ]; then 515 if [ -z "${PATCH_DEPTH}" ]; then
499 PATCH_DEPTH=0 516 PATCH_DEPTH=0
500 fi 517 fi
501 518
502 ebegin "Applying ${i/*\//} (-p${PATCH_DEPTH}+)" 519 ebegin "Applying ${i/*\//} (-p${PATCH_DEPTH}+)"
503 while [ ${PATCH_DEPTH} -lt 5 ] 520 while [ ${PATCH_DEPTH} -lt 5 ]
504 do 521 do
505 echo "Attempting Dry-run:" >> ${STDERR_T} 522 echo "Attempting Dry-run:" >> ${STDERR_T}
506 echo "cmd: patch -p${PATCH_DEPTH} --dry-run -f < ${i}" >> ${STDERR_T} 523 echo "cmd: patch -p${PATCH_DEPTH} --dry-run -f < ${i}" >> ${STDERR_T}
507 echo "=======================================================" >> ${STDERR_T} 524 echo "==========================================" >> ${STDERR_T}
508 if [ $(patch -p${PATCH_DEPTH} --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ] 525 if [ $(patch -p${PATCH_DEPTH} --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ]
509 then 526 then
510 echo "Attempting patch:" > ${STDERR_T} 527 echo "Attempting patch:" > ${STDERR_T}
511 echo "cmd: patch -p${PATCH_DEPTH} -f < ${i}" >> ${STDERR_T} 528 echo "cmd: patch -p${PATCH_DEPTH} -f < ${i}" >> ${STDERR_T}
512 echo "=======================================================" >> ${STDERR_T} 529 echo "======================================" >> ${STDERR_T}
513 if [ $(patch -p${PATCH_DEPTH} -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ] 530 if [ $(patch -p${PATCH_DEPTH} -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ]
514 then 531 then
515 eend 0 532 eend 0
516 rm ${STDERR_T} 533 rm ${STDERR_T}
517 break 534 break
518 else 535 else
519 eend 1 536 eend 1
520 eerror "Failed to apply patch ${i/*\//}" 537 eerror "Failed to apply patch ${i/*\//}"
521 eerror "Please attach ${STDERR_T} to any bug you may post." 538 eerror "Please attach ${STDERR_T} to any bug you post."
522 die "Failed to apply ${i/*\//}" 539 die "Failed to apply ${i/*\//}"
523 fi 540 fi
524 else 541 else
525 PATCH_DEPTH=$((${PATCH_DEPTH} + 1)) 542 PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
526 fi 543 fi
527 done 544 done
528 if [ ${PATCH_DEPTH} -eq 5 ] 545 if [ ${PATCH_DEPTH} -eq 5 ]
529 then 546 then
530 eend 1 547 eend 1
531 eerror "Please attach ${STDERR_T} to any bug you may post." 548 eerror "Please attach ${STDERR_T} to any bug you post."
532 die "Unable to dry-run patch." 549 die "Unable to dry-run patch."
533 fi 550 fi
534 done 551 done
535 done 552 done
536 553
544 561
545# custom functions 562# custom functions
546#============================================================== 563#==============================================================
547detect_version() { 564detect_version() {
548 # this function will detect and set 565 # this function will detect and set
549 # - OKV: Original Kernel Version (2.6.0/2.6.0-test11) 566 # 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) 567 # KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
551 # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1) 568 # EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1)
552 569
570 if [ -z "${OKV}" ]
571 then
553 OKV=${PV/_beta/-test} 572 OKV=${PV/_beta/-test}
554 OKV=${OKV/_rc/-rc} 573 OKV=${OKV/_rc/-rc}
555 OKV=${OKV/_pre*/} 574 OKV=${OKV/_pre*/}
556 OKV=${OKV/-r*/} 575 OKV=${OKV/-r*/}
576 fi
557 577
558 KV_MAJOR=$(echo ${OKV} | cut -d. -f1) 578 KV_MAJOR=$(echo ${OKV} | cut -d. -f1)
559 KV_MINOR=$(echo ${OKV} | cut -d. -f2) 579 KV_MINOR=$(echo ${OKV} | cut -d. -f2)
560 KV_PATCH=$(echo ${OKV} | cut -d. -f3) 580 KV_PATCH=$(echo ${OKV} | cut -d. -f3)
561 KV_PATCH=${KV_PATCH/[-_]*/} 581 KV_PATCH=${KV_PATCH/[-_]*/}
562 582
563 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2" 583 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
564 584
565 RELEASE=${PV/${OKV}/} 585 RELEASE=${PV/${OKV}/}
566 RELEASE=${RELEASE/_beta/} 586 RELEASE=${RELEASE/_beta/}
567 RELEASE=${RELEASE/_rc/-rc} 587 RELEASE=${RELEASE/_rc/-rc}
568 if [ $(kernel_is_2_4) $? == 0 ] 588 if [ $(kernel_is_2_4) $? == 0 ]
569 then 589 then
570 RELEASE=${RELEASE/_pre/-pre} 590 RELEASE=${RELEASE/_pre/-pre}
571 else 591 else
572 RELEASE=${RELEASE/_pre/-bk} 592 RELEASE=${RELEASE/_pre/-bk}
573 fi 593 fi
574 RELEASETYPE=${RELEASE//[0-9]/} 594 RELEASETYPE=${RELEASE//[0-9]/}
575 595
576 EXTRAVERSION="${RELEASE}" 596 EXTRAVERSION="${RELEASE}"
577 597
578 if [ -n "${K_PREPATCHED}" ] 598 if [ -n "${K_PREPATCHED}" ]
579 then 599 then
580 EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}${PR/r/}" 600 EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}${PR/r/}"
581 else 601 else
582 [ -z "${K_NOUSENAME}" ] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}" 602 [ -z "${K_NOUSENAME}" ] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}"
603 [ "${PN/-*/}" == "wolk" ] && EXTRAVERSION="-${PN/-*/}-${PV}"
583 [ "${PR}" != "r0" ] && EXTRAVERSION="${EXTRAVERSION}-${PR}" 604 [ "${PR}" != "r0" ] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
584 fi 605 fi
585 606
586 KV=${OKV}${EXTRAVERSION} 607 KV=${OKV}${EXTRAVERSION}
587 608
588 # -rcXX-bkXX pulls are *IMPOSSIBLE* to support within the portage naming convention 609 # -rcXX-bkXX pulls are *IMPOSSIBLE* to support within the
589 # these cannot be supported, but the code here can handle it up until this point 610 # portage naming convention these cannot be supported, but the code here can
590 # and theoretically thereafter. 611 # handle it up until this point and theoretically thereafter.
591 612
592 if [ "${RELEASETYPE}" == "-rc" -o "${RELEASETYPE}" == "-pre" ] 613 if [ "${RELEASETYPE}" == "-rc" -o "${RELEASETYPE}" == "-pre" ]
593 then 614 then
594 OKV="${KV_MAJOR}.${KV_MINOR}.$([ $((${KV_PATCH} - 1)) -lt 0 ] && echo ${KV_PATCH} || echo $((${KV_PATCH} - 1)))" 615 OKV="${KV_MAJOR}.${KV_MINOR}.$([ $((${KV_PATCH} - 1)) -lt 0 ] && \
616 echo ${KV_PATCH} || echo $((${KV_PATCH} - 1)))"
595 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/patch-${PV//_/-}.bz2 617 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" 618 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
597 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${PV//_/-}.bz2" 619 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${PV//_/-}.bz2"
598 KV=${PV/[-_]*/}${EXTRAVERSION} 620 KV=${PV/[-_]*/}${EXTRAVERSION}
599 fi 621 fi
615 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2 637 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" 638 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" 639 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
618 KV=${PV/[-_]*/}${EXTRAVERSION} 640 KV=${PV/[-_]*/}${EXTRAVERSION}
619 fi 641 fi
620 642
621 S=${WORKDIR}/linux-${KV} 643 S=${WORKDIR}/linux-${KV}
622} 644}
623 645
624detect_arch() { 646detect_arch() {
625 # This function sets ARCH_URI and ARCH_PATCH 647 # This function sets ARCH_URI and ARCH_PATCH
642 for LOOP_ARCH in ${ALL_ARCH} 664 for LOOP_ARCH in ${ALL_ARCH}
643 do 665 do
644 COMPAT_URI="${LOOP_ARCH}_URI" 666 COMPAT_URI="${LOOP_ARCH}_URI"
645 COMPAT_URI="${!COMPAT_URI}" 667 COMPAT_URI="${!COMPAT_URI}"
646 668
647 [ -n "${COMPAT_URI}" ] && ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr '[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )" 669 [ -n "${COMPAT_URI}" ] && \
670 ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr [A-Z] [a-z])? ( ${COMPAT_URI} )"
648 671
649 if [ "${LOOP_ARCH}" == "$(echo ${ARCH} | tr '[:lower:]' '[:upper:]')" ] 672 if [ "${LOOP_ARCH}" == "$(echo ${ARCH} | tr [a-z] [A-Z])" ]
650 then 673 then
651 for i in ${COMPAT_URI} 674 for i in ${COMPAT_URI}
652 do 675 do
653 ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}" 676 ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
654 done 677 done
659 682
660# common functions 683# common functions
661#============================================================== 684#==============================================================
662kernel-2_src_unpack() { 685kernel-2_src_unpack() {
663 universal_unpack 686 universal_unpack
664 [ -n "${UNIPATCH_LIST}" -o -n "${UNIPATCH_LIST_DEFAULT}" ] && unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST}" 687 [ -n "${UNIPATCH_LIST}" -o -n "${UNIPATCH_LIST_DEFAULT}" ] && \
688 unipatch "${UNIPATCH_LIST_DEFAULT}"
665 [ -z "${K_NOSETEXTRAVERSION}" ] && unpack_set_extraversion 689 [ -z "${K_NOSETEXTRAVERSION}" ] && unpack_set_extraversion
666 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4 690 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4
667} 691}
668 692
669kernel-2_src_compile() { 693kernel-2_src_compile() {
670 [ "${ETYPE}" == "headers" ] && compile_headers 694 [ "${ETYPE}" == "headers" ] && compile_headers
695 [ "${ETYPE}" == "sources" ] && \
671 [ "${ETYPE}" == "sources" ] && use doc && ! use arm && ! use s390 && compile_manpages 696 use doc && ! use arm && ! use s390 && compile_manpages
672} 697}
673 698
674kernel-2_pkg_preinst() { 699kernel-2_pkg_preinst() {
675 [ "${ETYPE}" == "headers" ] && preinst_headers 700 [ "${ETYPE}" == "headers" ] && preinst_headers
676} 701}
688 713
689kernel-2_pkg_setup() { 714kernel-2_pkg_setup() {
690 [ "${ETYPE}" == "headers" ] && setup_headers 715 [ "${ETYPE}" == "headers" ] && setup_headers
691 716
692 # This is to fix some weird portage bug? in stable versions of portage. 717 # This is to fix some weird portage bug? in stable versions of portage.
693 [ "${ETYPE}" == "sources" ] && echo ">>> Preparing to unpack ..." 718 [ "${ETYPE}" == "sources" ] && echo ">>> Preparing to unpack..."
694} 719}

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.47

  ViewVC Help
Powered by ViewVC 1.1.20