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 ROOTPATH=${ROOTPATH##:}
9 ROOTPATH=${ROOTPATH%%:}
10 PREROOTPATH=${PREROOTPATH##:}
11 PREROOTPATH=${PREROOTPATH%%:}
12 PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
15 # Prevent aliases from causing portage to act inappropriately.
16 # Make sure it's before everything so we don't mess aliases that follow.
19 source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit 1
21 if [[ $EBUILD_PHASE != depend ]] ; then
22 source "${PORTAGE_BIN_PATH}/phase-functions.sh" || die
23 source "${PORTAGE_BIN_PATH}/phase-helpers.sh" || die
24 source "${PORTAGE_BIN_PATH}/bashrc-functions.sh" || die
26 # These dummy functions are for things that are likely to be called
27 # in global scope, even though they are completely useless during
29 for x in diropts docompress exeopts insopts \
30 keepdir libopts register_die_hook register_success_hook \
31 remove_path_entry set_unless_changed strip_duplicate_slashes \
32 unset_unless_changed use useq usev use_with use_enable ; do
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 ] && export E_IUSE="${E_IUSE} ${IUSE}"
286 [ "${REQUIRED_USE+set}" = set ] && export E_REQUIRED_USE="${E_REQUIRED_USE} ${REQUIRED_USE}"
287 [ "${DEPEND+set}" = set ] && export E_DEPEND="${E_DEPEND} ${DEPEND}"
288 [ "${RDEPEND+set}" = set ] && export E_RDEPEND="${E_RDEPEND} ${RDEPEND}"
289 [ "${PDEPEND+set}" = set ] && export 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 preprocess_ebuild_env || \
465 die "error processing environment"
466 # Colon separated SANDBOX_* variables need to be cumulative.
467 for x in SANDBOX_DENY SANDBOX_READ SANDBOX_PREDICT SANDBOX_WRITE ; do
468 export PORTAGE_${x}=${!x}
470 PORTAGE_SANDBOX_ON=${SANDBOX_ON}
472 source "${T}"/environment || \
473 die "error sourcing environment"
474 # We have to temporarily disable sandbox since the
475 # SANDBOX_{DENY,READ,PREDICT,WRITE} values we've just loaded
476 # may be unusable (triggering in spurious sandbox violations)
477 # until we've merged them with our current values.
479 for x in SANDBOX_DENY SANDBOX_PREDICT SANDBOX_READ SANDBOX_WRITE ; do
481 if [ -z "${!x}" ] ; then
483 elif [ -n "${!y}" ] && [ "${!y}" != "${!x}" ] ; then
485 export ${x}=$(printf "${!y}:${!x}" | tr ":" "\0" | \
486 sort -z -u | tr "\0" ":")
492 export SANDBOX_ON=${PORTAGE_SANDBOX_ON}
493 unset PORTAGE_SANDBOX_ON
494 [[ -n $EAPI ]] || EAPI=0
497 if ! has "$EBUILD_PHASE" clean cleanrm ; then
498 if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \
499 -f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \
500 has noauto $FEATURES ; then
501 # The bashrcs get an opportunity here to set aliases that will be expanded
502 # during sourcing of ebuilds and eclasses.
505 # When EBUILD_PHASE != depend, INHERITED comes pre-initialized
506 # from cache. In order to make INHERITED content independent of
507 # EBUILD_PHASE during inherit() calls, we unset INHERITED after
508 # we make a backup copy for QA checks.
509 __INHERITED_QA_CACHE=$INHERITED
511 # *DEPEND and IUSE will be set during the sourcing of the ebuild.
512 # In order to ensure correct interaction between ebuilds and
513 # eclasses, they need to be unset before this process of
514 # interaction begins.
515 unset DEPEND RDEPEND PDEPEND INHERITED IUSE REQUIRED_USE \
516 ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND
518 if [[ $PORTAGE_DEBUG != 1 || ${-/x/} != $- ]] ; then
519 source "$EBUILD" || die "error sourcing ebuild"
522 source "$EBUILD" || die "error sourcing ebuild"
526 if [[ "${EBUILD_PHASE}" != "depend" ]] ; then
527 RESTRICT=${PORTAGE_RESTRICT}
528 [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \
529 rm "$PORTAGE_BUILDDIR/.ebuild_changed"
532 [[ -n $EAPI ]] || EAPI=0
534 if has "$EAPI" 0 1 2 3 3_pre2 ; then
535 export RDEPEND=${RDEPEND-${DEPEND}}
536 debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
539 # add in dependency info from eclasses
540 IUSE="${IUSE} ${E_IUSE}"
541 DEPEND="${DEPEND} ${E_DEPEND}"
542 RDEPEND="${RDEPEND} ${E_RDEPEND}"
543 PDEPEND="${PDEPEND} ${E_PDEPEND}"
544 REQUIRED_USE="${REQUIRED_USE} ${E_REQUIRED_USE}"
546 unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND \
549 # alphabetically ordered by $EBUILD_PHASE value
552 _valid_phases="src_compile pkg_config pkg_info src_install
553 pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm
554 pkg_setup src_test src_unpack"
557 _valid_phases="src_compile pkg_config src_configure pkg_info
558 src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
559 src_prepare pkg_prerm pkg_setup src_test src_unpack"
562 _valid_phases="src_compile pkg_config src_configure pkg_info
563 src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
564 src_prepare pkg_prerm pkg_pretend pkg_setup src_test src_unpack"
569 for _f in $_valid_phases ; do
570 if declare -F $_f >/dev/null ; then
572 DEFINED_PHASES+=" ${_f#src_}"
575 [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=-
577 unset _f _valid_phases
579 if [[ $EBUILD_PHASE != depend ]] ; then
583 _ebuild_helpers_path="$PORTAGE_BIN_PATH/ebuild-helpers"
586 _ebuild_helpers_path="$PORTAGE_BIN_PATH/ebuild-helpers/4:$PORTAGE_BIN_PATH/ebuild-helpers"
590 PATH=$_ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
591 unset _ebuild_helpers_path
593 # Use default ABI libdir in accordance with bug #355283.
594 x=LIBDIR_${DEFAULT_ABI}
595 [[ -n $DEFAULT_ABI && -n ${!x} ]] && x=${!x} || x=lib
597 if has distcc $FEATURES ; then
598 PATH="/usr/$x/distcc/bin:$PATH"
599 [[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
602 if has ccache $FEATURES ; then
603 PATH="/usr/$x/ccache/bin:$PATH"
605 if [[ -n $CCACHE_DIR ]] ; then
606 addread "$CCACHE_DIR"
607 addwrite "$CCACHE_DIR"
610 [[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
615 if [[ -n $QA_PREBUILT ]] ; then
617 # these ones support fnmatch patterns
618 QA_EXECSTACK+=" $QA_PREBUILT"
619 QA_TEXTRELS+=" $QA_PREBUILT"
620 QA_WX_LOAD+=" $QA_PREBUILT"
622 # these ones support regular expressions, so translate
623 # fnmatch patterns to regular expressions
624 for x in QA_DT_HASH QA_DT_NEEDED QA_PRESTRIPPED QA_SONAME ; do
625 if [[ $(declare -p $x 2>/dev/null) = declare\ -a* ]] ; then
626 eval "$x=(\"\${$x[@]}\" ${QA_PREBUILT//\*/.*})"
628 eval "$x+=\" ${QA_PREBUILT//\*/.*}\""
635 # This needs to be exported since prepstrip is a separate shell script.
636 [[ -n $QA_PRESTRIPPED ]] && export QA_PRESTRIPPED
637 eval "[[ -n \$QA_PRESTRIPPED_${ARCH/-/_} ]] && \
638 export QA_PRESTRIPPED_${ARCH/-/_}"
643 # unset USE_EXPAND variables that contain only the special "*" token
644 for x in ${USE_EXPAND} ; do
645 [ "${!x}" == "*" ] && unset ${x}
649 if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
654 if [[ $EBUILD_PHASE = depend ]] ; then
655 export SANDBOX_ON="0"
658 if [ -n "${dbkey}" ] ; then
659 if [ ! -d "${dbkey%/*}" ]; then
660 install -d -g ${PORTAGE_GID} -m2775 "${dbkey%/*}"
662 # Make it group writable. 666&~002==664
666 auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
667 DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAPI
668 PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
669 UNUSED_03 UNUSED_02 UNUSED_01"
671 #the extra $(echo) commands remove newlines
672 [ -n "${EAPI}" ] || EAPI=0
674 if [ -n "${dbkey}" ] ; then
676 for f in ${auxdbkeys} ; do
677 echo $(echo ${!f}) >> "${dbkey}" || exit $?
680 for f in ${auxdbkeys} ; do
681 echo $(echo ${!f}) 1>&9 || exit $?
687 # Note: readonly variables interfere with preprocess_ebuild_env(), so
688 # declare them only after it has already run.
689 declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS
694 declare -r ED EPREFIX EROOT
698 if [[ -n $EBUILD_SH_ARGS ]] ; then
700 # Don't allow subprocesses to inherit the pipe which
701 # emerge uses to monitor ebuild.sh.
703 ebuild_main ${EBUILD_SH_ARGS}
710 # Do not exit when ebuild.sh is sourced by other scripts.