1 |
On Monday 14 May 2012 13:37:40 Mike Frysinger wrote: |
2 |
> On Monday 14 May 2012 04:44:12 Zac Medico wrote: |
3 |
> > http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b4fb |
4 |
> > a3 e9fa2e285244de491f57700978158c1838 |
5 |
> |
6 |
> should really fix it to make the code parallel safe rather than disabling |
7 |
> it completely. i'll work on that. |
8 |
|
9 |
this should make it parallel safe |
10 |
-mike |
11 |
|
12 |
--- a/bin/ebuild-helpers/prepstrip |
13 |
+++ b/bin/ebuild-helpers/prepstrip |
14 |
@@ -62,22 +62,13 @@ prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF} |
15 |
type -P debugedit >/dev/null && debugedit_found=true || debugedit_found=false |
16 |
debugedit_warned=false |
17 |
|
18 |
-disable_parallel=false |
19 |
-${FEATURES_splitdebug} && disable_parallel=true |
20 |
-${FEATURES_installsources} && \ |
21 |
- ! ${RESTRICT_installsources} && \ |
22 |
- ${debugedit_found} && disable_parallel=true |
23 |
- |
24 |
-if ${disable_parallel} ; then |
25 |
- # Disable parallel processing, in order to prevent interference with |
26 |
- # temp files like debug.sources or prepstrip.split.debug |
27 |
- numjobs() { |
28 |
- echo 1 |
29 |
- } |
30 |
-fi |
31 |
- |
32 |
multijob_init |
33 |
|
34 |
+# Setup $T filesystem layout that we care about. |
35 |
+tmpdir="${T}/prepstrip" |
36 |
+rm -rf "${tmpdir}" |
37 |
+mkdir -p "${tmpdir}"/{splitdebug,sources} |
38 |
+ |
39 |
unset ${!INODE_*} |
40 |
|
41 |
# Usage: inode_var_name: <file> |
42 |
@@ -112,11 +103,11 @@ save_elf_sources() { |
43 |
buildid=$(debugedit -i \ |
44 |
-b "${WORKDIR}" \ |
45 |
-d "${prepstrip_sources_dir}" \ |
46 |
- -l "${T}"/debug.sources \ |
47 |
+ -l "${tmpdir}/sources/${x##*/}.${BASHPID}" \ |
48 |
"${x}") |
49 |
} |
50 |
|
51 |
-# Usage: save_elf_debug <elf> |
52 |
+# Usage: save_elf_debug <elf> [splitdebug file] |
53 |
save_elf_debug() { |
54 |
${FEATURES_splitdebug} || return 0 |
55 |
|
56 |
@@ -125,6 +116,7 @@ save_elf_debug() { |
57 |
# twice in this path) in order for gdb's debug-file-directory |
58 |
# lookup to work correctly. |
59 |
local x=$1 |
60 |
+ local splitdebug=$2 |
61 |
local y=${ED}usr/lib/debug/${x:${#D}}.debug |
62 |
|
63 |
# dont save debug info twice |
64 |
@@ -137,8 +129,8 @@ save_elf_debug() { |
65 |
ln "${ED}usr/lib/debug/${!inode:${#D}}.debug" "${y}" |
66 |
else |
67 |
eval ${inode}=\${x} |
68 |
- if [[ -e ${T}/prepstrip.split.debug ]] ; then |
69 |
- mv "${T}"/prepstrip.split.debug "${y}" |
70 |
+ if [[ -n ${splitdebug} ]] ; then |
71 |
+ mv "${splitdebug}" "${y}" |
72 |
else |
73 |
local objcopy_flags="--only-keep-debug" |
74 |
${FEATURES_compressdebug} && objcopy_flags+=" --compress-debug-sections" |
75 |
@@ -175,11 +167,13 @@ process_elf() { |
76 |
if ${strip_this} ; then |
77 |
# see if we can split & strip at the same time |
78 |
if [[ -n ${SPLIT_STRIP_FLAGS} ]] ; then |
79 |
+ local shortname="${x##*/}.debug" |
80 |
+ local splitdebug="${tmpdir}/splitdebug/${shortname}.${BASHPID}" |
81 |
${STRIP} ${strip_flags} \ |
82 |
- -f "${T}"/prepstrip.split.debug \ |
83 |
- -F "${x##*/}.debug" \ |
84 |
+ -f "${splitdebug}" \ |
85 |
+ -F "${shortname}" \ |
86 |
"${x}" |
87 |
- save_elf_debug "${x}" |
88 |
+ save_elf_debug "${x}" "${splitdebug}" |
89 |
else |
90 |
save_elf_debug "${x}" |
91 |
${STRIP} ${strip_flags} "${x}" |
92 |
@@ -194,8 +188,8 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then |
93 |
# We need to do the non-stripped scan serially first before we turn around |
94 |
# and start stripping the files ourselves. The log parsing can be done in |
95 |
# parallel though. |
96 |
- log=$T/scanelf-already-stripped.log |
97 |
- scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "$log" |
98 |
+ log=${tmpdir}/scanelf-already-stripped.log |
99 |
+ scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "${log}" |
100 |
( |
101 |
multijob_child_init |
102 |
qa_var="QA_PRESTRIPPED_${ARCH/-/_}" |
103 |
@@ -286,9 +280,11 @@ do |
104 |
multijob_post_fork |
105 |
done |
106 |
|
107 |
-# Let jobs finish before processing ${T}/debug.sources |
108 |
+# With a bit more work, we could run the rsync processes below in |
109 |
+# parallel, but not sure that'd be an overall improvement. |
110 |
multijob_finish |
111 |
|
112 |
+cat "${tmpdir}"/sources/* > "${tmpdir}/debug.sources" 2>/dev/null |
113 |
if [[ -s ${T}/debug.sources ]] && \ |
114 |
${FEATURES_installsources} && \ |
115 |
! ${RESTRICT_installsources} && \ |