summaryrefslogtreecommitdiffstats
path: root/bin/ebuild-helpers/prepstrip
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-05-11 12:36:22 -0400
committerMike Frysinger <vapier@gentoo.org>2012-05-12 00:09:34 -0400
commit76939c46aa2817bdbcea703432c52e5aa04160f9 (patch)
tree561409f067c048780846c069e836f69710e92bda /bin/ebuild-helpers/prepstrip
parent0098ee7395e2c9b35471a5c088eef1fa59946912 (diff)
downloadportage-76939c46aa2817bdbcea703432c52e5aa04160f9.tar.gz
portage-76939c46aa2817bdbcea703432c52e5aa04160f9.tar.bz2
portage-76939c46aa2817bdbcea703432c52e5aa04160f9.zip
prepstrip/ecompressdir: parallelize operations
Stealing some ideas from ferringb, add a new API for doing parallel processing in bash, and then deploy this with the stripping and compressing stages. For stripping coreutils which has about 100 ELFs, this brings time to strip down from ~7 seconds to ~0.7 seconds on my system. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'bin/ebuild-helpers/prepstrip')
-rwxr-xr-xbin/ebuild-helpers/prepstrip20
1 files changed, 16 insertions, 4 deletions
diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index daaa25250..09b0333d9 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -1,8 +1,8 @@
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
# avoid multiple calls to `has`. this creates things like:
# FEATURES_foo=false
@@ -62,6 +62,8 @@ 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
+
unset ${!INODE_*}
inode_var_name() {
@@ -171,6 +173,8 @@ process_elf() {
# We want to log already stripped binaries, as this may be a QA violation.
# They prevent us from getting the splitdebug data.
if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
+ (
+ multijob_child_init
log=$T/scanelf-already-stripped.log
qa_var="QA_PRESTRIPPED_${ARCH/-/_}"
[[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}"
@@ -193,6 +197,8 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
else
rm -f "$log"
fi
+ ) &
+ multijob_post_fork
fi
# Now we look for unstripped binaries.
@@ -205,8 +211,10 @@ do
banner=true
fi
- f=$(file "${x}") || continue
- [[ -z ${f} ]] && continue
+ (
+ multijob_child_init
+ f=$(file "${x}") || exit 0
+ [[ -z ${f} ]] && exit 0
if ! ${SKIP_STRIP} ; then
# The noglob funk is to support STRIP_MASK="/*/booga" and to keep
@@ -253,6 +261,8 @@ do
if ${was_not_writable} ; then
chmod u-w "${x}"
fi
+ ) &
+ multijob_post_fork
done
if [[ -s ${T}/debug.sources ]] && \
@@ -274,3 +284,5 @@ then
>> "$emptydir"/.keepdir
done < <(find "${D}${prepstrip_sources_dir}/" -type d -empty -print0)
fi
+
+multijob_finish