2 # Copyright 1999-2012 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 has \"\${EAPI:-0}\" 4-python; then
30 die \"\${FUNCNAME}() calls are not allowed in global scope\"
34 # These dummy functions return false in older EAPIs, in order to ensure that
35 # `use multislot` is false for the "depend" phase.
36 for x in use useq usev usex ; do
38 if has \"\${EAPI:-0}\" 4-python; then
39 die \"\${FUNCNAME}() calls are not allowed in global scope\"
45 # These functions die because calls to them during the "depend" phase
46 # are considered to be severe QA violations.
47 for x in best_version has_version portageq ; do
48 eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in global scope\"; }"
53 # Don't use sandbox's BASH_ENV for new shells because it does
54 # 'source /etc/profile' which can interfere with the build
55 # environment by modifying our PATH.
58 # This is just a temporary workaround for portage-9999 users since
59 # earlier portage versions do not detect a version change in this case
60 # (9999 to 9999) and therefore they try execute an incompatible version of
61 # ebuild.sh during the upgrade.
62 export PORTAGE_BZIP2_COMMAND=${PORTAGE_BZIP2_COMMAND:-bzip2}
64 # These two functions wrap sourcing and calling respectively. At present they
65 # perform a qa check to make sure eclasses and ebuilds and profiles don't mess
66 # with shell opts (shopts). Ebuilds/eclasses changing shopts should reset them
70 local shopts=$(shopt) OLDIFS="$IFS"
75 [[ $shopts != $(shopt) ]] &&
76 eqawarn "QA Notice: Global shell options changed and were not restored while sourcing '$*'"
77 [[ "$IFS" != "$OLDIFS" ]] &&
78 eqawarn "QA Notice: Global IFS changed and was not restored while sourcing '$*'"
83 local shopts=$(shopt) OLDIFS="$IFS"
88 [[ $shopts != $(shopt) ]] &&
89 eqawarn "QA Notice: Global shell options changed and were not restored while calling '$*'"
90 [[ "$IFS" != "$OLDIFS" ]] &&
91 eqawarn "QA Notice: Global IFS changed and was not restored while calling '$*'"
99 # Unset some variables that break things.
100 unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
102 [[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET
104 # sandbox support functions; defined prior to profile.bashrc srcing, since the profile might need to add a default exception (/usr/lib64/conftest fex)
107 local var="SANDBOX_${_v}"
108 [[ -z $1 || -n $2 ]] && die "Usage: add$(echo ${_v} | \
109 LC_ALL=C tr [:upper:] [:lower:]) <colon-delimited list of paths>"
110 export ${var}="${!var:+${!var}:}$1"
113 # local var="SANDBOX_${1^^}"
114 # addread() { _sb_append_var ${0#add} "$@" ; }
115 addread() { _sb_append_var READ "$@" ; }
116 addwrite() { _sb_append_var WRITE "$@" ; }
117 adddeny() { _sb_append_var DENY "$@" ; }
118 addpredict() { _sb_append_var PREDICT "$@" ; }
120 addwrite "${PORTAGE_TMPDIR}"
121 addread "/:${PORTAGE_TMPDIR}"
122 [[ -n ${PORTAGE_GPG_DIR} ]] && addpredict "${PORTAGE_GPG_DIR}"
124 # Avoid sandbox violations in temporary directories.
125 if [[ -w $T ]] ; then
129 elif [[ $SANDBOX_ON = 1 ]] ; then
130 for x in TEMP TMP TMPDIR ; do
131 [[ -n ${!x} ]] && addwrite "${!x}"
136 # the sandbox is disabled by default except when overridden in the relevant stages
139 # Ensure that $PWD is sane whenever possible, to protect against
140 # exploitation of insecure search path for python -c in ebuilds.
142 if ! has "$EBUILD_PHASE" clean cleanrm depend help ; then
143 cd "$PORTAGE_BUILDDIR" || \
144 die "PORTAGE_BUILDDIR does not exist: '$PORTAGE_BUILDDIR'"
147 #if no perms are specified, dirs/files will have decent defaults
148 #(not secretive, but not stupid)
151 # debug-print() gets called from many places with verbose status information useful
152 # for tracking down problems. The output is in $T/eclass-debug.log.
153 # You can set ECLASS_DEBUG_OUTPUT to redirect the output somewhere else as well.
154 # The special "on" setting echoes the information, mixing it with the rest of the
156 # You can override the setting by exporting a new one from the console, or you can
157 # set a new default in make.*. Here the default is "" or unset.
159 # in the future might use e* from /etc/init.d/functions.sh if i feel like it
161 # if $T isn't defined, we're in dep calculation mode and
162 # shouldn't do anything
163 [[ $EBUILD_PHASE = depend || ! -d ${T} || ${#} -eq 0 ]] && return 0
165 if [[ ${ECLASS_DEBUG_OUTPUT} == on ]]; then
166 printf 'debug: %s\n' "${@}" >&2
167 elif [[ -n ${ECLASS_DEBUG_OUTPUT} ]]; then
168 printf 'debug: %s\n' "${@}" >> "${ECLASS_DEBUG_OUTPUT}"
171 if [[ -w $T ]] ; then
173 printf '%s\n' "${@}" >> "${T}/eclass-debug.log"
174 # let the portage user own/write to this file
175 chgrp portage "${T}/eclass-debug.log" &>/dev/null
176 chmod g+w "${T}/eclass-debug.log" &>/dev/null
180 # The following 2 functions are debug-print() wrappers
182 debug-print-function() {
183 debug-print "${1}: entering function, parameters: ${*:2}"
186 debug-print-section() {
187 debug-print "now in section ${*}"
190 # Sources all eclasses in parameters
191 declare -ix ECLASS_DEPTH=0
193 ECLASS_DEPTH=$(($ECLASS_DEPTH + 1))
194 if [[ ${ECLASS_DEPTH} > 1 ]]; then
195 debug-print "*** Multiple Inheritence (Level: ${ECLASS_DEPTH})"
198 if [[ -n $ECLASS && -n ${!__export_funcs_var} ]] ; then
199 echo "QA Notice: EXPORT_FUNCTIONS is called before inherit in" \
200 "$ECLASS.eclass. For compatibility with <=portage-2.1.6.7," \
201 "only call EXPORT_FUNCTIONS after inherit(s)." \
202 | fmt -w 75 | while read -r ; do eqawarn "$REPLY" ; done
209 # These variables must be restored before returning.
210 local PECLASS=$ECLASS
211 local prev_export_funcs_var=$__export_funcs_var
219 location="${ECLASSDIR}/${1}.eclass"
223 __export_funcs_var=__export_functions_$ECLASS_DEPTH
224 unset $__export_funcs_var
226 if [ "${EBUILD_PHASE}" != "depend" ] && \
227 [ "${EBUILD_PHASE}" != "nofetch" ] && \
228 [[ ${EBUILD_PHASE} != *rm ]] && \
229 [[ ${EMERGE_FROM} != "binary" ]] ; then
230 # This is disabled in the *rm phases because they frequently give
231 # false alarms due to INHERITED in /var/db/pkg being outdated
232 # in comparison the the eclasses from the portage tree. It's
233 # disabled for nofetch, since that can be called by repoman and
234 # that triggers bug #407449 due to repoman not exporting
235 # non-essential variables such as INHERITED.
236 if ! has $ECLASS $INHERITED $__INHERITED_QA_CACHE ; then
237 eqawarn "QA Notice: ECLASS '$ECLASS' inherited illegally in $CATEGORY/$PF $EBUILD_PHASE"
241 # any future resolution code goes here
242 if [ -n "$PORTDIR_OVERLAY" ]; then
244 for overlay in ${PORTDIR_OVERLAY}; do
245 olocation="${overlay}/eclass/${1}.eclass"
246 if [ -e "$olocation" ]; then
247 location="${olocation}"
248 debug-print " eclass exists: ${location}"
252 debug-print "inherit: $1 -> $location"
253 [ ! -e "$location" ] && die "${1}.eclass could not be found by inherit()"
255 if [ "${location}" == "${olocation}" ] && \
256 ! has "${location}" ${EBUILD_OVERLAY_ECLASSES} ; then
257 EBUILD_OVERLAY_ECLASSES="${EBUILD_OVERLAY_ECLASSES} ${location}"
260 #We need to back up the value of DEPEND and RDEPEND to B_DEPEND and B_RDEPEND
261 #(if set).. and then restore them after the inherit call.
263 #turn off glob expansion
266 # Retain the old data and restore it later.
267 unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND
268 [ "${IUSE+set}" = set ] && B_IUSE="${IUSE}"
269 [ "${REQUIRED_USE+set}" = set ] && B_REQUIRED_USE="${REQUIRED_USE}"
270 [ "${DEPEND+set}" = set ] && B_DEPEND="${DEPEND}"
271 [ "${RDEPEND+set}" = set ] && B_RDEPEND="${RDEPEND}"
272 [ "${PDEPEND+set}" = set ] && B_PDEPEND="${PDEPEND}"
273 unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND
274 #turn on glob expansion
277 qa_source "$location" || die "died sourcing $location in inherit()"
279 #turn off glob expansion
282 # If each var has a value, append it to the global variable E_* to
283 # be applied after everything is finished. New incremental behavior.
284 [ "${IUSE+set}" = set ] && E_IUSE+="${E_IUSE:+ }${IUSE}"
285 [ "${REQUIRED_USE+set}" = set ] && E_REQUIRED_USE+="${E_REQUIRED_USE:+ }${REQUIRED_USE}"
286 [ "${DEPEND+set}" = set ] && E_DEPEND+="${E_DEPEND:+ }${DEPEND}"
287 [ "${RDEPEND+set}" = set ] && E_RDEPEND+="${E_RDEPEND:+ }${RDEPEND}"
288 [ "${PDEPEND+set}" = set ] && E_PDEPEND+="${E_PDEPEND:+ }${PDEPEND}"
290 [ "${B_IUSE+set}" = set ] && IUSE="${B_IUSE}"
291 [ "${B_IUSE+set}" = set ] || unset IUSE
293 [ "${B_REQUIRED_USE+set}" = set ] && REQUIRED_USE="${B_REQUIRED_USE}"
294 [ "${B_REQUIRED_USE+set}" = set ] || unset REQUIRED_USE
296 [ "${B_DEPEND+set}" = set ] && DEPEND="${B_DEPEND}"
297 [ "${B_DEPEND+set}" = set ] || unset DEPEND
299 [ "${B_RDEPEND+set}" = set ] && RDEPEND="${B_RDEPEND}"
300 [ "${B_RDEPEND+set}" = set ] || unset RDEPEND
302 [ "${B_PDEPEND+set}" = set ] && PDEPEND="${B_PDEPEND}"
303 [ "${B_PDEPEND+set}" = set ] || unset PDEPEND
305 #turn on glob expansion
308 if [[ -n ${!__export_funcs_var} ]] ; then
309 for x in ${!__export_funcs_var} ; do
310 debug-print "EXPORT_FUNCTIONS: $x -> ${ECLASS}_$x"
311 declare -F "${ECLASS}_$x" >/dev/null || \
312 die "EXPORT_FUNCTIONS: ${ECLASS}_$x is not defined"
313 eval "$x() { ${ECLASS}_$x \"\$@\" ; }" > /dev/null
316 unset $__export_funcs_var
318 has $1 $INHERITED || export INHERITED="$INHERITED $1"
322 ((--ECLASS_DEPTH)) # Returns 1 when ECLASS_DEPTH reaches 0.
323 if (( ECLASS_DEPTH > 0 )) ; then
324 export ECLASS=$PECLASS
325 __export_funcs_var=$prev_export_funcs_var
327 unset ECLASS __export_funcs_var
332 # Exports stub functions that call the eclass's functions, thereby making them default.
333 # For example, if ECLASS="base" and you call "EXPORT_FUNCTIONS src_unpack", the following
334 # code will be eval'd:
335 # src_unpack() { base_src_unpack; }
337 if [ -z "$ECLASS" ]; then
338 die "EXPORT_FUNCTIONS without a defined ECLASS"
340 eval $__export_funcs_var+=\" $*\"
343 PORTAGE_BASHRCS_SOURCED=0
345 # @FUNCTION: source_all_bashrcs
347 # Source a relevant bashrc files and perform other miscellaneous
348 # environment initialization when appropriate.
350 # If EAPI is set then define functions provided by the current EAPI:
352 # * default_* aliases for the current EAPI phase functions
353 # * A "default" function which is an alias for the default phase
354 # function for the current phase.
356 source_all_bashrcs() {
357 [[ $PORTAGE_BASHRCS_SOURCED = 1 ]] && return 0
358 PORTAGE_BASHRCS_SOURCED=1
361 local OCC="${CC}" OCXX="${CXX}"
363 if [[ $EBUILD_PHASE != depend ]] ; then
364 # source the existing profile.bashrcs.
367 local path_array=($PROFILE_PATHS)
369 for x in "${path_array[@]}" ; do
370 [ -f "$x/profile.bashrc" ] && qa_source "$x/profile.bashrc"
374 if [ -r "${PORTAGE_BASHRC}" ] ; then
375 if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then
376 source "${PORTAGE_BASHRC}"
379 source "${PORTAGE_BASHRC}"
384 if [[ $EBUILD_PHASE != depend ]] ; then
385 # The user's bashrc is the ONLY non-portage bit of code that can
386 # change shopts without a QA violation.
387 for x in "${PM_EBUILD_HOOK_DIR}"/${CATEGORY}/{${PN},${PN}:${SLOT},${P},${PF}}; do
388 if [ -r "${x}" ]; then
389 # If $- contains x, then tracing has already been enabled
390 # elsewhere for some reason. We preserve it's state so as
392 if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then
403 [ ! -z "${OCC}" ] && export CC="${OCC}"
404 [ ! -z "${OCXX}" ] && export CXX="${OCXX}"
407 # === === === === === === === === === === === === === === === === === ===
408 # === === === === === functions end, main part begins === === === === ===
409 # === === === === === === === === === === === === === === === === === ===
411 export SANDBOX_ON="1"
412 export S=${WORKDIR}/${P}
414 # Turn of extended glob matching so that g++ doesn't get incorrectly matched.
417 if [[ ${EBUILD_PHASE} == depend ]] ; then
418 QA_INTERCEPTORS="awk bash cc egrep equery fgrep g++
419 gawk gcc grep javac java-config nawk perl
420 pkg-config python python-config sed"
421 elif [[ ${EBUILD_PHASE} == clean* ]] ; then
422 unset QA_INTERCEPTORS
424 QA_INTERCEPTORS="autoconf automake aclocal libtoolize"
426 # level the QA interceptors if we're in depend
427 if [[ -n ${QA_INTERCEPTORS} ]] ; then
428 for BIN in ${QA_INTERCEPTORS}; do
429 BIN_PATH=$(type -Pf ${BIN})
430 if [ "$?" != "0" ]; then
431 BODY="echo \"*** missing command: ${BIN}\" >&2; return 127"
433 BODY="${BIN_PATH} \"\$@\"; return \$?"
435 if [[ ${EBUILD_PHASE} == depend ]] ; then
437 if [ \$ECLASS_DEPTH -gt 0 ]; then
438 eqawarn \"QA Notice: '${BIN}' called in global scope: eclass \${ECLASS}\"
440 eqawarn \"QA Notice: '${BIN}' called in global scope: \${CATEGORY}/\${PF}\"
444 elif has ${BIN} autoconf automake aclocal libtoolize ; then
446 if ! has \${FUNCNAME[1]} eautoreconf eaclocal _elibtoolize \\
447 eautoheader eautoconf eautomake autotools_run_tool \\
448 autotools_check_macro autotools_get_subdirs \\
449 autotools_get_auxdir ; then
450 eqawarn \"QA Notice: '${BIN}' called by \${FUNCNAME[1]}: \${CATEGORY}/\${PF}\"
451 eqawarn \"Use autotools.eclass instead of calling '${BIN}' directly.\"
457 eqawarn \"QA Notice: '${BIN}' called by \${FUNCNAME[1]}: \${CATEGORY}/\${PF}\"
461 eval "$FUNC_SRC" || echo "error creating QA interceptor ${BIN}" >&2
463 unset BIN_PATH BIN BODY FUNC_SRC
466 # Subshell/helper die support (must export for the die helper).
467 export EBUILD_MASTER_PID=$BASHPID
468 trap 'exit 1' SIGTERM
470 if ! has "$EBUILD_PHASE" clean cleanrm depend && \
471 [ -f "${T}"/environment ] ; then
472 # The environment may have been extracted from environment.bz2 or
473 # may have come from another version of ebuild.sh or something.
474 # In any case, preprocess it to prevent any potential interference.
475 # NOTE: export ${FOO}=... requires quoting, unlike normal exports
476 preprocess_ebuild_env || \
477 die "error processing environment"
478 # Colon separated SANDBOX_* variables need to be cumulative.
479 for x in SANDBOX_DENY SANDBOX_READ SANDBOX_PREDICT SANDBOX_WRITE ; do
480 export PORTAGE_${x}="${!x}"
482 PORTAGE_SANDBOX_ON=${SANDBOX_ON}
484 source "${T}"/environment || \
485 die "error sourcing environment"
486 # We have to temporarily disable sandbox since the
487 # SANDBOX_{DENY,READ,PREDICT,WRITE} values we've just loaded
488 # may be unusable (triggering in spurious sandbox violations)
489 # until we've merged them with our current values.
491 for x in SANDBOX_DENY SANDBOX_PREDICT SANDBOX_READ SANDBOX_WRITE ; do
493 if [ -z "${!x}" ] ; then
495 elif [ -n "${!y}" ] && [ "${!y}" != "${!x}" ] ; then
497 export ${x}="$(printf "${!y}:${!x}" | tr ":" "\0" | \
498 sort -z -u | tr "\0" ":")"
500 export ${x}="${!x%:}"
504 export SANDBOX_ON=${PORTAGE_SANDBOX_ON}
505 unset PORTAGE_SANDBOX_ON
506 [[ -n $EAPI ]] || EAPI=0
509 if has "${EAPI:-0}" 4-python; then
513 if ! has "$EBUILD_PHASE" clean cleanrm ; then
514 if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \
515 -f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \
516 has noauto $FEATURES ; then
517 # The bashrcs get an opportunity here to set aliases that will be expanded
518 # during sourcing of ebuilds and eclasses.
521 # When EBUILD_PHASE != depend, INHERITED comes pre-initialized
522 # from cache. In order to make INHERITED content independent of
523 # EBUILD_PHASE during inherit() calls, we unset INHERITED after
524 # we make a backup copy for QA checks.
525 __INHERITED_QA_CACHE=$INHERITED
527 # *DEPEND and IUSE will be set during the sourcing of the ebuild.
528 # In order to ensure correct interaction between ebuilds and
529 # eclasses, they need to be unset before this process of
530 # interaction begins.
531 unset EAPI DEPEND RDEPEND PDEPEND INHERITED IUSE REQUIRED_USE \
532 ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND
534 if [[ $PORTAGE_DEBUG != 1 || ${-/x/} != $- ]] ; then
535 source "$EBUILD" || die "error sourcing ebuild"
538 source "$EBUILD" || die "error sourcing ebuild"
542 if [[ "${EBUILD_PHASE}" != "depend" ]] ; then
543 RESTRICT=${PORTAGE_RESTRICT}
544 [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \
545 rm "$PORTAGE_BUILDDIR/.ebuild_changed"
548 [ "${EAPI+set}" = set ] || EAPI=0
550 # export EAPI for helpers (especially since we unset it above)
553 if has "$EAPI" 0 1 2 3 ; then
554 export RDEPEND=${RDEPEND-${DEPEND}}
555 debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
558 # add in dependency info from eclasses
559 IUSE+="${IUSE:+ }${E_IUSE}"
560 DEPEND+="${DEPEND:+ }${E_DEPEND}"
561 RDEPEND+="${RDEPEND:+ }${E_RDEPEND}"
562 PDEPEND+="${PDEPEND:+ }${E_PDEPEND}"
563 REQUIRED_USE+="${REQUIRED_USE:+ }${E_REQUIRED_USE}"
565 unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND \
568 # alphabetically ordered by $EBUILD_PHASE value
571 _valid_phases="src_compile pkg_config pkg_info src_install
572 pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm
573 pkg_setup src_test src_unpack"
576 _valid_phases="src_compile pkg_config src_configure pkg_info
577 src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
578 src_prepare pkg_prerm pkg_setup src_test src_unpack"
581 _valid_phases="src_compile pkg_config src_configure pkg_info
582 src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
583 src_prepare pkg_prerm pkg_pretend pkg_setup src_test src_unpack"
588 for _f in $_valid_phases ; do
589 if declare -F $_f >/dev/null ; then
591 DEFINED_PHASES+=" ${_f#src_}"
594 [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=-
596 unset _f _valid_phases
598 if [[ $EBUILD_PHASE != depend ]] ; then
600 if has distcc $FEATURES ; then
601 [[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
604 if has ccache $FEATURES ; then
606 if [[ -n $CCACHE_DIR ]] ; then
607 addread "$CCACHE_DIR"
608 addwrite "$CCACHE_DIR"
611 [[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
614 if [[ -n $QA_PREBUILT ]] ; then
616 # these ones support fnmatch patterns
617 QA_EXECSTACK+=" $QA_PREBUILT"
618 QA_TEXTRELS+=" $QA_PREBUILT"
619 QA_WX_LOAD+=" $QA_PREBUILT"
621 # these ones support regular expressions, so translate
622 # fnmatch patterns to regular expressions
623 for x in QA_DT_NEEDED QA_FLAGS_IGNORED QA_PRESTRIPPED QA_SONAME ; do
624 if [[ $(declare -p $x 2>/dev/null) = declare\ -a* ]] ; then
625 eval "$x=(\"\${$x[@]}\" ${QA_PREBUILT//\*/.*})"
627 eval "$x+=\" ${QA_PREBUILT//\*/.*}\""
634 # This needs to be exported since prepstrip is a separate shell script.
635 [[ -n $QA_PRESTRIPPED ]] && export QA_PRESTRIPPED
636 eval "[[ -n \$QA_PRESTRIPPED_${ARCH/-/_} ]] && \
637 export QA_PRESTRIPPED_${ARCH/-/_}"
642 # unset USE_EXPAND variables that contain only the special "*" token
643 for x in ${USE_EXPAND} ; do
644 [ "${!x}" == "*" ] && unset ${x}
648 if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
653 if [[ $EBUILD_PHASE = depend ]] ; then
654 export SANDBOX_ON="0"
657 if [ -n "${dbkey}" ] ; then
658 if [ ! -d "${dbkey%/*}" ]; then
659 install -d -g ${PORTAGE_GID} -m2775 "${dbkey%/*}"
661 # Make it group writable. 666&~002==664
665 auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
666 DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAPI
667 PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
668 UNUSED_03 UNUSED_02 UNUSED_01"
670 # The extra $(echo) commands remove newlines.
671 if [ -n "${dbkey}" ] ; then
673 for f in ${auxdbkeys} ; do
674 echo $(echo ${!f}) >> "${dbkey}" || exit $?
677 for f in ${auxdbkeys} ; do
678 echo $(echo ${!f}) 1>&9 || exit $?
684 # Note: readonly variables interfere with preprocess_ebuild_env(), so
685 # declare them only after it has already run.
686 declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS
689 [[ " ${FEATURES} " == *" force-prefix "* ]] && \
690 declare -r ED EPREFIX EROOT
693 declare -r ED EPREFIX EROOT
697 if [[ -n $EBUILD_SH_ARGS ]] ; then
699 # Don't allow subprocesses to inherit the pipe which
700 # emerge uses to monitor ebuild.sh.
702 ebuild_main ${EBUILD_SH_ARGS}
709 # Do not exit when ebuild.sh is sourced by other scripts.