done
}
-strip_duplicate_slashes() {
+__strip_duplicate_slashes() {
if [[ -n $1 ]] ; then
local removed=$1
while [[ ${removed} == *//* ]] ; do
".lzma" "unxz -f"
)
-multijob_init
+__multijob_init
for dir in "$@" ; do
dir=${dir#/}
# 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
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"
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} && \
rm -f "${log}"
fi
) &
- multijob_post_fork
+ __multijob_post_fork
fi
# Now we look for unstripped binaries.
fi
(
- multijob_child_init
+ __multijob_child_init
f=$(file "${x}") || exit 0
[[ -z ${f} ]] && exit 0
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 ]] && \
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
#
# 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.
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: <var> <file> [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
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 ))
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
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
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 -- \
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
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 \