/[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.12 Revision 1.28
1# Copyright 1999-2004 Gentoo Technologies, Inc.
2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.28 2004/02/16 00:40:41 johnm Exp $
4
1# kernel.eclass rewrite for a clean base regarding the 2.6 series of kernel 5# kernel.eclass rewrite for a clean base regarding the 2.6 series of kernel
2# with back-compatibility for 2.4 6# with back-compatibility for 2.4
3# 7#
4# Author: John Mylchreest <johnm@gentoo.org> 8# Author: John Mylchreest <johnm@gentoo.org>
5# Copyright 2004 Gentoo Linux 9# Copyright 2004 Gentoo Linux
13# A Couple of env vars are available to effect usage of this eclass 17# A Couple of env vars are available to effect usage of this eclass
14# These are as follows: 18# These are as follows:
15# 19#
16# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be automatically set within the kernel Makefile 20# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be automatically set within the kernel Makefile
17# K_NOUSENAME - if this is set then EXTRAVERSION will not include the first part of ${PN} in EXTRAVERSION 21# K_NOUSENAME - if this is set then EXTRAVERSION will not include the first part of ${PN} in EXTRAVERSION
18# 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 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
19# - and not use it as a true package revision 23# - and not use it as a true package revision
20# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in postinst and can be used to carry additional postinst messages 24# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in postinst and can be used to carry additional postinst messages
21# K_EXTRAEWARN - same as K_EXTRAEINFO except ewarn's instead of einfo's 25# K_EXTRAEWARN - same as K_EXTRAEINFO except ewarn's instead of einfo's
22 26
23# H_SUPPORTEDARCH - this should be a space separated list of ARCH's which can be supported by the headers ebuild 27# H_SUPPORTEDARCH - this should be a space separated list of ARCH's which can be supported by the headers ebuild
24 28
25# UNIPATCH_LIST - space delimetered list of patches to be applied to the kernel 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
26# UNIPATCH_DOCS - space delimemeted list of docs to be installed to the doc dir 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
27 34
28ECLASS="kernel-2" 35ECLASS="kernel-2"
29EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst 36EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst
30 37
31HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/" 38HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/"
32LICENSE="GPL-2" 39LICENSE="GPL-2"
33IUSE="${IUSE} build" 40IUSE="${IUSE} build"
34SLOT="${KV}" 41SLOT="${KV}"
42
43# Grab kernel version from KV
44KV_MAJOR=$(echo ${KV} | cut -d. -f1)
45KV_MINOR=$(echo ${KV} | cut -d. -f2)
46KV_PATCH=$(echo ${KV} | cut -d. -f3)
47KV_PATCH=${KV_PATCH/[-_]*/}
48
49# set LINUX_HOSTCFLAGS if not already set
50[ -z "$LINUX_HOSTCFLAGS" ] && LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"
51
52
53#eclass functions only from here onwards.
54#==============================================================
55kernel_is_2_4() {
56 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 4 ] && return 0 || return 1
57}
58
59kernel_is_2_6() {
60 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 5 -o ${KV_MINOR} -eq 6 ] && return 0 || return 1
61}
35 62
36# capture the sources type and set depends 63# capture the sources type and set depends
37if [ "${ETYPE}" == "sources" ] 64if [ "${ETYPE}" == "sources" ]
38then 65then
39 #console-tools is needed to solve the loadkeys fiasco; binutils version needed to avoid Athlon/PIII/SSE assembler bugs. 66 #console-tools is needed to solve the loadkeys fiasco; binutils version needed to avoid Athlon/PIII/SSE assembler bugs.
43 RDEPEND="${DEPEND} 70 RDEPEND="${DEPEND}
44 !build? ( >=sys-libs/ncurses-5.2 71 !build? ( >=sys-libs/ncurses-5.2
45 dev-lang/perl 72 dev-lang/perl
46 sys-apps/module-init-tools 73 sys-apps/module-init-tools
47 sys-devel/make )" 74 sys-devel/make )"
48 75
49 PROVIDE="virtual/linux-sources virtual/alsa" 76 [ $(kernel_is_2_4) $? == 0 ] && PROVIDE="virtual/linux-sources" || PROVIDE="virtual/linux-sources virtual/alsa"
50 77
51elif [ "${ETYPE}" == "headers" ] 78elif [ "${ETYPE}" == "headers" ]
52then 79then
53 PROVIDE="virtual/kernel virtual/os-headers" 80 PROVIDE="virtual/kernel virtual/os-headers"
54else 81else
55 eerror "Unknown ETYPE=\"${ETYPE}\", must be either \"sources\" or \"headers\"" 82 eerror "Unknown ETYPE=\"${ETYPE}\", must be either \"sources\" or \"headers\""
56 die 83 die
57fi 84fi
58
59# Grab kernel version from KV
60KV_MAJOR=$(echo ${KV} | cut -d. -f1)
61KV_MINOR=$(echo ${KV} | cut -d. -f2)
62KV_PATCH=$(echo ${KV} | cut -d. -f3)
63KV_PATCH=${KV_PATCH/[-_]*/}
64
65# set LINUX_HOSTCFLAGS if not already set
66[ -z "$LINUX_HOSTCFLAGS" ] && LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"
67
68
69#eclass functions only from here onwards.
70#==============================================================
71kernel_is_2_4() {
72 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 4 ] && return 0 || return 1
73}
74
75kernel_is_2_6() {
76 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 5 -o ${KV_MINOR} -eq 6 ] && return 0 || return 1
77}
78
79 85
80# Unpack functions 86# Unpack functions
81#============================================================== 87#==============================================================
82unpack_2_4() { 88unpack_2_4() {
83 cd ${S} 89 cd ${S}
132 chmod -R a+r-w+X,u+w * 138 chmod -R a+r-w+X,u+w *
133} 139}
134 140
135install_headers() { 141install_headers() {
136 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4 142 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4
137 [ $(kernel_is_2_6) $? == 0 ] && ln -sf ${S}/include/asm-${ARCH} ${S}/include/asm 143
138
139 cd ${S} 144 cd ${S}
140 dodir /usr/include/linux 145 dodir /usr/include/linux
146 ln -sf ${S}/include/asm-${ARCH} ${S}/include/asm
141 cp -ax ${S}/include/linux/* ${D}/usr/include/linux 147 cp -ax ${S}/include/linux/* ${D}/usr/include/linux
142 rm -rf ${D}/usr/include/linux/modules 148 rm -rf ${D}/usr/include/linux/modules
149
143 dodir /usr/include/asm 150 dodir /usr/include/asm
144 cp -ax ${S}/include/asm/* ${D}/usr/include/asm 151 cp -ax ${S}/include/asm/* ${D}/usr/include/asm
145 152
146 if [ $(kernel_is_2_6) $? == 0 ] 153 if [ $(kernel_is_2_6) $? == 0 ]
147 then 154 then
151} 158}
152 159
153install_sources() { 160install_sources() {
154 local doc 161 local doc
155 local docs 162 local docs
163 local file
156 164
157 cd ${S} 165 cd ${S}
158 dodir /usr/src 166 dodir /usr/src
159 echo ">>> Copying sources..." 167 echo ">>> Copying sources..."
160 if [ -d "${WORKDIR}/${KV}/docs/" ] 168 file="$(find ${WORKDIR} -iname "docs" -type d)"
169 if [ -n "${file}" ]
161 then 170 then
162 for file in $(ls -1 ${WORKDIR}/${KV}/docs/) 171 for file in $(find ${file} -type f)
163 do 172 do
164 echo "XX_${file}*" >> ${S}/patches.txt 173 echo "${file/*docs\//}" >> ${S}/patches.txt
174 echo "===================================================" >> ${S}/patches.txt
165 cat ${WORKDIR}/${KV}/docs/${file} >> ${S}/patches.txt 175 cat ${file} >> ${S}/patches.txt
176 echo "===================================================" >> ${S}/patches.txt
166 echo "" >> ${S}/patches.txt 177 echo "" >> ${S}/patches.txt
167 done 178 done
168 fi 179 fi
169 180
170 if [ ! -f ${S}/patches.txt ] 181 if [ ! -f ${S}/patches.txt ]
179 done 190 done
180 191
181 if [ -f ${S}/patches.txt ]; then 192 if [ -f ${S}/patches.txt ]; then
182 docs="${docs} ${S}/patches.txt" 193 docs="${docs} ${S}/patches.txt"
183 fi 194 fi
195
184 dodoc ${docs} 196 dodoc ${docs}
185 mv ${WORKDIR}/linux* ${D}/usr/src 197 mv ${WORKDIR}/linux* ${D}/usr/src
186} 198}
187 199
188# pkg_preinst functions 200# pkg_preinst functions
275unipatch() { 287unipatch() {
276 local i 288 local i
277 local x 289 local x
278 local extention 290 local extention
279 local PIPE_CMD 291 local PIPE_CMD
280 local UNIPATCH_EXCLUDE 292 local UNIPATCH_DROP
281 local KPATCH_DIR 293 local KPATCH_DIR
282 local PATCH_DEPTH 294 local PATCH_DEPTH
283 local ELINE 295 local ELINE
296 local STRICT_COUNT
284 297
285 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/" 298 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
286 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR} 299 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
287 300
288 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers 301 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers
289 # usage can be either via an env var or by params 302 # usage can be either via an env var or by params
303 # although due to the nature we pass this within this eclass
304 # it shall be by param only.
290 [ -z "${UNIPATCH_LIST}" ] && UNIPATCH_LIST="${@}" 305 # -z "${UNIPATCH_LIST}" ] && UNIPATCH_LIST="${@}"
306 UNIPATCH_LIST="${@}"
291 307
292 #unpack any passed tarballs 308 #unpack any passed tarballs
293 for i in ${UNIPATCH_LIST} 309 for i in ${UNIPATCH_LIST}
294 do 310 do
295 if [ -n "$(echo ${i} | grep -e "\.tar" -e "\.tbz" -e "\.tgz")" ] 311 if [ -n "$(echo ${i} | grep -e "\.tar" -e "\.tbz" -e "\.tgz")" ]
302 gz) PIPE_CMD="tar -xvzf";; 318 gz) PIPE_CMD="tar -xvzf";;
303 *) eerror "Unrecognized tarball compression" 319 *) eerror "Unrecognized tarball compression"
304 die "Unrecognized tarball compression";; 320 die "Unrecognized tarball compression";;
305 esac 321 esac
306 322
323 if [ -n "${UNIPATCH_STRICTORDER}" ]
324 then
325 STRICT_COUNT=$((${STRICT_COUNT} + 1))
326 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
327 ${PIPE_CMD} ${i} -C ${KPATCH_DIR}/${STRICT_COUNT}/ 1>/dev/null
328 else
307 ${PIPE_CMD} ${i} -C ${KPATCH_DIR} 1>/dev/null 329 ${PIPE_CMD} ${i} -C ${KPATCH_DIR} 1>/dev/null
330 fi
331
308 if [ $? == 0 ] 332 if [ $? == 0 ]
309 then 333 then
310 einfo "${i/*\//} unpacked" 334 einfo "${i/*\//} unpacked"
311 else 335 else
312 eerror "Failed to unpack ${i}" 336 eerror "Failed to unpack ${i}"
313 die "unable to unpack patch tarball" 337 die "unable to unpack patch tarball"
314 fi 338 fi
315 339 else
316 UNIPATCH_LIST="${UNIPATCH_LIST/${i}/}" 340 extention=${i/*./}
341 PIPE_CMD=""
342 case ${extention} in
343 bz2) PIPE_CMD="bzip2 -dc";;
344 patch) PIPE_CMD="cat";;
345 diff) PIPE_CMD="cat";;
346 gz|Z|z) PIPE_CMD="gzip -dc";;
347 ZIP|zip) PIPE_CMD="unzip -p";;
348 *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i}";;
349 esac
350 x=${i/*\//}
351 x=${x/\.${extention}/}
352
353 if [ -n "${UNIPATCH_STRICTORDER}" -a -n "${PIPE_CMD}" ]
354 then
355 STRICT_COUNT=$((${STRICT_COUNT} + 1))
356 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
357 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${STRICT_COUNT}/${x}.patch)
358 else
359 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch)
360 fi
317 fi 361 fi
318 done
319
320 #so now everything is unpacked, lets work out whats to be dropped and whats to be included.
321 for i in ${UNIPATCH_LIST}
322 do
323 extention=${i/*./}
324 PIPE_CMD=""
325 case ${extention} in
326 bz2) PIPE_CMD="bzip2 -dc";;
327 patch) PIPE_CMD="cat";;
328 diff) PIPE_CMD="cat";;
329 gz|Z|z) PIPE_CMD="gzip -dc";;
330 ZIP|zip) PIPE_CMD="unzip -p";;
331 *) UNIPATCH_EXCLUDE="${UNIPATCH_EXCLUDE} ${i}";;
332 esac
333 x=${i/*\//}
334 x=${x/\.${extention}/}
335 [ -n "${PIPE_CMD}" ] && ${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch
336 done 362 done
337 363
338 #populate KPATCH_DIRS so we know where to look to remove the excludes 364 #populate KPATCH_DIRS so we know where to look to remove the excludes
339 x=${KPATCH_DIR} 365 x=${KPATCH_DIR}
340 KPATCH_DIR="" 366 KPATCH_DIR=""
341 for i in $(find ${x} -type d) 367 for i in $(find ${x} -type d | sort -n)
342 do 368 do
343 KPATCH_DIR="${KPATCH_DIR} ${i}" 369 KPATCH_DIR="${KPATCH_DIR} ${i}"
344 done 370 done
345 371
346 #so now lets get rid of the patchno's we want to exclude 372 #so now lets get rid of the patchno's we want to exclude
373 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
347 for i in ${UNIPATCH_EXCLUDE} 374 for i in ${UNIPATCH_DROP}
348 do 375 do
349 for x in ${KPATCH_DIR} 376 for x in ${KPATCH_DIR}
350 do 377 do
351 rm ${x}/${i}_* 2>/dev/null 378 rm ${x}/${i}* 2>/dev/null
352 if [ $? == 0 ] 379 if [ $? == 0 ]
353 then 380 then
354 einfo "Excluding Patch #${i}" 381 einfo "Excluding Patch #${i}"
355 einfo "From: ${x/${WORKDIR}/}" 382 einfo "From: ${x/${WORKDIR}/}"
356 fi 383 fi
358 done 385 done
359 386
360 # and now, finally, we patch it :) 387 # and now, finally, we patch it :)
361 for x in ${KPATCH_DIR} 388 for x in ${KPATCH_DIR}
362 do 389 do
363 for i in $(find ${x} -maxdepth 1 -iname "*.patch" -or -iname "*.diff" | sort -u) 390 for i in $(find ${x} -maxdepth 1 -iname "*.patch" -or -iname "*.diff" | sort -n)
364 do 391 do
365 392 STDERR_T="${T}/${i/*\//}"
366 393 STDERR_T="${STDERR_T/.patch/.err}"
394
367 PATCH_DEPTH=0 395 PATCH_DEPTH=0
368 ebegin "Applying ${i/*\//}" 396 ebegin "Applying ${i/*\//}"
369 while [ ${PATCH_DEPTH} -lt 5 ] 397 while [ ${PATCH_DEPTH} -lt 5 ]
370 do 398 do
371 if (patch -p${PATCH_DEPTH} --dry-run -f < ${i} >/dev/null) 399 echo "Attempting Dry-run:" > ${STDERR_T}
400 echo "cmd: patch -p${PATCH_DEPTH} --dry-run -f < ${i}" >> ${STDERR_T}
401 echo "=======================================================" >> ${STDERR_T}
402 if [ $(patch -p${PATCH_DEPTH} --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ]
372 then 403 then
373 $(patch -p${PATCH_DEPTH} -f < ${i} >/dev/null) 404 echo "Attempting patch:" > ${STDERR_T}
374 if [ "$?" -eq 0 ] 405 echo "cmd: patch -p${PATCH_DEPTH} -f < ${i}" >> ${STDERR_T}
406 echo "=======================================================" >> ${STDERR_T}
407 if [ $(patch -p${PATCH_DEPTH} -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ]
375 then 408 then
376 eend 0 409 eend 0
410 rm ${STDERR_T}
377 break 411 break
378 else 412 else
379 eend 1 413 eend 1
380 eerror "Failed to apply patch ${i/*\//}" 414 eerror "Failed to apply patch ${i/*\//}"
415 eerror "Please attach ${STDERR_T} to any bug you may post."
381 die "Failed to apply ${i/*\//}" 416 die "Failed to apply ${i/*\//}"
382 fi 417 fi
383 else 418 else
384 PATCH_DEPTH=$((${PATCH_DEPTH} + 1)) 419 PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
385 fi 420 fi
386 done 421 done
387 if [ ${PATCH_DEPTH} -eq 5 ] 422 if [ ${PATCH_DEPTH} -eq 5 ]
388 then 423 then
389 eend 1 424 eend 1
425 eerror "Please attach ${STDERR_T} to any bug you may post."
390 die "Unable to dry-run patch." 426 die "Unable to dry-run patch."
391 fi 427 fi
392
393
394 done 428 done
395 done 429 done
396} 430}
397 431
398# custom functions 432# custom functions
423 457
424 EXTRAVERSION="${RELEASE}" 458 EXTRAVERSION="${RELEASE}"
425 459
426 if [ -n "${K_PREPATCHED}" ] 460 if [ -n "${K_PREPATCHED}" ]
427 then 461 then
428 KV="${OKV}-${PN/-*/}${PR/r/}" 462 EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}${PR/r/}"
429 else 463 else
430 [ -z "${K_NOUSENAME}" ] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}" 464 [ -z "${K_NOUSENAME}" ] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}"
431 [ ! "${PR}" == "r0" ] && EXTRAVERSION="${EXTRAVERSION}-${PR}" 465 [ "${PR}" != "r0" ] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
432 466 fi
467
433 KV=${OKV}${EXTRAVERSION} 468 KV=${OKV}${EXTRAVERSION}
434 fi
435 469
436 # -rcXX-bkXX pulls are *IMPOSSIBLE* to support within the portage naming convention 470 # -rcXX-bkXX pulls are *IMPOSSIBLE* to support within the portage naming convention
437 # these cannot be supported, but the code here can handle it up until this point 471 # these cannot be supported, but the code here can handle it up until this point
438 # and theoretically thereafter. 472 # and theoretically thereafter.
439 473
440 if [ "${RELEASETYPE}" == "-rc" ] 474 if [ "${RELEASETYPE}" == "-rc" ]
441 then 475 then
442 OKV="${KV_MAJOR}.${KV_MINOR}.$([ $((${KV_PATCH} - 1)) -lt 0 ] && echo ${KV_PATCH} || echo $((${KV_PATCH} - 1)))" 476 OKV="${KV_MAJOR}.${KV_MINOR}.$([ $((${KV_PATCH} - 1)) -lt 0 ] && echo ${KV_PATCH} || echo $((${KV_PATCH} - 1)))"
443 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/patch-${PV//_/-}.bz2 477 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/patch-${PV//_/-}.bz2
444 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2" 478 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
445 UNIPATCH_LIST="${DISTDIR}/patch-${PV//_/-}.bz2 ${UNIPATCH_LIST}" 479 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${PV//_/-}.bz2"
446 [ -n "${K_PREPATCHED}" ] && KV="${PV/[-_]*/}${EXTRAVERSION}-${PN/-*/}${PR/r/}" || KV=${PV/[-_]*/}${EXTRAVERSION} 480 KV=${PV/[-_]*/}${EXTRAVERSION}
447 fi 481 fi
448 482
449 if [ "${RELEASETYPE}" == "-bk" ] 483 if [ "${RELEASETYPE}" == "-bk" ]
450 then 484 then
451 OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" 485 OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
452 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2 486 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
453 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2" 487 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
454 UNIPATCH_LIST="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2 ${UNIPATCH_LIST}" 488 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
455 [ -n "${K_PREPATCHED}" ] && KV="${PV/[-_]*/}${EXTRAVERSION}-${PN/-*/}${PR/r/}" || KV=${PV/[-_]*/}${EXTRAVERSION} 489 KV=${PV/[-_]*/}${EXTRAVERSION}
456 fi 490 fi
457 491
458 if [ "${RELEASETYPE}" == "-rc-bk" ] 492 if [ "${RELEASETYPE}" == "-rc-bk" ]
459 then 493 then
460 OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))-${RELEASE/-bk*}" 494 OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))-${RELEASE/-bk*}"
461 EXTRAVERSION="$([ -n "${RELEASE}" ] && echo ${RELEASE/*-bk/-bk})$([ -n "${K_USENAME}" ] && echo -${PN/-*/})$([ ! "${PR}" == "r0" ] && echo -${PR})" 495 EXTRAVERSION="$([ -n "${RELEASE}" ] && echo ${RELEASE/*-bk/-bk})$([ -n "${K_USENAME}" ] && echo -${PN/-*/})$([ ! "${PR}" == "r0" ] && echo -${PR})"
462 496
463 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2 497 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
464 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2" 498 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
465 UNIPATCH_LIST="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2 ${UNIPATCH_LIST}" 499 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
466 [ -n "${K_PREPATCHED}" ] && KV="${PV/[-_]*/}${EXTRAVERSION}-${PN/-*/}${PR/r/}" || KV=${PV/[-_]*/}${EXTRAVERSION} 500 KV=${PV/[-_]*/}${EXTRAVERSION}
467 fi 501 fi
468 502
469 S=${WORKDIR}/linux-${KV} 503 S=${WORKDIR}/linux-${KV}
504}
505
506
507detect_arch() {
508 # This function sets ARCH_URI and ARCH_PATCH
509 # with the neccessary info for the arch sepecific compatibility
510 # patchsets.
511
512 local LOCAL_ARCH
513 local COMPAT_URI
514
515 LOCAL_ARCH="$(echo ${ARCH} | tr [a-z] [A-Z])"
516 COMPAT_URI="${LOCAL_ARCH}_URI"
517
518 ARCH_URI="${!COMPAT_URI}"
519 ARCH_PATCH="${DISTDIR}/${ARCH_URI/*\//}"
470} 520}
471 521
472 522
473# common functions 523# common functions
474#============================================================== 524#==============================================================
482 mv linux-${OKV} linux-${KV} || die "Unable to move source tree to ${KV}." 532 mv linux-${OKV} linux-${KV} || die "Unable to move source tree to ${KV}."
483 fi 533 fi
484 cd ${S} 534 cd ${S}
485 535
486 universal_unpack 536 universal_unpack
487 [ -n "${UNIPATCH_LIST}" ] && unipatch ${UNIPATCH_LIST} 537 [ -n "${UNIPATCH_LIST}" -o -n "${UNIPATCH_LIST_DEFAULT}" ] && unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST}"
488 [ -z "${K_NOSETEXTRAVERSION}" ] && unpack_set_extraversion 538 [ -z "${K_NOSETEXTRAVERSION}" ] && unpack_set_extraversion
489
490 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4 539 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4
491} 540}
492 541
493src_compile() { 542src_compile() {
494 [ "${ETYPE}" == "headers" ] && compile_headers 543 [ "${ETYPE}" == "headers" ] && compile_headers
509 [ "${ETYPE}" == "sources" ] && postinst_sources 558 [ "${ETYPE}" == "sources" ] && postinst_sources
510} 559}
511 560
512pkg_setup() { 561pkg_setup() {
513 [ "${ETYPE}" == "headers" ] && setup_headers 562 [ "${ETYPE}" == "headers" ] && setup_headers
563
564 # this is to fix some weird portage bug? in stable versions of portage.
565 [ "${ETYPE}" == "sources" ] && echo ">>> Preparing to unpack..."
514} 566}

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.20