| 1 | # Copyright 1999-2008 Gentoo Foundation |
1 | # Copyright 1999-2008 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/base.eclass,v 1.43 2010/01/13 01:58:53 patrick Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.48 2010/01/24 13:43:26 scarabeus Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: base.eclass |
5 | # @ECLASS: base.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # QA Team <qa@gentoo.org> |
7 | # QA Team <qa@gentoo.org> |
| 8 | # |
8 | # |
| … | |
… | |
| 14 | |
14 | |
| 15 | inherit eutils |
15 | inherit eutils |
| 16 | |
16 | |
| 17 | BASE_EXPF="src_unpack src_compile src_install" |
17 | BASE_EXPF="src_unpack src_compile src_install" |
| 18 | case "${EAPI:-0}" in |
18 | case "${EAPI:-0}" in |
| 19 | 2|3|4) BASE_EXPF="${BASE_EXPF} src_prepare src_configure" ;; |
19 | 2|3|4) BASE_EXPF+=" src_prepare src_configure" ;; |
| 20 | *) ;; |
20 | *) ;; |
| 21 | esac |
21 | esac |
| 22 | |
22 | |
| 23 | EXPORT_FUNCTIONS ${BASE_EXPF} |
23 | EXPORT_FUNCTIONS ${BASE_EXPF} |
| 24 | |
24 | |
| … | |
… | |
| 68 | # EAPI is greater or equal to 2. |
68 | # EAPI is greater or equal to 2. |
| 69 | base_src_prepare() { |
69 | base_src_prepare() { |
| 70 | debug-print-function $FUNCNAME "$@" |
70 | debug-print-function $FUNCNAME "$@" |
| 71 | debug-print "$FUNCNAME: PATCHES=$PATCHES" |
71 | debug-print "$FUNCNAME: PATCHES=$PATCHES" |
| 72 | |
72 | |
|
|
73 | local patches_failed=0 |
|
|
74 | |
| 73 | pushd "${S}" > /dev/null |
75 | pushd "${S}" > /dev/null |
| 74 | if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then |
76 | if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then |
| 75 | for x in "${PATCHES[@]}"; do |
77 | for x in "${PATCHES[@]}"; do |
| 76 | debug-print "$FUNCNAME: applying patch from ${x}" |
78 | debug-print "$FUNCNAME: applying patch from ${x}" |
| 77 | [[ -f "${x}" ]] && epatch "${x}" |
|
|
| 78 | if [[ -d "${x}" ]]; then |
79 | if [[ -d "${x}" ]]; then |
| 79 | # Use standardized names and locations with bulk patching |
80 | # Use standardized names and locations with bulk patching |
| 80 | # Patch directory is ${WORKDIR}/patch |
81 | # Patch directory is ${WORKDIR}/patch |
| 81 | # See epatch() in eutils.eclass for more documentation |
82 | # See epatch() in eutils.eclass for more documentation |
| 82 | EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} |
83 | EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} |
| … | |
… | |
| 86 | # variable and restore later |
87 | # variable and restore later |
| 87 | oldval=${EPATCH_SOURCE} |
88 | oldval=${EPATCH_SOURCE} |
| 88 | EPATCH_SOURCE=${x} |
89 | EPATCH_SOURCE=${x} |
| 89 | epatch |
90 | epatch |
| 90 | EPATCH_SOURCE=${oldval} |
91 | EPATCH_SOURCE=${oldval} |
|
|
92 | elif [[ -f "${x}" ]]; then |
|
|
93 | epatch "${x}" |
|
|
94 | else |
|
|
95 | ewarn "QA: File or directory \"${x}\" does not exist." |
|
|
96 | ewarn "QA: Check your PATCHES array or add missing file/directory." |
|
|
97 | patches_failed=1 |
| 91 | fi |
98 | fi |
| 92 | done |
99 | done |
|
|
100 | [[ ${patches_failed} -eq 1 ]] && die "Some patches failed. See above messages." |
| 93 | else |
101 | else |
| 94 | for x in ${PATCHES}; do |
102 | for x in ${PATCHES}; do |
| 95 | debug-print "$FUNCNAME: patching from ${x}" |
103 | debug-print "$FUNCNAME: patching from ${x}" |
| 96 | epatch "${x}" |
104 | epatch "${x}" |
| 97 | done |
105 | done |