[OE-core] [PATCH 2/2] package_[deb|ipk]: improve multiprocess logic when creating deb/ipk packages
Joshua Lock
joshua.g.lock at linux.intel.com
Tue Sep 5 08:31:53 UTC 2017
On 04/09/17 22:35, leonardo.sandoval.gonzalez at linux.intel.com wrote:
> From: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
>
> Current implementation does not handle possible exceptions coming from child
> processes, the latter responsible for creating packages. With the aim to have more
> control, use pipes to communicate exceptions and stop package creation in case
> of failure.
>
> Helps to debug [YOCTO #12012].
>
> Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
> ---
> meta/classes/package_deb.bbclass | 36 +++++++++++++++++++++++++++++++++---
> meta/classes/package_ipk.bbclass | 36 +++++++++++++++++++++++++++++++++---
> 2 files changed, 66 insertions(+), 6 deletions(-)
>
<chop>
> diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
> index ec90996184..8439cda6dd 100644
> --- a/meta/classes/package_ipk.bbclass
> +++ b/meta/classes/package_ipk.bbclass
> @@ -17,7 +17,29 @@ OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKA
> OPKGLIBDIR = "${localstatedir}/lib"
>
> python do_package_ipk () {
> - from multiprocessing import Process
> + import multiprocessing
> + import traceback
> +
> + class IPKWritePkgProcess(multiprocessing.Process):
> + def __init__(self, *args, **kwargs):
> + multiprocessing.Process.__init__(self, *args, **kwargs)
> + self._pconn, self._cconn = multiprocessing.Pipe()
> + self._exception = None
> +
> + def run(self):
> + try:
> + multiprocessing.Process.run(self)
> + self._cconn.send(None)
> + except Exception as e:
> + tb = traceback.format_exc()
> + self._cconn.send((e, tb))
> +
> + @property
> + def exception(self):
> + if self._pconn.poll():
> + self._exception = self._pconn.recv()
> + return self._exception
> +
Other than the name is IPKWritePkgProcess the same as DebianWritePkgProcess?
If so, could we put a single WritePkgProcess class somewhere it can be
shared in lib/oe ?
Joshua
More information about the Openembedded-core
mailing list