public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] multibuild.eclass: Reap stray subjobs before exiting sub-phase
@ 2017-03-23 17:55 Michał Górny
  2017-04-14 16:31 ` Michał Górny
  0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2017-03-23 17:55 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Alike the PMS-defined phases, sub-phases do not support leaving jobs
behind. To avoid leaving something accidentally, make sure to reap all
jobs (i.e. wait) post running the command. Warn if any stray processes
are found since that indicates a bug in ebuild.
---
 eclass/multibuild.eclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
index 0f89e4ec0b83..a29218d8d840 100644
--- a/eclass/multibuild.eclass
+++ b/eclass/multibuild.eclass
@@ -125,6 +125,18 @@ multibuild_foreach_variant() {
 		_multibuild_run "${@}" \
 			> >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1
 		lret=${?}
+
+		# make sure no processes are left over
+		local leftovers=
+		while :; do
+			wait -n
+			[[ ${?} -eq 127 ]] && break || leftovers=1
+		done
+
+		if [[ ${leftovers} ]]; then
+			ewarn "The multibuild function has left one or more processes running"
+			ewarn "in the background. Please report a bug."
+		fi
 	done
 	[[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}
 
-- 
2.12.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] [PATCH] multibuild.eclass: Reap stray subjobs before exiting sub-phase
  2017-03-23 17:55 [gentoo-dev] [PATCH] multibuild.eclass: Reap stray subjobs before exiting sub-phase Michał Górny
@ 2017-04-14 16:31 ` Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2017-04-14 16:31 UTC (permalink / raw)
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]

On czw, 2017-03-23 at 18:55 +0100, Michał Górny wrote:
> Alike the PMS-defined phases, sub-phases do not support leaving jobs
> behind. To avoid leaving something accidentally, make sure to reap all
> jobs (i.e. wait) post running the command. Warn if any stray processes
> are found since that indicates a bug in ebuild.
> ---
>  eclass/multibuild.eclass | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
> index 0f89e4ec0b83..a29218d8d840 100644
> --- a/eclass/multibuild.eclass
> +++ b/eclass/multibuild.eclass
> @@ -125,6 +125,18 @@ multibuild_foreach_variant() {
>  		_multibuild_run "${@}" \
>  			> >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1
>  		lret=${?}
> +
> +		# make sure no processes are left over
> +		local leftovers=
> +		while :; do
> +			wait -n
> +			[[ ${?} -eq 127 ]] && break || leftovers=1
> +		done
> +
> +		if [[ ${leftovers} ]]; then
> +			ewarn "The multibuild function has left one or more processes running"
> +			ewarn "in the background. Please report a bug."
> +		fi
>  	done
>  	[[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}
>  

Merged.

-- 
Best regards,
Michał Górny

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-14 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23 17:55 [gentoo-dev] [PATCH] multibuild.eclass: Reap stray subjobs before exiting sub-phase Michał Górny
2017-04-14 16:31 ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox