aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'portage_with_autodep/bin/isolated-functions.sh')
-rwxr-xr-x[-rw-r--r--]portage_with_autodep/bin/isolated-functions.sh175
1 files changed, 26 insertions, 149 deletions
diff --git a/portage_with_autodep/bin/isolated-functions.sh b/portage_with_autodep/bin/isolated-functions.sh
index 65bb1d5..dbf988b 100644..100755
--- a/portage_with_autodep/bin/isolated-functions.sh
+++ b/portage_with_autodep/bin/isolated-functions.sh
@@ -173,8 +173,8 @@ die() {
| while read -r n ; do eerror " ${n#RETAIN-LEADING-SPACE}" ; done
eerror
fi
- eerror "If you need support, post the output of 'emerge --info =$CATEGORY/$PF',"
- eerror "the complete build log and the output of 'emerge -pqv =$CATEGORY/$PF'."
+ eerror "If you need support, post the output of \`emerge --info '=$CATEGORY/$PF'\`,"
+ eerror "the complete build log and the output of \`emerge -pqv '=$CATEGORY/$PF'\`."
if [[ -n ${EBUILD_OVERLAY_ECLASSES} ]] ; then
eerror "This ebuild used the following eclasses from overlays:"
local x
@@ -203,7 +203,12 @@ die() {
fi
fi
- if [[ "${EBUILD_PHASE/depend}" == "${EBUILD_PHASE}" ]] ; then
+ # Only call die hooks here if we are executed via ebuild.sh or
+ # misc-functions.sh, since those are the only cases where the environment
+ # contains the hook functions. When necessary (like for helpers_die), die
+ # hooks are automatically called later by a misc-functions.sh invocation.
+ if has ${BASH_SOURCE[$main_index]##*/} ebuild.sh misc-functions.sh && \
+ [[ ${EBUILD_PHASE} != depend ]] ; then
local x
for x in $EBUILD_DEATH_HOOKS; do
${x} "$@" >&2 1>&2
@@ -211,8 +216,15 @@ die() {
> "$PORTAGE_BUILDDIR/.die_hooks"
fi
- [[ -n ${PORTAGE_LOG_FILE} ]] \
- && eerror "The complete build log is located at '${PORTAGE_LOG_FILE}'."
+ if [[ -n ${PORTAGE_LOG_FILE} ]] ; then
+ eerror "The complete build log is located at '${PORTAGE_LOG_FILE}'."
+ if [[ ${PORTAGE_LOG_FILE} != ${T}/* ]] ; then
+ # Display path to symlink in ${T}, as requested in bug #412865.
+ local log_ext=log
+ [[ ${PORTAGE_LOG_FILE} != *.log ]] && log_ext+=.${PORTAGE_LOG_FILE##*.}
+ eerror "For convenience, a symlink to the build log is located at '${T}/build.${log_ext}'."
+ fi
+ fi
if [ -f "${T}/environment" ] ; then
eerror "The ebuild environment file is located at '${T}/environment'."
elif [ -d "${T}" ] ; then
@@ -222,6 +234,7 @@ die() {
} > "${T}/die.env"
eerror "The ebuild environment file is located at '${T}/die.env'."
fi
+ eerror "Working directory: '$(pwd)'"
eerror "S: '${S}'"
[[ -n $PORTAGE_EBUILD_EXIT_FILE ]] && > "$PORTAGE_EBUILD_EXIT_FILE"
@@ -392,57 +405,6 @@ eend() {
return ${retval}
}
-KV_major() {
- [[ -z $1 ]] && return 1
-
- local KV=$@
- echo "${KV%%.*}"
-}
-
-KV_minor() {
- [[ -z $1 ]] && return 1
-
- local KV=$@
- KV=${KV#*.}
- echo "${KV%%.*}"
-}
-
-KV_micro() {
- [[ -z $1 ]] && return 1
-
- local KV=$@
- KV=${KV#*.*.}
- echo "${KV%%[^[:digit:]]*}"
-}
-
-KV_to_int() {
- [[ -z $1 ]] && return 1
-
- local KV_MAJOR=$(KV_major "$1")
- local KV_MINOR=$(KV_minor "$1")
- local KV_MICRO=$(KV_micro "$1")
- local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
- # We make version 2.2.0 the minimum version we will handle as
- # a sanity check ... if its less, we fail ...
- if [[ ${KV_int} -ge 131584 ]] ; then
- echo "${KV_int}"
- return 0
- fi
-
- return 1
-}
-
-_RC_GET_KV_CACHE=""
-get_KV() {
- [[ -z ${_RC_GET_KV_CACHE} ]] \
- && _RC_GET_KV_CACHE=$(uname -r)
-
- echo $(KV_to_int "${_RC_GET_KV_CACHE}")
-
- return $?
-}
-
unset_colors() {
COLS=80
ENDCOL=
@@ -457,7 +419,13 @@ unset_colors() {
set_colors() {
COLS=${COLUMNS:-0} # bash's internal COLUMNS variable
- (( COLS == 0 )) && COLS=$(set -- $(stty size 2>/dev/null) ; echo $2)
+ # Avoid wasteful stty calls during the "depend" phases.
+ # If stdout is a pipe, the parent process can export COLUMNS
+ # if it's relevant. Use an extra subshell for stty calls, in
+ # order to redirect "/dev/tty: No such device or address"
+ # error from bash to /dev/null.
+ [[ $COLS == 0 && $EBUILD_PHASE != depend ]] && \
+ COLS=$(set -- $( ( stty size </dev/tty ) 2>/dev/null || echo 24 80 ) ; echo $2)
(( COLS > 0 )) || (( COLS = 80 ))
# Now, ${ENDCOL} will move us to the end of the
@@ -471,8 +439,8 @@ set_colors() {
BAD=$'\e[31;01m'
HILITE=$'\e[36;01m'
BRACKET=$'\e[34;01m'
+ NORMAL=$'\e[0m'
fi
- NORMAL=$'\e[0m'
}
RC_ENDCOL="yes"
@@ -536,95 +504,4 @@ has() {
return 1
}
-# @FUNCTION: save_ebuild_env
-# @DESCRIPTION:
-# echo the current environment to stdout, filtering out redundant info.
-#
-# --exclude-init-phases causes pkg_nofetch and src_* phase functions to
-# be excluded from the output. These function are not needed for installation
-# or removal of the packages, and can therefore be safely excluded.
-#
-save_ebuild_env() {
- (
-
- if has --exclude-init-phases $* ; then
- unset S _E_DOCDESTTREE_ _E_EXEDESTTREE_
- if [[ -n $PYTHONPATH ]] ; then
- export PYTHONPATH=${PYTHONPATH/${PORTAGE_PYM_PATH}:}
- [[ -z $PYTHONPATH ]] && unset PYTHONPATH
- fi
- fi
-
- # misc variables inherited from the calling environment
- unset COLORTERM DISPLAY EDITOR LESS LESSOPEN LOGNAME LS_COLORS PAGER \
- TERM TERMCAP USER ftp_proxy http_proxy no_proxy
-
- # other variables inherited from the calling environment
- unset CVS_RSH ECHANGELOG_USER GPG_AGENT_INFO \
- SSH_AGENT_PID SSH_AUTH_SOCK STY WINDOW XAUTHORITY
-
- # CCACHE and DISTCC config
- unset ${!CCACHE_*} ${!DISTCC_*}
-
- # There's no need to bloat environment.bz2 with internally defined
- # functions and variables, so filter them out if possible.
-
- for x in pkg_setup pkg_nofetch src_unpack src_prepare src_configure \
- src_compile src_test src_install pkg_preinst pkg_postinst \
- pkg_prerm pkg_postrm ; do
- unset -f default_$x _eapi{0,1,2,3,4}_$x
- done
- unset x
-
- unset -f assert assert_sigpipe_ok dump_trace die diefunc \
- quiet_mode vecho elog_base eqawarn elog \
- esyslog einfo einfon ewarn eerror ebegin _eend eend KV_major \
- KV_minor KV_micro KV_to_int get_KV unset_colors set_colors has \
- has_phase_defined_up_to \
- hasg hasgq hasv hasq qa_source qa_call \
- addread addwrite adddeny addpredict _sb_append_var \
- lchown lchgrp esyslog use usev useq has_version portageq \
- best_version use_with use_enable register_die_hook \
- keepdir unpack strip_duplicate_slashes econf einstall \
- dyn_setup dyn_unpack dyn_clean into insinto exeinto docinto \
- insopts diropts exeopts libopts docompress \
- abort_handler abort_prepare abort_configure abort_compile \
- abort_test abort_install dyn_prepare dyn_configure \
- dyn_compile dyn_test dyn_install \
- dyn_preinst dyn_help debug-print debug-print-function \
- debug-print-section inherit EXPORT_FUNCTIONS remove_path_entry \
- save_ebuild_env filter_readonly_variables preprocess_ebuild_env \
- set_unless_changed unset_unless_changed source_all_bashrcs \
- ebuild_main ebuild_phase ebuild_phase_with_hooks \
- _ebuild_arg_to_phase _ebuild_phase_funcs default \
- _pipestatus \
- ${QA_INTERCEPTORS}
-
- # portage config variables and variables set directly by portage
- unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \
- DISTCC_DIR DISTDIR DOC_SYMLINKS_DIR \
- EBUILD_FORCE_TEST EBUILD_MASTER_PID \
- ECLASS_DEPTH ENDCOL FAKEROOTKEY \
- GOOD HILITE HOME \
- LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS MOPREFIX \
- NOCOLOR NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \
- PORTAGE_BASHRCS_SOURCED PORTAGE_NONFATAL PORTAGE_QUIET \
- PORTAGE_SANDBOX_DENY PORTAGE_SANDBOX_PREDICT \
- PORTAGE_SANDBOX_READ PORTAGE_SANDBOX_WRITE PREROOTPATH \
- QA_INTERCEPTORS \
- RC_DEFAULT_INDENT RC_DOT_PATTERN RC_ENDCOL RC_INDENTATION \
- ROOT ROOTPATH RPMDIR TEMP TMP TMPDIR USE_EXPAND \
- WARN XARGS _RC_GET_KV_CACHE
-
- # user config variables
- unset DOC_SYMLINKS_DIR INSTALL_MASK PKG_INSTALL_MASK
-
- declare -p
- declare -fp
- if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
- export
- fi
- )
-}
-
true