/[gentoo-x86]/eclass/eutils.eclass
Gentoo

Diff of /eclass/eutils.eclass

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

Revision 1.359 Revision 1.363
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 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/eutils.eclass,v 1.359 2011/07/20 05:46:46 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.363 2011/09/12 20:44:01 mgorny Exp $
4 4
5# @ECLASS: eutils.eclass 5# @ECLASS: eutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: many extra (but common) functions that are used in ebuilds 8# @BLURB: many extra (but common) functions that are used in ebuilds
64fi 64fi
65 65
66# @FUNCTION: eqawarn 66# @FUNCTION: eqawarn
67# @USAGE: [message] 67# @USAGE: [message]
68# @DESCRIPTION: 68# @DESCRIPTION:
69# Proxy to einfo for package managers that don't provide eqawarn and use the PM 69# Proxy to ewarn for package managers that don't provide eqawarn and use the PM
70# implementation if available. 70# implementation if available. Reuses PORTAGE_ELOG_CLASSES as set by the dev
71# profile.
71if ! declare -F eqawarn >/dev/null ; then 72if ! declare -F eqawarn >/dev/null ; then
72 eqawarn() { 73 eqawarn() {
73 einfo "$@" 74 has qa ${PORTAGE_ELOG_CLASSES} && ewarn "$@"
74 } 75 }
75fi 76fi
76 77
77# @FUNCTION: ecvs_clean 78# @FUNCTION: ecvs_clean
78# @USAGE: [list of dirs] 79# @USAGE: [list of dirs]
380 _epatch_draw_line "***** ${patchname} *****" 381 _epatch_draw_line "***** ${patchname} *****"
381 echo 382 echo
382 echo "PATCH COMMAND: patch -p${count} ${EPATCH_OPTS} < '${PATCH_TARGET}'" 383 echo "PATCH COMMAND: patch -p${count} ${EPATCH_OPTS} < '${PATCH_TARGET}'"
383 echo 384 echo
384 _epatch_draw_line "***** ${patchname} *****" 385 _epatch_draw_line "***** ${patchname} *****"
386 patch -p${count} ${EPATCH_OPTS} --dry-run -f < "${PATCH_TARGET}" 2>&1
387 ret=$?
388 echo
389 echo "patch program exited with status ${ret}"
390 exit ${ret}
385 ) >> "${STDERR_TARGET}" 391 ) >> "${STDERR_TARGET}"
386 392
387 if (patch -p${count} ${EPATCH_OPTS} --dry-run -f < "${PATCH_TARGET}") >> "${STDERR_TARGET}" 2>&1 ; then 393 if [ $? -eq 0 ] ; then
388 ( 394 (
389 _epatch_draw_line "***** ${patchname} *****" 395 _epatch_draw_line "***** ${patchname} *****"
390 echo 396 echo
391 echo "ACTUALLY APPLYING ${patchname} ..." 397 echo "ACTUALLY APPLYING ${patchname} ..."
392 echo 398 echo
393 _epatch_draw_line "***** ${patchname} *****" 399 _epatch_draw_line "***** ${patchname} *****"
394 patch -p${count} ${EPATCH_OPTS} < "${PATCH_TARGET}" 2>&1 400 patch -p${count} ${EPATCH_OPTS} < "${PATCH_TARGET}" 2>&1
401 ret=$?
402 echo
403 echo "patch program exited with status ${ret}"
404 exit ${ret}
395 ) >> "${STDERR_TARGET}" 405 ) >> "${STDERR_TARGET}"
396 406
397 if [ $? -ne 0 ] ; then 407 if [ $? -ne 0 ] ; then
398 echo 408 echo
399 eerror "A dry-run of patch command succeeded, but actually" 409 eerror "A dry-run of patch command succeeded, but actually"
430 done 440 done
431 441
432 [[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching" 442 [[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching"
433 : # everything worked 443 : # everything worked
434} 444}
445
446# @FUNCTION: epatch_user
447# @USAGE:
448# @DESCRIPTION:
449# Applies user-provided patches to the source tree. The patches are
450# taken from /etc/portage/patches/<CATEGORY>/<PF|P|PN>/, where the first
451# of these three directories to exist will be the one to use, ignoring
452# any more general directories which might exist as well.
453#
454# User patches are intended for quick testing of patches without ebuild
455# modifications, as well as for permanent customizations a user might
456# desire. Obviously, there can be no official support for arbitrarily
457# patched ebuilds. So whenever a build log in a bug report mentions that
458# user patches were applied, the user should be asked to reproduce the
459# problem without these.
460#
461# Not all ebuilds do call this function, so placing patches in the
462# stated directory might or might not work, depending on the package and
463# the eclasses it inherits and uses. It is safe to call the function
464# repeatedly, so it is always possible to add a call at the ebuild
465# level. The first call is the time when the patches will be
466# applied.
467#
468# Ideally, this function should be called after gentoo-specific patches
469# have been applied, so that their code can be modified as well, but
470# before calls to e.g. eautoreconf, as the user patches might affect
471# autotool input files as well.
435epatch_user() { 472epatch_user() {
436 [[ $# -ne 0 ]] && die "epatch_user takes no options" 473 [[ $# -ne 0 ]] && die "epatch_user takes no options"
474
475 # Allow multiple calls to this function; ignore all but the first
476 local applied="${T}/epatch_user.applied"
477 [[ -e ${applied} ]] && return 2
437 478
438 # don't clobber any EPATCH vars that the parent might want 479 # don't clobber any EPATCH vars that the parent might want
439 local EPATCH_SOURCE check base=${PORTAGE_CONFIGROOT%/}/etc/portage/patches 480 local EPATCH_SOURCE check base=${PORTAGE_CONFIGROOT%/}/etc/portage/patches
440 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do 481 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do
441 EPATCH_SOURCE=${base}/${CTARGET}/${check} 482 EPATCH_SOURCE=${base}/${CTARGET}/${check}
445 EPATCH_SOURCE=${EPATCH_SOURCE} \ 486 EPATCH_SOURCE=${EPATCH_SOURCE} \
446 EPATCH_SUFFIX="patch" \ 487 EPATCH_SUFFIX="patch" \
447 EPATCH_FORCE="yes" \ 488 EPATCH_FORCE="yes" \
448 EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \ 489 EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \
449 epatch 490 epatch
491 echo "${EPATCH_SOURCE}" > "${applied}"
450 return 0 492 return 0
451 fi 493 fi
452 done 494 done
495 echo "none" > "${applied}"
453 return 1 496 return 1
454} 497}
455 498
456# @FUNCTION: emktemp 499# @FUNCTION: emktemp
457# @USAGE: [temp dir] 500# @USAGE: [temp dir]

Legend:
Removed from v.1.359  
changed lines
  Added in v.1.363

  ViewVC Help
Powered by ViewVC 1.1.20