summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-05-14 14:20:15 -0400
committerMike Frysinger <vapier@gentoo.org>2012-05-14 14:51:05 -0400
commit4941c3c674400116f118a9c75b520c3fd1a25490 (patch)
tree9c7f34475d5e25b3f81239621cbb7867dc1e8d8f
parent1ebf126ae221bb8bd78df07a92fc4608b24f6689 (diff)
downloadportage-4941c3c674400116f118a9c75b520c3fd1a25490.tar.gz
portage-4941c3c674400116f118a9c75b520c3fd1a25490.tar.bz2
portage-4941c3c674400116f118a9c75b520c3fd1a25490.zip
prepstrip: make splitdebug/installsources parallel safe
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rwxr-xr-xbin/ebuild-helpers/prepstrip44
1 files changed, 20 insertions, 24 deletions
diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 61249ac17..a58a83b87 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -62,22 +62,13 @@ prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF}
type -P debugedit >/dev/null && debugedit_found=true || debugedit_found=false
debugedit_warned=false
-disable_parallel=false
-${FEATURES_splitdebug} && disable_parallel=true
-${FEATURES_installsources} && \
- ! ${RESTRICT_installsources} && \
- ${debugedit_found} && disable_parallel=true
-
-if ${disable_parallel} ; then
- # Disable parallel processing, in order to prevent interference with
- # temp files like debug.sources or prepstrip.split.debug
- numjobs() {
- echo 1
- }
-fi
-
multijob_init
+# Setup $T filesystem layout that we care about.
+tmpdir="${T}/prepstrip"
+rm -rf "${tmpdir}"
+mkdir -p "${tmpdir}"/{splitdebug,sources}
+
unset ${!INODE_*}
# Usage: inode_var_name: <file>
@@ -112,11 +103,11 @@ save_elf_sources() {
buildid=$(debugedit -i \
-b "${WORKDIR}" \
-d "${prepstrip_sources_dir}" \
- -l "${T}"/debug.sources \
+ -l "${tmpdir}/sources/${x##*/}.${BASHPID}" \
"${x}")
}
-# Usage: save_elf_debug <elf>
+# Usage: save_elf_debug <elf> [splitdebug file]
save_elf_debug() {
${FEATURES_splitdebug} || return 0
@@ -125,6 +116,7 @@ save_elf_debug() {
# twice in this path) in order for gdb's debug-file-directory
# lookup to work correctly.
local x=$1
+ local splitdebug=$2
local y=${ED}usr/lib/debug/${x:${#D}}.debug
# dont save debug info twice
@@ -137,8 +129,8 @@ save_elf_debug() {
ln "${ED}usr/lib/debug/${!inode:${#D}}.debug" "${y}"
else
eval ${inode}=\${x}
- if [[ -e ${T}/prepstrip.split.debug ]] ; then
- mv "${T}"/prepstrip.split.debug "${y}"
+ if [[ -n ${splitdebug} ]] ; then
+ mv "${splitdebug}" "${y}"
else
local objcopy_flags="--only-keep-debug"
${FEATURES_compressdebug} && objcopy_flags+=" --compress-debug-sections"
@@ -175,11 +167,13 @@ process_elf() {
if ${strip_this} ; then
# see if we can split & strip at the same time
if [[ -n ${SPLIT_STRIP_FLAGS} ]] ; then
+ local shortname="${x##*/}.debug"
+ local splitdebug="${tmpdir}/splitdebug/${shortname}.${BASHPID}"
${STRIP} ${strip_flags} \
- -f "${T}"/prepstrip.split.debug \
- -F "${x##*/}.debug" \
+ -f "${splitdebug}" \
+ -F "${shortname}" \
"${x}"
- save_elf_debug "${x}"
+ save_elf_debug "${x}" "${splitdebug}"
else
save_elf_debug "${x}"
${STRIP} ${strip_flags} "${x}"
@@ -194,8 +188,8 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
# We need to do the non-stripped scan serially first before we turn around
# and start stripping the files ourselves. The log parsing can be done in
# parallel though.
- log=$T/scanelf-already-stripped.log
- scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "$log"
+ log=${tmpdir}/scanelf-already-stripped.log
+ scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "${log}"
(
multijob_child_init
qa_var="QA_PRESTRIPPED_${ARCH/-/_}"
@@ -286,9 +280,11 @@ do
multijob_post_fork
done
-# Let jobs finish before processing ${T}/debug.sources
+# 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
+cat "${tmpdir}"/sources/* > "${tmpdir}/debug.sources" 2>/dev/null
if [[ -s ${T}/debug.sources ]] && \
${FEATURES_installsources} && \
! ${RESTRICT_installsources} && \