/[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.40 Revision 1.41
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.40 2004/07/11 20:38:24 spock Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.41 2004/08/22 11:38:02 johnm Exp $
4 4
5# 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
6# with back-compatibility for 2.4 6# with back-compatibility for 2.4
7# 7#
8# Author: John Mylchreest <johnm@gentoo.org> 8# Author: John Mylchreest <johnm@gentoo.org>
130 if [ "${OKV}" != "${KV}" ] 130 if [ "${OKV}" != "${KV}" ]
131 then 131 then
132 mv linux-${OKV} linux-${KV} || die "Unable to move source tree to ${KV}." 132 mv linux-${OKV} linux-${KV} || die "Unable to move source tree to ${KV}."
133 fi 133 fi
134 cd ${S} 134 cd ${S}
135
136 # change incorrect install path
137 mv Makefile Makefile.orig
138 sed -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' \
139 Makefile.orig > Makefile
140 rm Makefile.orig
135 141
136 # remove all backup files 142 # remove all backup files
137 find . -iname "*~" -exec rm {} \; 2> /dev/null 143 find . -iname "*~" -exec rm {} \; 2> /dev/null
138 144
139 if [ -d "${S}/Documentation/DocBook" ] 145 if [ -d "${S}/Documentation/DocBook" ]
147 153
148unpack_set_extraversion() { 154unpack_set_extraversion() {
149 # Gentoo Linux uses /boot, so fix 'make install' to work properly and fix EXTRAVERSION 155 # Gentoo Linux uses /boot, so fix 'make install' to work properly and fix EXTRAVERSION
150 cd ${S} 156 cd ${S}
151 mv Makefile Makefile.orig 157 mv Makefile Makefile.orig
152 sed -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' \
153 -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" \ 158 sed -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" \
154 Makefile.orig > Makefile 159 Makefile.orig > Makefile
155 rm Makefile.orig 160 rm Makefile.orig
156} 161}
157 162
158# Compile Functions 163# Compile Functions
366 local UNIPATCH_DROP 371 local UNIPATCH_DROP
367 local KPATCH_DIR 372 local KPATCH_DIR
368 local PATCH_DEPTH 373 local PATCH_DEPTH
369 local ELINE 374 local ELINE
370 local STRICT_COUNT 375 local STRICT_COUNT
376 local PATCH_LEVEL
371 377
372 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/" 378 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
373 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR} 379 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
380
381 # We're gonna need it when doing patches with a predefined patchlevel
382 shopt -s extglob
374 383
375 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers 384 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers
376 # usage can be either via an env var or by params 385 # usage can be either via an env var or by params
377 # although due to the nature we pass this within this eclass 386 # although due to the nature we pass this within this eclass
378 # it shall be by param only. 387 # it shall be by param only.
383 for i in ${UNIPATCH_LIST} 392 for i in ${UNIPATCH_LIST}
384 do 393 do
385 if [ -n "$(echo ${i} | grep -e "\.tar" -e "\.tbz" -e "\.tgz")" ] 394 if [ -n "$(echo ${i} | grep -e "\.tar" -e "\.tbz" -e "\.tgz")" ]
386 then 395 then
387 extention=${i/*./} 396 extention=${i/*./}
397 extention=${extention/:*/}
388 case ${extention} in 398 case ${extention} in
389 tbz2) PIPE_CMD="tar -xvjf";; 399 tbz2) PIPE_CMD="tar -xvjf";;
390 bz2) PIPE_CMD="tar -xvjf";; 400 bz2) PIPE_CMD="tar -xvjf";;
391 tgz) PIPE_CMD="tar -xvzf";; 401 tgz) PIPE_CMD="tar -xvzf";;
392 gz) PIPE_CMD="tar -xvzf";; 402 gz) PIPE_CMD="tar -xvzf";;
396 406
397 if [ -n "${UNIPATCH_STRICTORDER}" ] 407 if [ -n "${UNIPATCH_STRICTORDER}" ]
398 then 408 then
399 STRICT_COUNT=$((${STRICT_COUNT} + 1)) 409 STRICT_COUNT=$((${STRICT_COUNT} + 1))
400 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/ 410 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
401 ${PIPE_CMD} ${i} -C ${KPATCH_DIR}/${STRICT_COUNT}/ 1>/dev/null 411 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR}/${STRICT_COUNT}/ 1>/dev/null
402 else 412 else
403 ${PIPE_CMD} ${i} -C ${KPATCH_DIR} 1>/dev/null 413 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR} 1>/dev/null
404 fi 414 fi
405 415
406 if [ $? == 0 ] 416 if [ $? == 0 ]
407 then 417 then
408 einfo "${i/*\//} unpacked" 418 einfo "${i/*\//} unpacked"
419 [ -n "$(echo ${i} | grep ':')" ] && echo ">>> Strict patch levels not currently supported for tarballed patchsets"
409 else 420 else
410 eerror "Failed to unpack ${i}" 421 eerror "Failed to unpack ${i/:*/}"
411 die "unable to unpack patch tarball" 422 die "unable to unpack patch tarball"
412 fi 423 fi
413 else 424 else
414 extention=${i/*./} 425 extention=${i/*./}
426 extention=${extention/:*/}
415 PIPE_CMD="" 427 PIPE_CMD=""
416 case ${extention} in 428 case ${extention} in
417 bz2) PIPE_CMD="bzip2 -dc";; 429 bz2) PIPE_CMD="bzip2 -dc";;
418 patch) PIPE_CMD="cat";; 430 patch) PIPE_CMD="cat";;
419 diff) PIPE_CMD="cat";; 431 diff) PIPE_CMD="cat";;
420 gz|Z|z) PIPE_CMD="gzip -dc";; 432 gz|Z|z) PIPE_CMD="gzip -dc";;
421 ZIP|zip) PIPE_CMD="unzip -p";; 433 ZIP|zip) PIPE_CMD="unzip -p";;
422 *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i}";; 434 *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i/:*/}";;
423 esac 435 esac
436
437 PATCH_LEVEL=${i/*([^:])?(:)}
438 i=${i/:*/}
424 x=${i/*\//} 439 x=${i/*\//}
425 x=${x/\.${extention}/} 440 x=${x/\.${extention}/}
426 441
427 if [ -n "${PIPE_CMD}" ] 442 if [ -n "${PIPE_CMD}" ]
428 then 443 then
438 453
439 if [ -n "${UNIPATCH_STRICTORDER}" ] 454 if [ -n "${UNIPATCH_STRICTORDER}" ]
440 then 455 then
441 STRICT_COUNT=$((${STRICT_COUNT} + 1)) 456 STRICT_COUNT=$((${STRICT_COUNT} + 1))
442 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/ 457 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
443 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${STRICT_COUNT}/${x}.patch) 458 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${STRICT_COUNT}/${x}.patch${PATCH_LEVEL})
444 else 459 else
445 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch) 460 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL})
446 fi 461 fi
447 fi 462 fi
448 fi 463 fi
449 done 464 done
450 465
472 done 487 done
473 488
474 # and now, finally, we patch it :) 489 # and now, finally, we patch it :)
475 for x in ${KPATCH_DIR} 490 for x in ${KPATCH_DIR}
476 do 491 do
477 for i in $(find ${x} -maxdepth 1 -iname "*.patch" -or -iname "*.diff" | sort -n) 492 for i in $(find ${x} -maxdepth 1 -iregex ".*\.patch[0-9]*" -or -iname "*.diff" | sort -n)
478 do 493 do
479 STDERR_T="${T}/${i/*\//}" 494 STDERR_T="${T}/${i/*\//}"
480 STDERR_T="${STDERR_T/.patch/.err}" 495 STDERR_T="${STDERR_T/.patch*/.err}"
481 496
497 PATCH_DEPTH=${i/*.patch/}
498
499 if [ -z "${PATCH_DEPTH}" ]; then
482 PATCH_DEPTH=0 500 PATCH_DEPTH=0
501 fi
502
483 ebegin "Applying ${i/*\//}" 503 ebegin "Applying ${i/*\//} (-p${PATCH_DEPTH}+)"
484 while [ ${PATCH_DEPTH} -lt 5 ] 504 while [ ${PATCH_DEPTH} -lt 5 ]
485 do 505 do
486 echo "Attempting Dry-run:" >> ${STDERR_T} 506 echo "Attempting Dry-run:" >> ${STDERR_T}
487 echo "cmd: patch -p${PATCH_DEPTH} --dry-run -f < ${i}" >> ${STDERR_T} 507 echo "cmd: patch -p${PATCH_DEPTH} --dry-run -f < ${i}" >> ${STDERR_T}
488 echo "=======================================================" >> ${STDERR_T} 508 echo "=======================================================" >> ${STDERR_T}

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41

  ViewVC Help
Powered by ViewVC 1.1.20