From 25a5296f29bc7153fa29e2dfe8de9d08d40d9944 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Thu, 13 Sep 2012 21:40:41 -0700 Subject: [PATCH] drop dead functions Specifically, esyslog, {un,}set_unless_changed, and remove_path_entry. --- bin/bashrc-functions.sh | 55 --------------------------------------- bin/ebuild.sh | 10 ++----- bin/isolated-functions.sh | 18 ------------- bin/save-ebuild-env.sh | 6 ++--- 4 files changed, 5 insertions(+), 84 deletions(-) diff --git a/bin/bashrc-functions.sh b/bin/bashrc-functions.sh index 4da558581..9fdf999fe 100644 --- a/bin/bashrc-functions.sh +++ b/bin/bashrc-functions.sh @@ -33,61 +33,6 @@ strip_duplicate_slashes() { fi } -# this is a function for removing any directory matching a passed in pattern from -# PATH -remove_path_entry() { - save_IFS - IFS=":" - stripped_path="${PATH}" - while [ -n "$1" ]; do - cur_path="" - for p in ${stripped_path}; do - if [ "${p/${1}}" == "${p}" ]; then - cur_path="${cur_path}:${p}" - fi - done - stripped_path="${cur_path#:*}" - shift - done - restore_IFS - PATH="${stripped_path}" -} - -# Set given variables unless these variable have been already set (e.g. during emerge -# invocation) to values different than values set in make.conf. -set_unless_changed() { - if [[ $# -lt 1 ]]; then - die "${FUNCNAME}() requires at least 1 argument: VARIABLE=VALUE" - fi - - local argument value variable - for argument in "$@"; do - if [[ ${argument} != *=* ]]; then - die "${FUNCNAME}(): Argument '${argument}' has incorrect syntax" - fi - variable="${argument%%=*}" - value="${argument#*=}" - if eval "[[ \${${variable}} == \$(env -u ${variable} portageq envvar ${variable}) ]]"; then - eval "${variable}=\"\${value}\"" - fi - done -} - -# Unset given variables unless these variable have been set (e.g. during emerge -# invocation) to values different than values set in make.conf. -unset_unless_changed() { - if [[ $# -lt 1 ]]; then - die "${FUNCNAME}() requires at least 1 argument: VARIABLE" - fi - - local variable - for variable in "$@"; do - if eval "[[ \${${variable}} == \$(env -u ${variable} portageq envvar ${variable}) ]]"; then - unset ${variable} - fi - done -} - KV_major() { [[ -z $1 ]] && return 1 diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 51e90d7cc..5178a3753 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -23,8 +23,8 @@ else for x in diropts docompress exeopts get_KV insopts \ keepdir KV_major KV_micro KV_minor KV_to_int \ libopts register_die_hook register_success_hook \ - remove_path_entry set_unless_changed strip_duplicate_slashes \ - unset_unless_changed use_with use_enable ; do + strip_duplicate_slashes \ + use_with use_enable ; do eval "${x}() { if has \"\${EAPI:-0}\" 4-python; then die \"\${FUNCNAME}() calls are not allowed in global scope\" @@ -136,12 +136,6 @@ fi # the sandbox is disabled by default except when overridden in the relevant stages export SANDBOX_ON=0 -esyslog() { - # Custom version of esyslog() to take care of the "Red Star" bug. - # MUST follow functions.sh to override the "" parameter problem. - return 0 -} - # Ensure that $PWD is sane whenever possible, to protect against # exploitation of insecure search path for python -c in ebuilds. # See bug #239560. diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 37e5f2de0..154506e67 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -294,24 +294,6 @@ elog() { return 0 } -esyslog() { - local pri= - local tag= - - if [ -x /usr/bin/logger ] - then - pri="$1" - tag="$2" - - shift 2 - [ -z "$*" ] && return 0 - - /usr/bin/logger -p "${pri}" -t "${tag}" -- "$*" - fi - - return 0 -} - einfo() { elog_base INFO "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh index 37438a5d9..6b38e5d9a 100644 --- a/bin/save-ebuild-env.sh +++ b/bin/save-ebuild-env.sh @@ -49,7 +49,7 @@ save_ebuild_env() { unset -f assert assert_sigpipe_ok \ dump_trace die \ quiet_mode vecho elog_base eqawarn elog \ - esyslog einfo einfon ewarn eerror ebegin _eend eend KV_major \ + 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 \ hasv hasq qa_source qa_call \ @@ -64,9 +64,9 @@ save_ebuild_env() { dyn_compile dyn_test dyn_install \ dyn_preinst dyn_pretend dyn_help debug-print debug-print-function \ debug-print-section helpers_die inherit EXPORT_FUNCTIONS \ - nonfatal register_success_hook remove_path_entry \ + nonfatal register_success_hook \ save_ebuild_env filter_readonly_variables preprocess_ebuild_env \ - set_unless_changed unset_unless_changed source_all_bashrcs \ + source_all_bashrcs \ ebuild_main ebuild_phase ebuild_phase_with_hooks \ _ebuild_arg_to_phase _ebuild_phase_funcs default \ _hasg _hasgq _unpack_tar \ -- 2.26.2