Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] multibuild.eclass: Reap stray subjobs before exiting sub-phase
Date: Fri, 14 Apr 2017 16:34:27
Message-Id: 1492187495.14730.11.camel@gentoo.org
In Reply to: [gentoo-dev] [PATCH] multibuild.eclass: Reap stray subjobs before exiting sub-phase by "Michał Górny"
1 On czw, 2017-03-23 at 18:55 +0100, Michał Górny wrote:
2 > Alike the PMS-defined phases, sub-phases do not support leaving jobs
3 > behind. To avoid leaving something accidentally, make sure to reap all
4 > jobs (i.e. wait) post running the command. Warn if any stray processes
5 > are found since that indicates a bug in ebuild.
6 > ---
7 > eclass/multibuild.eclass | 12 ++++++++++++
8 > 1 file changed, 12 insertions(+)
9 >
10 > diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
11 > index 0f89e4ec0b83..a29218d8d840 100644
12 > --- a/eclass/multibuild.eclass
13 > +++ b/eclass/multibuild.eclass
14 > @@ -125,6 +125,18 @@ multibuild_foreach_variant() {
15 > _multibuild_run "${@}" \
16 > > >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1
17 > lret=${?}
18 > +
19 > + # make sure no processes are left over
20 > + local leftovers=
21 > + while :; do
22 > + wait -n
23 > + [[ ${?} -eq 127 ]] && break || leftovers=1
24 > + done
25 > +
26 > + if [[ ${leftovers} ]]; then
27 > + ewarn "The multibuild function has left one or more processes running"
28 > + ewarn "in the background. Please report a bug."
29 > + fi
30 > done
31 > [[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}
32 >
33
34 Merged.
35
36 --
37 Best regards,
38 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature