From a23d0f4432abcfd1ebe4f2a3961185ca653ff2e0 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Thu, 13 Sep 2012 21:41:04 -0700 Subject: Convert funcs of bashrc-functions.sh to __ prefixed namespace. --- bin/bashrc-functions.sh | 2 +- bin/ebuild-helpers/ecompressdir | 8 ++++---- bin/ebuild-helpers/prepstrip | 12 ++++++------ bin/ebuild.sh | 2 +- bin/helper-functions.sh | 26 +++++++++++++------------- bin/phase-helpers.sh | 8 ++++---- bin/save-ebuild-env.sh | 2 +- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/bin/bashrc-functions.sh b/bin/bashrc-functions.sh index 9fdf999fe..30a7a8e1e 100644 --- a/bin/bashrc-functions.sh +++ b/bin/bashrc-functions.sh @@ -23,7 +23,7 @@ register_success_hook() { done } -strip_duplicate_slashes() { +__strip_duplicate_slashes() { if [[ -n $1 ]] ; then local removed=$1 while [[ ${removed} == *//* ]] ; do diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir index 6801a07d4..5ca0d3a35 100755 --- a/bin/ebuild-helpers/ecompressdir +++ b/bin/ebuild-helpers/ecompressdir @@ -133,7 +133,7 @@ decompressors=( ".lzma" "unxz -f" ) -multijob_init +__multijob_init for dir in "$@" ; do dir=${dir#/} @@ -161,14 +161,14 @@ for dir in "$@" ; do # ends up launching less compressors overall, so the overhead # of forking children ends up dominating. ( - multijob_child_init + __multijob_child_init funk_up_dir "decompress" "${decompressors[i]}" "${decompressors[i+1]}" ) & - multijob_post_fork + __multijob_post_fork : $(( ret |= $? )) done - multijob_finish + __multijob_finish : $(( ret |= $? )) # forcibly break all hard links as some compressors whine about it diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip index 5f87482cd..2556ee240 100755 --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@ -62,7 +62,7 @@ prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF} type -P debugedit >/dev/null && debugedit_found=true || debugedit_found=false debugedit_warned=false -multijob_init +__multijob_init # Setup $T filesystem layout that we care about. tmpdir="${T}/prepstrip" @@ -206,7 +206,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then log=${tmpdir}/scanelf-already-stripped.log scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "${log}" ( - multijob_child_init + __multijob_child_init qa_var="QA_PRESTRIPPED_${ARCH/-/_}" [[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}" if [[ -n ${QA_PRESTRIPPED} && -s ${log} && \ @@ -228,7 +228,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then rm -f "${log}" fi ) & - multijob_post_fork + __multijob_post_fork fi # Now we look for unstripped binaries. @@ -242,7 +242,7 @@ do fi ( - multijob_child_init + __multijob_child_init f=$(file "${x}") || exit 0 [[ -z ${f} ]] && exit 0 @@ -292,12 +292,12 @@ do chmod u-w "${x}" fi ) & - multijob_post_fork + __multijob_post_fork done # With a bit more work, we could run the rsync processes below in # parallel, but not sure that'd be an overall improvement. -multijob_finish +__multijob_finish cd "${tmpdir}"/sources/ && cat * > "${tmpdir}/debug.sources" 2>/dev/null if [[ -s ${tmpdir}/debug.sources ]] && \ diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 5178a3753..c6f267669 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -23,7 +23,7 @@ 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 \ - strip_duplicate_slashes \ + __strip_duplicate_slashes \ use_with use_enable ; do eval "${x}() { if has \"\${EAPI:-0}\" 4-python; then diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh index c7400fa4b..65f41f6d0 100644 --- a/bin/helper-functions.sh +++ b/bin/helper-functions.sh @@ -10,42 +10,42 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh # # API functions for doing parallel processing # -numjobs() { +__numjobs() { # Copied from eutils.eclass:makeopts_jobs() local jobs=$(echo " ${MAKEOPTS} " | \ sed -r -n 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p') echo ${jobs:-1} } -multijob_init() { +__multijob_init() { # Setup a pipe for children to write their pids to when they finish. mj_control_pipe=$(mktemp -t multijob.XXXXXX) rm "${mj_control_pipe}" mkfifo "${mj_control_pipe}" - redirect_alloc_fd mj_control_fd "${mj_control_pipe}" + __redirect_alloc_fd mj_control_fd "${mj_control_pipe}" rm -f "${mj_control_pipe}" # See how many children we can fork based on the user's settings. - mj_max_jobs=$(numjobs) + mj_max_jobs=$(__numjobs) mj_num_jobs=0 } -multijob_child_init() { +__multijob_child_init() { trap 'echo ${BASHPID} $? >&'${mj_control_fd} EXIT trap 'exit 1' INT TERM } -multijob_finish_one() { +__multijob_finish_one() { local pid ret read -r -u ${mj_control_fd} pid ret : $(( --mj_num_jobs )) return ${ret} } -multijob_finish() { +__multijob_finish() { local ret=0 while [[ ${mj_num_jobs} -gt 0 ]] ; do - multijob_finish_one + __multijob_finish_one : $(( ret |= $? )) done # Let bash clean up its internal child tracking state. @@ -53,21 +53,21 @@ multijob_finish() { return ${ret} } -multijob_post_fork() { +__multijob_post_fork() { : $(( ++mj_num_jobs )) if [[ ${mj_num_jobs} -ge ${mj_max_jobs} ]] ; then - multijob_finish_one + __multijob_finish_one fi return $? } -# @FUNCTION: redirect_alloc_fd +# @FUNCTION: __redirect_alloc_fd # @USAGE: [redirection] # @DESCRIPTION: # Find a free fd and redirect the specified file via it. Store the new # fd in the specified variable. Useful for the cases where we don't care # about the exact fd #. -redirect_alloc_fd() { +__redirect_alloc_fd() { local var=$1 file=$2 redir=${3:-"<>"} if [[ $(( (BASH_VERSINFO[0] << 8) + BASH_VERSINFO[1] )) -ge $(( (4 << 8) + 1 )) ]] ; then @@ -82,7 +82,7 @@ redirect_alloc_fd() { if [[ ! -e /dev/fd/${fd} ]] && [[ ! -L /dev/fd/${fd} ]] ; then eval "exec ${fd}${redir}'${file}'" && break fi - [[ ${fd} -gt 1024 ]] && die "redirect_alloc_fd failed" + [[ ${fd} -gt 1024 ]] && die "__redirect_alloc_fd failed" : $(( ++fd )) done : $(( ${var} = fd )) diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 555b2372b..106e26017 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -118,7 +118,7 @@ docompress() { if [[ $1 = "-x" ]]; then shift for f; do - f=$(strip_duplicate_slashes "${f}"); f=${f%/} + f=$(__strip_duplicate_slashes "${f}"); f=${f%/} [[ ${f:0:1} = / ]] || f="/${f}" for g in "${PORTAGE_DOCOMPRESS_SKIP[@]}"; do [[ ${f} = "${g}" ]] && continue 2 @@ -127,7 +127,7 @@ docompress() { done else for f; do - f=$(strip_duplicate_slashes "${f}"); f=${f%/} + f=$(__strip_duplicate_slashes "${f}"); f=${f%/} [[ ${f:0:1} = / ]] || f="/${f}" for g in "${PORTAGE_DOCOMPRESS[@]}"; do [[ ${f} = "${g}" ]] && continue 2 @@ -476,7 +476,7 @@ econf() { CONF_PREFIX=${CONF_PREFIX#*=} [[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}" [[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}" - set -- --libdir="$(strip_duplicate_slashes ${CONF_PREFIX}${CONF_LIBDIR})" "$@" + set -- --libdir="$(__strip_duplicate_slashes ${CONF_PREFIX}${CONF_LIBDIR})" "$@" fi set -- \ @@ -521,7 +521,7 @@ einstall() { unset LIBDIR_VAR if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:+set}" = set ]; then EI_DESTLIBDIR="${D}/${CONF_PREFIX}/${CONF_LIBDIR}" - EI_DESTLIBDIR="$(strip_duplicate_slashes ${EI_DESTLIBDIR})" + EI_DESTLIBDIR="$(__strip_duplicate_slashes ${EI_DESTLIBDIR})" LOCAL_EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTALL}" unset EI_DESTLIBDIR fi diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh index 6b38e5d9a..c09ce5b59 100644 --- a/bin/save-ebuild-env.sh +++ b/bin/save-ebuild-env.sh @@ -56,7 +56,7 @@ save_ebuild_env() { addread addwrite adddeny addpredict _sb_append_var \ use usev useq has_version portageq \ best_version use_with use_enable register_die_hook \ - keepdir unpack strip_duplicate_slashes econf einstall \ + 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 \ -- cgit v1.2.3-1-g7c22