Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Fri, 14 Apr 2017 16:28:14
Message-Id: 1492187272.e5e4a35151f64b423c4201a30270a236dab3bf58.mgorny@gentoo
1 commit: e5e4a35151f64b423c4201a30270a236dab3bf58
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 23 17:52:12 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 14 16:27:52 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5e4a351
7
8 multibuild.eclass: Reap stray subjobs before exiting sub-phase
9
10 Alike the PMS-defined phases, sub-phases do not support leaving jobs
11 behind. To avoid leaving something accidentally, make sure to reap all
12 jobs (i.e. wait) post running the command. Warn if any stray processes
13 are found since that indicates a bug in ebuild.
14
15 eclass/multibuild.eclass | 12 ++++++++++++
16 1 file changed, 12 insertions(+)
17
18 diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
19 index 0f89e4ec0b8..a29218d8d84 100644
20 --- a/eclass/multibuild.eclass
21 +++ b/eclass/multibuild.eclass
22 @@ -125,6 +125,18 @@ multibuild_foreach_variant() {
23 _multibuild_run "${@}" \
24 > >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1
25 lret=${?}
26 +
27 + # make sure no processes are left over
28 + local leftovers=
29 + while :; do
30 + wait -n
31 + [[ ${?} -eq 127 ]] && break || leftovers=1
32 + done
33 +
34 + if [[ ${leftovers} ]]; then
35 + ewarn "The multibuild function has left one or more processes running"
36 + ewarn "in the background. Please report a bug."
37 + fi
38 done
39 [[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}