2 # Copyright 1999-2011 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 remove_path_entry set_unless_changed strip_duplicate_slashes \
27 unset_unless_changed use_with use_enable ; do
30 # These dummy functions return false, in order to ensure that
31 # `use multislot` is false for the "depend" phase.
32 for x in use useq usev ; do
33 eval "${x}() { return 1; }"
35 # These functions die because calls to them during the "depend" phase
36 # are considered to be severe QA violations.
37 for x in best_version has_version portageq ; do
38 eval "${x}() { die \"\${FUNCNAME} calls are not allowed in global scope\"; }"
43 if [[ $PORTAGE_SANDBOX_COMPAT_LEVEL -lt 22 ]] ; then
44 # Ensure that /dev/std* streams have appropriate sandbox permission for
45 # bug #288863. This can be removed after sandbox is fixed and portage
46 # depends on the fixed version (sandbox-2.2 has the fix but it is
47 # currently unstable).
48 export SANDBOX_WRITE="${SANDBOX_WRITE:+${SANDBOX_WRITE}:}/dev/stdout:/dev/stderr"
49 export SANDBOX_READ="${SANDBOX_READ:+${SANDBOX_READ}:}/dev/stdin"
52 # Don't use sandbox's BASH_ENV for new shells because it does
53 # 'source /etc/profile' which can interfere with the build
54 # environment by modifying our PATH.
57 # This is just a temporary workaround for portage-9999 users since
58 # earlier portage versions do not detect a version change in this case
59 # (9999 to 9999) and therefore they try execute an incompatible version of
60 # ebuild.sh during the upgrade.
61 export PORTAGE_BZIP2_COMMAND=${PORTAGE_BZIP2_COMMAND:-bzip2}
63 # These two functions wrap sourcing and calling respectively. At present they
64 # perform a qa check to make sure eclasses and ebuilds and profiles don't mess
65 # with shell opts (shopts). Ebuilds/eclasses changing shopts should reset them
69 local shopts=$(shopt) OLDIFS="$IFS"
74 [[ $shopts != $(shopt) ]] &&
75 eqawarn "QA Notice: Global shell options changed and were not restored while sourcing '$*'"
76 [[ "$IFS" != "$OLDIFS" ]] &&
77 eqawarn "QA Notice: Global IFS changed and was not restored while sourcing '$*'"
82 local shopts=$(shopt) OLDIFS="$IFS"
87 [[ $shopts != $(shopt) ]] &&
88 eqawarn "QA Notice: Global shell options changed and were not restored while calling '$*'"
89 [[ "$IFS" != "$OLDIFS" ]] &&
90 eqawarn "QA Notice: Global IFS changed and was not restored while calling '$*'"
98 # Unset some variables that break things.
99 unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
101 [[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET
103 # sandbox support functions; defined prior to profile.bashrc srcing, since the profile might need to add a default exception (/usr/lib64/conftest fex)
106 local var="SANDBOX_${_v}"
107 [[ -z $1 || -n $2 ]] && die "Usage: add$(echo ${_v} | \
108 LC_ALL=C tr [:upper:] [:lower:]) <colon-delimited list of paths>"
109 export ${var}="${!var:+${!var}:}$1"
112 # local var="SANDBOX_${1^^}"
113 # addread() { _sb_append_var ${0#add} "$@" ; }
114 addread() { _sb_append_var READ "$@" ; }
115 addwrite() { _sb_append_var WRITE "$@" ; }
116 adddeny() { _sb_append_var DENY "$@" ; }
117 addpredict() { _sb_append_var PREDICT "$@" ; }
119 addwrite "${PORTAGE_TMPDIR}"
120 addread "/:${PORTAGE_TMPDIR}"
121 [[ -n ${PORTAGE_GPG_DIR} ]] && addpredict "${PORTAGE_GPG_DIR}"
123 # Avoid sandbox violations in temporary directories.
124 if [[ -w $T ]] ; then
128 elif [[ $SANDBOX_ON = 1 ]] ; then
129 for x in TEMP TMP TMPDIR ; do
130 [[ -n ${!x} ]] && addwrite "${!x}"
135 # the sandbox is disabled by default except when overridden in the relevant stages
139 # Custom version of esyslog() to take care of the "Red Star" bug.
140 # MUST follow functions.sh to override the "" parameter problem.
144 # Ensure that $PWD is sane whenever possible, to protect against
145 # exploitation of insecure search path for python -c in ebuilds.
147 if ! has "$EBUILD_PHASE" clean cleanrm depend help ; then
148 cd "$PORTAGE_BUILDDIR" || \
149 die "PORTAGE_BUILDDIR does not exist: '$PORTAGE_BUILDDIR'"
152 #if no perms are specified, dirs/files will have decent defaults
153 #(not secretive, but not stupid)
156 # debug-print() gets called from many places with verbose status information useful
157 # for tracking down problems. The output is in $T/eclass-debug.log.
158 # You can set ECLASS_DEBUG_OUTPUT to redirect the output somewhere else as well.
159 # The special "on" setting echoes the information, mixing it with the rest of the
161 # You can override the setting by exporting a new one from the console, or you can
162 # set a new default in make.*. Here the default is "" or unset.
164 # in the future might use e* from /etc/init.d/functions.sh if i feel like it
166 # if $T isn't defined, we're in dep calculation mode and
167 # shouldn't do anything
168 [[ $EBUILD_PHASE = depend || ! -d ${T} || ${#} -eq 0 ]] && return 0
170 if [[ ${ECLASS_DEBUG_OUTPUT} == on ]]; then
171 printf 'debug: %s\n' "${@}" >&2
172 elif [[ -n ${ECLASS_DEBUG_OUTPUT} ]]; then
173 printf 'debug: %s\n' "${@}" >> "${ECLASS_DEBUG_OUTPUT}"
176 if [[ -w $T ]] ; then
178 printf '%s\n' "${@}" >> "${T}/eclass-debug.log"
179 # let the portage user own/write to this file
180 chgrp portage "${T}/eclass-debug.log" &>/dev/null
181 chmod g+w "${T}/eclass-debug.log" &>/dev/null
185 # The following 2 functions are debug-print() wrappers
187 debug-print-function() {
188 debug-print "${1}: entering function, parameters: ${*:2}"
191 debug-print-section() {
192 debug-print "now in section ${*}"
195 # Sources all eclasses in parameters
196 declare -ix ECLASS_DEPTH=0
198 ECLASS_DEPTH=$(($ECLASS_DEPTH + 1))
199 if [[ ${ECLASS_DEPTH} > 1 ]]; then
200 debug-print "*** Multiple Inheritence (Level: ${ECLASS_DEPTH})"
203 if [[ -n $ECLASS && -n ${!__export_funcs_var} ]] ; then
204 echo "QA Notice: EXPORT_FUNCTIONS is called before inherit in" \
205 "$ECLASS.eclass. For compatibility with <=portage-2.1.6.7," \
206 "only call EXPORT_FUNCTIONS after inherit(s)." \
207 | fmt -w 75 | while read -r ; do eqawarn "$REPLY" ; done
214 # These variables must be restored before returning.
215 local PECLASS=$ECLASS
216 local prev_export_funcs_var=$__export_funcs_var
224 location="${ECLASSDIR}/${1}.eclass"
228 __export_funcs_var=__export_functions_$ECLASS_DEPTH
229 unset $__export_funcs_var
231 if [ "${EBUILD_PHASE}" != "depend" ] && \
232 [[ ${EBUILD_PHASE} != *rm ]] && \
233 [[ ${EMERGE_FROM} != "binary" ]] ; then
234 # This is disabled in the *rm phases because they frequently give
235 # false alarms due to INHERITED in /var/db/pkg being outdated
236 # in comparison the the eclasses from the portage tree.
237 if ! has $ECLASS $INHERITED $__INHERITED_QA_CACHE ; then
238 eqawarn "QA Notice: ECLASS '$ECLASS' inherited illegally in $CATEGORY/$PF $EBUILD_PHASE"
242 # any future resolution code goes here
243 if [ -n "$PORTDIR_OVERLAY" ]; then
245 for overlay in ${PORTDIR_OVERLAY}; do
246 olocation="${overlay}/eclass/${1}.eclass"
247 if [ -e "$olocation" ]; then
248 location="${olocation}"
249 debug-print " eclass exists: ${location}"
253 debug-print "inherit: $1 -> $location"
254 [ ! -e "$location" ] && die "${1}.eclass could not be found by inherit()"
256 if [ "${location}" == "${olocation}" ] && \
257 ! has "${location}" ${EBUILD_OVERLAY_ECLASSES} ; then
258 EBUILD_OVERLAY_ECLASSES="${EBUILD_OVERLAY_ECLASSES} ${location}"
261 #We need to back up the value of DEPEND and RDEPEND to B_DEPEND and B_RDEPEND
262 #(if set).. and then restore them after the inherit call.
264 #turn off glob expansion
267 # Retain the old data and restore it later.
268 unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND
269 [ "${IUSE+set}" = set ] && B_IUSE="${IUSE}"
270 [ "${REQUIRED_USE+set}" = set ] && B_REQUIRED_USE="${REQUIRED_USE}"
271 [ "${DEPEND+set}" = set ] && B_DEPEND="${DEPEND}"
272 [ "${RDEPEND+set}" = set ] && B_RDEPEND="${RDEPEND}"
273 [ "${PDEPEND+set}" = set ] && B_PDEPEND="${PDEPEND}"
274 unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND
275 #turn on glob expansion
278 qa_source "$location" || die "died sourcing $location in inherit()"
280 #turn off glob expansion
283 # If each var has a value, append it to the global variable E_* to
284 # be applied after everything is finished. New incremental behavior.
285 [ "${IUSE+set}" = set ] && E_IUSE+="${E_IUSE:+ }${IUSE}"
286 [ "${REQUIRED_USE+set}" = set ] && E_REQUIRED_USE+="${E_REQUIRED_USE:+ }${REQUIRED_USE}"
287 [ "${DEPEND+set}" = set ] && E_DEPEND+="${E_DEPEND:+ }${DEPEND}"
288 [ "${RDEPEND+set}" = set ] && E_RDEPEND+="${E_RDEPEND:+ }${RDEPEND}"
289 [ "${PDEPEND+set}" = set ] && E_PDEPEND+="${E_PDEPEND:+ }${PDEPEND}"
291 [ "${B_IUSE+set}" = set ] && IUSE="${B_IUSE}"
292 [ "${B_IUSE+set}" = set ] || unset IUSE
294 [ "${B_REQUIRED_USE+set}" = set ] && REQUIRED_USE="${B_REQUIRED_USE}"
295 [ "${B_REQUIRED_USE+set}" = set ] || unset REQUIRED_USE
297 [ "${B_DEPEND+set}" = set ] && DEPEND="${B_DEPEND}"
298 [ "${B_DEPEND+set}" = set ] || unset DEPEND
300 [ "${B_RDEPEND+set}" = set ] && RDEPEND="${B_RDEPEND}"
301 [ "${B_RDEPEND+set}" = set ] || unset RDEPEND
303 [ "${B_PDEPEND+set}" = set ] && PDEPEND="${B_PDEPEND}"
304 [ "${B_PDEPEND+set}" = set ] || unset PDEPEND
306 #turn on glob expansion
309 if [[ -n ${!__export_funcs_var} ]] ; then
310 for x in ${!__export_funcs_var} ; do
311 debug-print "EXPORT_FUNCTIONS: $x -> ${ECLASS}_$x"
312 declare -F "${ECLASS}_$x" >/dev/null || \
313 die "EXPORT_FUNCTIONS: ${ECLASS}_$x is not defined"
314 eval "$x() { ${ECLASS}_$x \"\$@\" ; }" > /dev/null
317 unset $__export_funcs_var
319 has $1 $INHERITED || export INHERITED="$INHERITED $1"
323 ((--ECLASS_DEPTH)) # Returns 1 when ECLASS_DEPTH reaches 0.
324 if (( ECLASS_DEPTH > 0 )) ; then
325 export ECLASS=$PECLASS
326 __export_funcs_var=$prev_export_funcs_var
328 unset ECLASS __export_funcs_var
333 # Exports stub functions that call the eclass's functions, thereby making them default.
334 # For example, if ECLASS="base" and you call "EXPORT_FUNCTIONS src_unpack", the following
335 # code will be eval'd:
336 # src_unpack() { base_src_unpack; }
338 if [ -z "$ECLASS" ]; then
339 die "EXPORT_FUNCTIONS without a defined ECLASS"
341 eval $__export_funcs_var+=\" $*\"
344 PORTAGE_BASHRCS_SOURCED=0
346 # @FUNCTION: source_all_bashrcs
348 # Source a relevant bashrc files and perform other miscellaneous
349 # environment initialization when appropriate.
351 # If EAPI is set then define functions provided by the current EAPI:
353 # * default_* aliases for the current EAPI phase functions
354 # * A "default" function which is an alias for the default phase
355 # function for the current phase.
357 source_all_bashrcs() {
358 [[ $PORTAGE_BASHRCS_SOURCED = 1 ]] && return 0
359 PORTAGE_BASHRCS_SOURCED=1
362 local OCC="${CC}" OCXX="${CXX}"
364 if [[ $EBUILD_PHASE != depend ]] ; then
365 # source the existing profile.bashrcs.
368 local path_array=($PROFILE_PATHS)
370 for x in "${path_array[@]}" ; do
371 [ -f "$x/profile.bashrc" ] && qa_source "$x/profile.bashrc"
375 # We assume if people are changing shopts in their bashrc they do so at their
376 # own peril. This is the ONLY non-portage bit of code that can change shopts
377 # without a QA violation.
378 for x in "${PORTAGE_BASHRC}" "${PM_EBUILD_HOOK_DIR}"/${CATEGORY}/{${PN},${PN}:${SLOT},${P},${PF}}; do
379 if [ -r "${x}" ]; then
380 # If $- contains x, then tracing has already enabled elsewhere for some
381 # reason. We preserve it's state so as not to interfere.
382 if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then
392 [ ! -z "${OCC}" ] && export CC="${OCC}"
393 [ ! -z "${OCXX}" ] && export CXX="${OCXX}"
396 # === === === === === === === === === === === === === === === === === ===
397 # === === === === === functions end, main part begins === === === === ===
398 # === === === === === === === === === === === === === === === === === ===
400 export SANDBOX_ON="1"
401 export S=${WORKDIR}/${P}
403 # Turn of extended glob matching so that g++ doesn't get incorrectly matched.
406 if [[ ${EBUILD_PHASE} == depend ]] ; then
407 QA_INTERCEPTORS="awk bash cc egrep equery fgrep g++
408 gawk gcc grep javac java-config nawk perl
409 pkg-config python python-config sed"
410 elif [[ ${EBUILD_PHASE} == clean* ]] ; then
411 unset QA_INTERCEPTORS
413 QA_INTERCEPTORS="autoconf automake aclocal libtoolize"
415 # level the QA interceptors if we're in depend
416 if [[ -n ${QA_INTERCEPTORS} ]] ; then
417 for BIN in ${QA_INTERCEPTORS}; do
418 BIN_PATH=$(type -Pf ${BIN})
419 if [ "$?" != "0" ]; then
420 BODY="echo \"*** missing command: ${BIN}\" >&2; return 127"
422 BODY="${BIN_PATH} \"\$@\"; return \$?"
424 if [[ ${EBUILD_PHASE} == depend ]] ; then
426 if [ \$ECLASS_DEPTH -gt 0 ]; then
427 eqawarn \"QA Notice: '${BIN}' called in global scope: eclass \${ECLASS}\"
429 eqawarn \"QA Notice: '${BIN}' called in global scope: \${CATEGORY}/\${PF}\"
433 elif has ${BIN} autoconf automake aclocal libtoolize ; then
435 if ! has \${FUNCNAME[1]} eautoreconf eaclocal _elibtoolize \\
436 eautoheader eautoconf eautomake autotools_run_tool \\
437 autotools_check_macro autotools_get_subdirs \\
438 autotools_get_auxdir ; then
439 eqawarn \"QA Notice: '${BIN}' called by \${FUNCNAME[1]}: \${CATEGORY}/\${PF}\"
440 eqawarn \"Use autotools.eclass instead of calling '${BIN}' directly.\"
446 eqawarn \"QA Notice: '${BIN}' called by \${FUNCNAME[1]}: \${CATEGORY}/\${PF}\"
450 eval "$FUNC_SRC" || echo "error creating QA interceptor ${BIN}" >&2
452 unset BIN_PATH BIN BODY FUNC_SRC
455 # Subshell/helper die support (must export for the die helper).
456 export EBUILD_MASTER_PID=$BASHPID
457 trap 'exit 1' SIGTERM
459 if ! has "$EBUILD_PHASE" clean cleanrm depend && \
460 [ -f "${T}"/environment ] ; then
461 # The environment may have been extracted from environment.bz2 or
462 # may have come from another version of ebuild.sh or something.
463 # In any case, preprocess it to prevent any potential interference.
464 # NOTE: export ${FOO}=... requires quoting, unlike normal exports
465 preprocess_ebuild_env || \
466 die "error processing environment"
467 # Colon separated SANDBOX_* variables need to be cumulative.
468 for x in SANDBOX_DENY SANDBOX_READ SANDBOX_PREDICT SANDBOX_WRITE ; do
469 export PORTAGE_${x}="${!x}"
471 PORTAGE_SANDBOX_ON=${SANDBOX_ON}
473 source "${T}"/environment || \
474 die "error sourcing environment"
475 # We have to temporarily disable sandbox since the
476 # SANDBOX_{DENY,READ,PREDICT,WRITE} values we've just loaded
477 # may be unusable (triggering in spurious sandbox violations)
478 # until we've merged them with our current values.
480 for x in SANDBOX_DENY SANDBOX_PREDICT SANDBOX_READ SANDBOX_WRITE ; do
482 if [ -z "${!x}" ] ; then
484 elif [ -n "${!y}" ] && [ "${!y}" != "${!x}" ] ; then
486 export ${x}="$(printf "${!y}:${!x}" | tr ":" "\0" | \
487 sort -z -u | tr "\0" ":")"
489 export ${x}="${!x%:}"
493 export SANDBOX_ON=${PORTAGE_SANDBOX_ON}
494 unset PORTAGE_SANDBOX_ON
495 [[ -n $EAPI ]] || EAPI=0
498 if ! has "$EBUILD_PHASE" clean cleanrm ; then
499 if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \
500 -f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \
501 has noauto $FEATURES ; then
502 # The bashrcs get an opportunity here to set aliases that will be expanded
503 # during sourcing of ebuilds and eclasses.
506 # When EBUILD_PHASE != depend, INHERITED comes pre-initialized
507 # from cache. In order to make INHERITED content independent of
508 # EBUILD_PHASE during inherit() calls, we unset INHERITED after
509 # we make a backup copy for QA checks.
510 __INHERITED_QA_CACHE=$INHERITED
512 # *DEPEND and IUSE will be set during the sourcing of the ebuild.
513 # In order to ensure correct interaction between ebuilds and
514 # eclasses, they need to be unset before this process of
515 # interaction begins.
516 unset DEPEND RDEPEND PDEPEND INHERITED IUSE REQUIRED_USE \
517 ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND
519 if [[ $PORTAGE_DEBUG != 1 || ${-/x/} != $- ]] ; then
520 source "$EBUILD" || die "error sourcing ebuild"
523 source "$EBUILD" || die "error sourcing ebuild"
527 if [[ "${EBUILD_PHASE}" != "depend" ]] ; then
528 RESTRICT=${PORTAGE_RESTRICT}
529 [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \
530 rm "$PORTAGE_BUILDDIR/.ebuild_changed"
533 [[ -n $EAPI ]] || EAPI=0
535 if has "$EAPI" 0 1 2 3 3_pre2 ; then
536 export RDEPEND=${RDEPEND-${DEPEND}}
537 debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
540 # add in dependency info from eclasses
541 IUSE+="${IUSE:+ }${E_IUSE}"
542 DEPEND+="${DEPEND:+ }${E_DEPEND}"
543 RDEPEND+="${RDEPEND:+ }${E_RDEPEND}"
544 PDEPEND+="${PDEPEND:+ }${E_PDEPEND}"
545 REQUIRED_USE+="${REQUIRED_USE:+ }${E_REQUIRED_USE}"
547 unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND \
550 # alphabetically ordered by $EBUILD_PHASE value
553 _valid_phases="src_compile pkg_config pkg_info src_install
554 pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm
555 pkg_setup src_test src_unpack"
558 _valid_phases="src_compile pkg_config src_configure pkg_info
559 src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
560 src_prepare pkg_prerm pkg_setup src_test src_unpack"
563 _valid_phases="src_compile pkg_config src_configure pkg_info
564 src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
565 src_prepare pkg_prerm pkg_pretend pkg_setup src_test src_unpack"
570 for _f in $_valid_phases ; do
571 if declare -F $_f >/dev/null ; then
573 DEFINED_PHASES+=" ${_f#src_}"
576 [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=-
578 unset _f _valid_phases
580 if [[ $EBUILD_PHASE != depend ]] ; then
582 if has distcc $FEATURES ; then
583 [[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
586 if has ccache $FEATURES ; then
588 if [[ -n $CCACHE_DIR ]] ; then
589 addread "$CCACHE_DIR"
590 addwrite "$CCACHE_DIR"
593 [[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
596 if [[ -n $QA_PREBUILT ]] ; then
598 # these ones support fnmatch patterns
599 QA_EXECSTACK+=" $QA_PREBUILT"
600 QA_TEXTRELS+=" $QA_PREBUILT"
601 QA_WX_LOAD+=" $QA_PREBUILT"
603 # these ones support regular expressions, so translate
604 # fnmatch patterns to regular expressions
605 for x in QA_DT_HASH QA_DT_NEEDED QA_PRESTRIPPED QA_SONAME ; do
606 if [[ $(declare -p $x 2>/dev/null) = declare\ -a* ]] ; then
607 eval "$x=(\"\${$x[@]}\" ${QA_PREBUILT//\*/.*})"
609 eval "$x+=\" ${QA_PREBUILT//\*/.*}\""
616 # This needs to be exported since prepstrip is a separate shell script.
617 [[ -n $QA_PRESTRIPPED ]] && export QA_PRESTRIPPED
618 eval "[[ -n \$QA_PRESTRIPPED_${ARCH/-/_} ]] && \
619 export QA_PRESTRIPPED_${ARCH/-/_}"
624 # unset USE_EXPAND variables that contain only the special "*" token
625 for x in ${USE_EXPAND} ; do
626 [ "${!x}" == "*" ] && unset ${x}
630 if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
635 if [[ $EBUILD_PHASE = depend ]] ; then
636 export SANDBOX_ON="0"
639 if [ -n "${dbkey}" ] ; then
640 if [ ! -d "${dbkey%/*}" ]; then
641 install -d -g ${PORTAGE_GID} -m2775 "${dbkey%/*}"
643 # Make it group writable. 666&~002==664
647 auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
648 DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAPI
649 PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
650 UNUSED_03 UNUSED_02 UNUSED_01"
652 #the extra $(echo) commands remove newlines
653 [ -n "${EAPI}" ] || EAPI=0
655 if [ -n "${dbkey}" ] ; then
657 for f in ${auxdbkeys} ; do
658 echo $(echo ${!f}) >> "${dbkey}" || exit $?
661 for f in ${auxdbkeys} ; do
662 echo $(echo ${!f}) 1>&9 || exit $?
668 # Note: readonly variables interfere with preprocess_ebuild_env(), so
669 # declare them only after it has already run.
670 declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS
673 [[ " ${USE} " == *" prefix "* ]] && \
674 declare -r ED EPREFIX EROOT
677 declare -r ED EPREFIX EROOT
681 if [[ -n $EBUILD_SH_ARGS ]] ; then
683 # Don't allow subprocesses to inherit the pipe which
684 # emerge uses to monitor ebuild.sh.
686 ebuild_main ${EBUILD_SH_ARGS}
693 # Do not exit when ebuild.sh is sourced by other scripts.