2 # Copyright 1999-2013 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
5 PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"
6 PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}"
8 # Prevent aliases from causing portage to act inappropriately.
9 # Make sure it's before everything so we don't mess aliases that follow.
12 source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit 1
14 if [[ $EBUILD_PHASE != depend ]] ; then
15 source "${PORTAGE_BIN_PATH}/phase-functions.sh" || die
16 source "${PORTAGE_BIN_PATH}/save-ebuild-env.sh" || die
17 source "${PORTAGE_BIN_PATH}/phase-helpers.sh" || die
18 source "${PORTAGE_BIN_PATH}/bashrc-functions.sh" || die
20 # These dummy functions are for things that are likely to be called
21 # in global scope, even though they are completely useless during
23 for x in diropts docompress exeopts get_KV insopts \
24 keepdir KV_major KV_micro KV_minor KV_to_int \
25 libopts register_die_hook register_success_hook \
26 __strip_duplicate_slashes \
27 use_with use_enable ; do
29 if ___eapi_disallows_helpers_in_global_scope; then
30 die \"\${FUNCNAME}() calls are not allowed in global scope\"
34 # These dummy functions return false in non-strict EAPIs, in order to ensure that
35 # `use multislot` is false for the "depend" phase.
37 ___eapi_has_usex && funcs+=" usex"
38 for x in ${funcs} ; do
40 if ___eapi_disallows_helpers_in_global_scope; then
41 die \"\${FUNCNAME}() calls are not allowed in global scope\"
47 # These functions die because calls to them during the "depend" phase
48 # are considered to be severe QA violations.
49 funcs="best_version has_version portageq"
50 ___eapi_has_master_repositories && funcs+=" master_repositories"
51 ___eapi_has_repository_path && funcs+=" repository_path"
52 ___eapi_has_available_eclasses && funcs+=" available_eclasses"
53 ___eapi_has_eclass_path && funcs+=" eclass_path"
54 ___eapi_has_license_path && funcs+=" license_path"
55 for x in ${funcs} ; do
56 eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in global scope\"; }"
61 # Don't use sandbox's BASH_ENV for new shells because it does
62 # 'source /etc/profile' which can interfere with the build
63 # environment by modifying our PATH.
66 # This is just a temporary workaround for portage-9999 users since
67 # earlier portage versions do not detect a version change in this case
68 # (9999 to 9999) and therefore they try execute an incompatible version of
69 # ebuild.sh during the upgrade.
70 export PORTAGE_BZIP2_COMMAND=${PORTAGE_BZIP2_COMMAND:-bzip2}
72 # These two functions wrap sourcing and calling respectively. At present they
73 # perform a qa check to make sure eclasses and ebuilds and profiles don't mess
74 # with shell opts (shopts). Ebuilds/eclasses changing shopts should reset them
78 local shopts=$(shopt) OLDIFS="$IFS"
83 [[ $shopts != $(shopt) ]] &&
84 eqawarn "QA Notice: Global shell options changed and were not restored while sourcing '$*'"
85 [[ "$IFS" != "$OLDIFS" ]] &&
86 eqawarn "QA Notice: Global IFS changed and was not restored while sourcing '$*'"
91 local shopts=$(shopt) OLDIFS="$IFS"
96 [[ $shopts != $(shopt) ]] &&
97 eqawarn "QA Notice: Global shell options changed and were not restored while calling '$*'"
98 [[ "$IFS" != "$OLDIFS" ]] &&
99 eqawarn "QA Notice: Global IFS changed and was not restored while calling '$*'"
107 # Unset some variables that break things.
108 unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
110 [[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET
112 # sandbox support functions; defined prior to profile.bashrc srcing, since the profile might need to add a default exception (/usr/lib64/conftest fex)
115 local var="SANDBOX_${_v}"
116 [[ -z $1 || -n $2 ]] && die "Usage: add$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${_v}") <colon-delimited list of paths>"
117 export ${var}="${!var:+${!var}:}$1"
120 # local var="SANDBOX_${1^^}"
121 # addread() { __sb_append_var ${0#add} "$@" ; }
122 addread() { __sb_append_var READ "$@" ; }
123 addwrite() { __sb_append_var WRITE "$@" ; }
124 adddeny() { __sb_append_var DENY "$@" ; }
125 addpredict() { __sb_append_var PREDICT "$@" ; }
127 addwrite "${PORTAGE_TMPDIR}"
128 addread "/:${PORTAGE_TMPDIR}"
129 [[ -n ${PORTAGE_GPG_DIR} ]] && addpredict "${PORTAGE_GPG_DIR}"
131 # Avoid sandbox violations in temporary directories.
132 if [[ -w $T ]] ; then
136 elif [[ $SANDBOX_ON = 1 ]] ; then
137 for x in TEMP TMP TMPDIR ; do
138 [[ -n ${!x} ]] && addwrite "${!x}"
143 # the sandbox is disabled by default except when overridden in the relevant stages
146 # Ensure that $PWD is sane whenever possible, to protect against
147 # exploitation of insecure search path for python -c in ebuilds.
149 if ! has "$EBUILD_PHASE" clean cleanrm depend help ; then
150 cd "$PORTAGE_BUILDDIR" || \
151 die "PORTAGE_BUILDDIR does not exist: '$PORTAGE_BUILDDIR'"
154 #if no perms are specified, dirs/files will have decent defaults
155 #(not secretive, but not stupid)
158 # debug-print() gets called from many places with verbose status information useful
159 # for tracking down problems. The output is in $T/eclass-debug.log.
160 # You can set ECLASS_DEBUG_OUTPUT to redirect the output somewhere else as well.
161 # The special "on" setting echoes the information, mixing it with the rest of the
163 # You can override the setting by exporting a new one from the console, or you can
164 # set a new default in make.*. Here the default is "" or unset.
166 # in the future might use e* from /etc/init.d/functions.sh if i feel like it
168 # if $T isn't defined, we're in dep calculation mode and
169 # shouldn't do anything
170 [[ $EBUILD_PHASE = depend || ! -d ${T} || ${#} -eq 0 ]] && return 0
172 if [[ ${ECLASS_DEBUG_OUTPUT} == on ]]; then
173 printf 'debug: %s\n' "${@}" >&2
174 elif [[ -n ${ECLASS_DEBUG_OUTPUT} ]]; then
175 printf 'debug: %s\n' "${@}" >> "${ECLASS_DEBUG_OUTPUT}"
178 if [[ -w $T ]] ; then
180 printf '%s\n' "${@}" >> "${T}/eclass-debug.log"
181 # let the portage user own/write to this file
182 chgrp "${PORTAGE_GRPNAME:-portage}" "${T}/eclass-debug.log"
183 chmod g+w "${T}/eclass-debug.log"
187 # The following 2 functions are debug-print() wrappers
189 debug-print-function() {
190 debug-print "${1}: entering function, parameters: ${*:2}"
193 debug-print-section() {
194 debug-print "now in section ${*}"
197 # Sources all eclasses in parameters
198 declare -ix ECLASS_DEPTH=0
200 ECLASS_DEPTH=$(($ECLASS_DEPTH + 1))
201 if [[ ${ECLASS_DEPTH} > 1 ]]; then
202 debug-print "*** Multiple Inheritence (Level: ${ECLASS_DEPTH})"
205 if [[ -n $ECLASS && -n ${!__export_funcs_var} ]] ; then
206 echo "QA Notice: EXPORT_FUNCTIONS is called before inherit in" \
207 "$ECLASS.eclass. For compatibility with <=portage-2.1.6.7," \
208 "only call EXPORT_FUNCTIONS after inherit(s)." \
209 | fmt -w 75 | while read -r ; do eqawarn "$REPLY" ; done
216 # These variables must be restored before returning.
217 local PECLASS=$ECLASS
218 local prev_export_funcs_var=$__export_funcs_var
227 location="${ECLASSDIR}/${1}.eclass"
231 __export_funcs_var=__export_functions_$ECLASS_DEPTH
232 unset $__export_funcs_var
234 if [ "${EBUILD_PHASE}" != "depend" ] && \
235 [ "${EBUILD_PHASE}" != "nofetch" ] && \
236 [[ ${EBUILD_PHASE} != *rm ]] && \
237 [[ ${EMERGE_FROM} != "binary" ]] ; then
238 # This is disabled in the *rm phases because they frequently give
239 # false alarms due to INHERITED in /var/db/pkg being outdated
240 # in comparison the the eclasses from the portage tree. It's
241 # disabled for nofetch, since that can be called by repoman and
242 # that triggers bug #407449 due to repoman not exporting
243 # non-essential variables such as INHERITED.
244 if ! has $ECLASS $INHERITED $__INHERITED_QA_CACHE ; then
245 eqawarn "QA Notice: ECLASS '$ECLASS' inherited illegally in $CATEGORY/$PF $EBUILD_PHASE"
249 # any future resolution code goes here
250 if [ -n "$PORTDIR_OVERLAY" ]; then
252 for overlay in ${PORTDIR_OVERLAY}; do
253 olocation="${overlay}/eclass/${1}.eclass"
254 if [ -e "$olocation" ]; then
255 location="${olocation}"
256 debug-print " eclass exists: ${location}"
260 debug-print "inherit: $1 -> $location"
261 [ ! -e "$location" ] && die "${1}.eclass could not be found by inherit()"
263 if [ "${location}" == "${olocation}" ] && \
264 ! has "${location}" ${EBUILD_OVERLAY_ECLASSES} ; then
265 EBUILD_OVERLAY_ECLASSES="${EBUILD_OVERLAY_ECLASSES} ${location}"
268 #We need to back up the values of *DEPEND to B_*DEPEND
269 #(if set).. and then restore them after the inherit call.
271 #turn off glob expansion
274 # Retain the old data and restore it later.
275 unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND B_HDEPEND
276 [ "${IUSE+set}" = set ] && B_IUSE="${IUSE}"
277 [ "${REQUIRED_USE+set}" = set ] && B_REQUIRED_USE="${REQUIRED_USE}"
278 [ "${DEPEND+set}" = set ] && B_DEPEND="${DEPEND}"
279 [ "${RDEPEND+set}" = set ] && B_RDEPEND="${RDEPEND}"
280 [ "${PDEPEND+set}" = set ] && B_PDEPEND="${PDEPEND}"
281 [ "${HDEPEND+set}" = set ] && B_HDEPEND="${HDEPEND}"
282 unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND HDEPEND
283 #turn on glob expansion
286 __qa_source "$location" || die "died sourcing $location in inherit()"
288 #turn off glob expansion
291 # If each var has a value, append it to the global variable E_* to
292 # be applied after everything is finished. New incremental behavior.
293 [ "${IUSE+set}" = set ] && E_IUSE+="${E_IUSE:+ }${IUSE}"
294 [ "${REQUIRED_USE+set}" = set ] && E_REQUIRED_USE+="${E_REQUIRED_USE:+ }${REQUIRED_USE}"
295 [ "${DEPEND+set}" = set ] && E_DEPEND+="${E_DEPEND:+ }${DEPEND}"
296 [ "${RDEPEND+set}" = set ] && E_RDEPEND+="${E_RDEPEND:+ }${RDEPEND}"
297 [ "${PDEPEND+set}" = set ] && E_PDEPEND+="${E_PDEPEND:+ }${PDEPEND}"
298 [ "${HDEPEND+set}" = set ] && E_HDEPEND+="${E_HDEPEND:+ }${HDEPEND}"
300 [ "${B_IUSE+set}" = set ] && IUSE="${B_IUSE}"
301 [ "${B_IUSE+set}" = set ] || unset IUSE
303 [ "${B_REQUIRED_USE+set}" = set ] && REQUIRED_USE="${B_REQUIRED_USE}"
304 [ "${B_REQUIRED_USE+set}" = set ] || unset REQUIRED_USE
306 [ "${B_DEPEND+set}" = set ] && DEPEND="${B_DEPEND}"
307 [ "${B_DEPEND+set}" = set ] || unset DEPEND
309 [ "${B_RDEPEND+set}" = set ] && RDEPEND="${B_RDEPEND}"
310 [ "${B_RDEPEND+set}" = set ] || unset RDEPEND
312 [ "${B_PDEPEND+set}" = set ] && PDEPEND="${B_PDEPEND}"
313 [ "${B_PDEPEND+set}" = set ] || unset PDEPEND
315 [ "${B_HDEPEND+set}" = set ] && HDEPEND="${B_HDEPEND}"
316 [ "${B_HDEPEND+set}" = set ] || unset HDEPEND
318 #turn on glob expansion
321 if [[ -n ${!__export_funcs_var} ]] ; then
322 for x in ${!__export_funcs_var} ; do
323 debug-print "EXPORT_FUNCTIONS: $x -> ${ECLASS}_$x"
324 declare -F "${ECLASS}_$x" >/dev/null || \
325 die "EXPORT_FUNCTIONS: ${ECLASS}_$x is not defined"
326 eval "$x() { ${ECLASS}_$x \"\$@\" ; }" > /dev/null
329 unset $__export_funcs_var
331 has $1 $INHERITED || export INHERITED="$INHERITED $1"
335 ((--ECLASS_DEPTH)) # Returns 1 when ECLASS_DEPTH reaches 0.
336 if (( ECLASS_DEPTH > 0 )) ; then
337 export ECLASS=$PECLASS
338 __export_funcs_var=$prev_export_funcs_var
340 unset ECLASS __export_funcs_var
345 # Exports stub functions that call the eclass's functions, thereby making them default.
346 # For example, if ECLASS="base" and you call "EXPORT_FUNCTIONS src_unpack", the following
347 # code will be eval'd:
348 # src_unpack() { base_src_unpack; }
350 if [ -z "$ECLASS" ]; then
351 die "EXPORT_FUNCTIONS without a defined ECLASS"
353 eval $__export_funcs_var+=\" $*\"
356 PORTAGE_BASHRCS_SOURCED=0
358 # @FUNCTION: __source_all_bashrcs
360 # Source a relevant bashrc files and perform other miscellaneous
361 # environment initialization when appropriate.
363 # If EAPI is set then define functions provided by the current EAPI:
365 # * default_* aliases for the current EAPI phase functions
366 # * A "default" function which is an alias for the default phase
367 # function for the current phase.
369 __source_all_bashrcs() {
370 [[ $PORTAGE_BASHRCS_SOURCED = 1 ]] && return 0
371 PORTAGE_BASHRCS_SOURCED=1
374 local OCC="${CC}" OCXX="${CXX}"
376 if [[ $EBUILD_PHASE != depend ]] ; then
377 # source the existing profile.bashrcs.
380 local path_array=($PROFILE_PATHS)
382 for x in "${path_array[@]}" ; do
383 [ -f "$x/profile.bashrc" ] && __qa_source "$x/profile.bashrc"
387 if [ -r "${PORTAGE_BASHRC}" ] ; then
388 if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then
389 source "${PORTAGE_BASHRC}"
392 source "${PORTAGE_BASHRC}"
397 if [[ $EBUILD_PHASE != depend ]] ; then
398 # The user's bashrc is the ONLY non-portage bit of code that can
399 # change shopts without a QA violation.
400 for x in "${PM_EBUILD_HOOK_DIR}"/${CATEGORY}/{${PN},${PN}:${SLOT%/*},${P},${PF}}; do
401 if [ -r "${x}" ]; then
402 # If $- contains x, then tracing has already been enabled
403 # elsewhere for some reason. We preserve it's state so as
405 if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then
416 [ ! -z "${OCC}" ] && export CC="${OCC}"
417 [ ! -z "${OCXX}" ] && export CXX="${OCXX}"
420 # === === === === === === === === === === === === === === === === === ===
421 # === === === === === functions end, main part begins === === === === ===
422 # === === === === === === === === === === === === === === === === === ===
424 export SANDBOX_ON="1"
425 export S=${WORKDIR}/${P}
427 # Turn of extended glob matching so that g++ doesn't get incorrectly matched.
430 if [[ ${EBUILD_PHASE} == depend ]] ; then
431 QA_INTERCEPTORS="awk bash cc egrep equery fgrep g++
432 gawk gcc grep javac java-config nawk perl
433 pkg-config python python-config sed"
434 elif [[ ${EBUILD_PHASE} == clean* ]] ; then
435 unset QA_INTERCEPTORS
437 QA_INTERCEPTORS="autoconf automake aclocal libtoolize"
439 # level the QA interceptors if we're in depend
440 if [[ -n ${QA_INTERCEPTORS} ]] ; then
441 for BIN in ${QA_INTERCEPTORS}; do
442 BIN_PATH=$(type -Pf ${BIN})
443 if [ "$?" != "0" ]; then
444 BODY="echo \"*** missing command: ${BIN}\" >&2; return 127"
446 BODY="${BIN_PATH} \"\$@\"; return \$?"
448 if [[ ${EBUILD_PHASE} == depend ]] ; then
450 if [ \$ECLASS_DEPTH -gt 0 ]; then
451 eqawarn \"QA Notice: '${BIN}' called in global scope: eclass \${ECLASS}\"
453 eqawarn \"QA Notice: '${BIN}' called in global scope: \${CATEGORY}/\${PF}\"
457 elif has ${BIN} autoconf automake aclocal libtoolize ; then
459 if ! has \${FUNCNAME[1]} eautoreconf eaclocal _elibtoolize \\
460 eautoheader eautoconf eautomake autotools_run_tool \\
461 autotools_check_macro autotools_get_subdirs \\
462 autotools_get_auxdir ; then
463 eqawarn \"QA Notice: '${BIN}' called by \${FUNCNAME[1]}: \${CATEGORY}/\${PF}\"
464 eqawarn \"Use autotools.eclass instead of calling '${BIN}' directly.\"
470 eqawarn \"QA Notice: '${BIN}' called by \${FUNCNAME[1]}: \${CATEGORY}/\${PF}\"
474 eval "$FUNC_SRC" || echo "error creating QA interceptor ${BIN}" >&2
476 unset BIN_PATH BIN BODY FUNC_SRC
479 # Subshell/helper die support (must export for the die helper).
480 export EBUILD_MASTER_PID=$BASHPID
481 trap 'exit 1' SIGTERM
483 if ! has "$EBUILD_PHASE" clean cleanrm depend && \
484 [ -f "${T}"/environment ] ; then
485 # The environment may have been extracted from environment.bz2 or
486 # may have come from another version of ebuild.sh or something.
487 # In any case, preprocess it to prevent any potential interference.
488 # NOTE: export ${FOO}=... requires quoting, unlike normal exports
489 __preprocess_ebuild_env || \
490 die "error processing environment"
491 # Colon separated SANDBOX_* variables need to be cumulative.
492 for x in SANDBOX_DENY SANDBOX_READ SANDBOX_PREDICT SANDBOX_WRITE ; do
493 export PORTAGE_${x}="${!x}"
495 PORTAGE_SANDBOX_ON=${SANDBOX_ON}
497 source "${T}"/environment || \
498 die "error sourcing environment"
499 # We have to temporarily disable sandbox since the
500 # SANDBOX_{DENY,READ,PREDICT,WRITE} values we've just loaded
501 # may be unusable (triggering in spurious sandbox violations)
502 # until we've merged them with our current values.
504 for x in SANDBOX_DENY SANDBOX_PREDICT SANDBOX_READ SANDBOX_WRITE ; do
506 if [ -z "${!x}" ] ; then
508 elif [ -n "${!y}" ] && [ "${!y}" != "${!x}" ] ; then
510 export ${x}="$(printf "${!y}:${!x}" | tr ":" "\0" | \
511 sort -z -u | tr "\0" ":")"
513 export ${x}="${!x%:}"
517 export SANDBOX_ON=${PORTAGE_SANDBOX_ON}
518 unset PORTAGE_SANDBOX_ON
519 [[ -n $EAPI ]] || EAPI=0
522 if ___eapi_enables_globstar; then
526 # Source the ebuild every time for FEATURES=noauto, so that ebuild
527 # modifications take effect immediately.
528 if ! has "$EBUILD_PHASE" clean cleanrm ; then
529 if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \
530 -f $PORTAGE_BUILDDIR/.ebuild_changed || \
531 " ${FEATURES} " == *" noauto "* ]] ; then
532 # The bashrcs get an opportunity here to set aliases that will be expanded
533 # during sourcing of ebuilds and eclasses.
536 # When EBUILD_PHASE != depend, INHERITED comes pre-initialized
537 # from cache. In order to make INHERITED content independent of
538 # EBUILD_PHASE during inherit() calls, we unset INHERITED after
539 # we make a backup copy for QA checks.
540 __INHERITED_QA_CACHE=$INHERITED
542 # *DEPEND and IUSE will be set during the sourcing of the ebuild.
543 # In order to ensure correct interaction between ebuilds and
544 # eclasses, they need to be unset before this process of
545 # interaction begins.
546 unset EAPI DEPEND RDEPEND PDEPEND HDEPEND INHERITED IUSE REQUIRED_USE \
547 ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND \
550 if [[ $PORTAGE_DEBUG != 1 || ${-/x/} != $- ]] ; then
551 source "$EBUILD" || die "error sourcing ebuild"
554 source "$EBUILD" || die "error sourcing ebuild"
558 if [[ "${EBUILD_PHASE}" != "depend" ]] ; then
559 RESTRICT=${PORTAGE_RESTRICT}
560 [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \
561 rm "$PORTAGE_BUILDDIR/.ebuild_changed"
564 [ "${EAPI+set}" = set ] || EAPI=0
566 # export EAPI for helpers (especially since we unset it above)
569 if ___eapi_has_RDEPEND_DEPEND_fallback; then
570 export RDEPEND=${RDEPEND-${DEPEND}}
571 debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
574 # add in dependency info from eclasses
575 IUSE+="${IUSE:+ }${E_IUSE}"
576 DEPEND+="${DEPEND:+ }${E_DEPEND}"
577 RDEPEND+="${RDEPEND:+ }${E_RDEPEND}"
578 PDEPEND+="${PDEPEND:+ }${E_PDEPEND}"
579 HDEPEND+="${HDEPEND:+ }${E_HDEPEND}"
580 REQUIRED_USE+="${REQUIRED_USE:+ }${E_REQUIRED_USE}"
582 unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND E_HDEPEND \
585 # alphabetically ordered by $EBUILD_PHASE value
588 _valid_phases="src_compile pkg_config pkg_info src_install
589 pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm
590 pkg_setup src_test src_unpack"
593 _valid_phases="src_compile pkg_config src_configure pkg_info
594 src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
595 src_prepare pkg_prerm pkg_setup src_test src_unpack"
598 _valid_phases="src_compile pkg_config src_configure pkg_info
599 src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
600 src_prepare pkg_prerm pkg_pretend pkg_setup src_test src_unpack"
605 for _f in $_valid_phases ; do
606 if declare -F $_f >/dev/null ; then
608 DEFINED_PHASES+=" ${_f#src_}"
611 [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=-
613 unset _f _valid_phases
615 if [[ $EBUILD_PHASE != depend ]] ; then
617 if has distcc $FEATURES ; then
618 [[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
621 if has ccache $FEATURES ; then
623 if [[ -n $CCACHE_DIR ]] ; then
624 addread "$CCACHE_DIR"
625 addwrite "$CCACHE_DIR"
628 [[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
631 if [[ -n $QA_PREBUILT ]] ; then
633 # these ones support fnmatch patterns
634 QA_EXECSTACK+=" $QA_PREBUILT"
635 QA_TEXTRELS+=" $QA_PREBUILT"
636 QA_WX_LOAD+=" $QA_PREBUILT"
638 # these ones support regular expressions, so translate
639 # fnmatch patterns to regular expressions
640 for x in QA_DT_NEEDED QA_FLAGS_IGNORED QA_PRESTRIPPED QA_SONAME ; do
641 if [[ $(declare -p $x 2>/dev/null) = declare\ -a* ]] ; then
642 eval "$x=(\"\${$x[@]}\" ${QA_PREBUILT//\*/.*})"
644 eval "$x+=\" ${QA_PREBUILT//\*/.*}\""
651 # This needs to be exported since prepstrip is a separate shell script.
652 [[ -n $QA_PRESTRIPPED ]] && export QA_PRESTRIPPED
653 eval "[[ -n \$QA_PRESTRIPPED_${ARCH/-/_} ]] && \
654 export QA_PRESTRIPPED_${ARCH/-/_}"
659 # unset USE_EXPAND variables that contain only the special "*" token
660 for x in ${USE_EXPAND} ; do
661 [ "${!x}" == "*" ] && unset ${x}
665 if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
670 if [[ $EBUILD_PHASE = depend ]] ; then
671 export SANDBOX_ON="0"
674 if [ -n "${dbkey}" ] ; then
675 if [ ! -d "${dbkey%/*}" ]; then
676 install -d -g ${PORTAGE_GID} -m2775 "${dbkey%/*}"
678 # Make it group writable. 666&~002==664
682 auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
683 DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAPI
684 PROPERTIES DEFINED_PHASES HDEPEND UNUSED_04
685 UNUSED_03 UNUSED_02 UNUSED_01"
687 if ! ___eapi_has_HDEPEND; then
691 # The extra $(echo) commands remove newlines.
692 if [ -n "${dbkey}" ] ; then
694 for f in ${auxdbkeys} ; do
695 echo $(echo ${!f}) >> "${dbkey}" || exit $?
698 for f in ${auxdbkeys} ; do
699 eval "echo \$(echo \${!f}) 1>&${PORTAGE_PIPE_FD}" || exit $?
701 eval "exec ${PORTAGE_PIPE_FD}>&-"
705 # Note: readonly variables interfere with __preprocess_ebuild_env(), so
706 # declare them only after it has already run.
707 declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS
708 if ___eapi_has_prefix_variables; then
709 declare -r ED EPREFIX EROOT
712 if [[ -n $EBUILD_SH_ARGS ]] ; then
714 # Don't allow subprocesses to inherit the pipe which
715 # emerge uses to monitor ebuild.sh.
716 if [[ -n ${PORTAGE_PIPE_FD} ]] ; then
717 eval "exec ${PORTAGE_PIPE_FD}>&-"
718 unset PORTAGE_PIPE_FD
720 __ebuild_main ${EBUILD_SH_ARGS}
727 # Do not exit when ebuild.sh is sourced by other scripts.