[elbe-devel] [PATCH 2/3] allow building cdroms via soap interface

John Ogness john.ogness at linutronix.de
Fri Jul 20 16:37:57 CEST 2018


On 2018-07-12, Manuel Traut <manut at linutronix.de> wrote:
> this exports the build_cdrom function via SOAP.
>
> If it is called after build_sysroot, the sysroot packages should also be
> part of the cdroms.
>
> Signed-off-by: Manuel Traut <manut at linutronix.de>
> ---
>  elbepack/asyncworker.py        | 26 ++++++++++++++++++++++++++
>  elbepack/daemons/soap/esoap.py |  7 +++++++
>  elbepack/projectmanager.py     |  7 ++++++-
>  elbepack/soapclient.py         | 27 +++++++++++++++++++++++++++

Please update docs/elbe-control.txt with this patch.

>  4 files changed, 66 insertions(+), 1 deletion(-)
>
> diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
> index 75be989c..d4d00ccd 100644
> --- a/elbepack/asyncworker.py
> +++ b/elbepack/asyncworker.py
> @@ -81,6 +81,32 @@ class BuildSDKJob(AsyncWorkerJob):
>              db.reset_busy(self.project.builddir, "build_failed")
>  
>  
> +class BuildCDROMsJob(AsyncWorkerJob):
> +    def __init__(self, project, build_bin, build_src):
> +        AsyncWorkerJob.__init__(self, project)
> +        self.build_bin = build_bin
> +        self.build_src = build_src
> +
> +    def enqueue(self, queue, db):
> +        db.set_busy(self.project.builddir,
> +                    ["empty_project", "needs_build", "has_changes",
> +                     "build_done", "build_failed"])
> +        self.project.log.printo("Enqueueing project for building CDROMs")
> +        AsyncWorkerJob.enqueue(self, queue, db)
> +
> +    def execute(self, db):
> +        try:
> +            self.project.log.printo("Build CDROMs started")
> +            self.project.build_cdroms(self.build_bin, self.build_src)
> +            db.update_project_files(self.project)
> +            self.project.log.printo("Build finished successfully")
> +            db.reset_busy(self.project.builddir, "build_done")
> +        except Exception as e:
> +            db.update_project_files(self.project)
> +            self.project.log.printo("Build CDROMs failed")
> +            self.project.log.printo(traceback.format_exc())
> +            db.reset_busy(self.project.builddir, "build_failed")
> +
>  class BuildChrootTarJob(AsyncWorkerJob):
>      def __init__(self, project):
>          AsyncWorkerJob.__init__(self, project)
> diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
> index a42cef7a..102faef2 100644
> --- a/elbepack/daemons/soap/esoap.py
> +++ b/elbepack/daemons/soap/esoap.py
> @@ -152,6 +152,13 @@ class ESoap (ServiceBase):
>          self.app.pm.open_project(uid, builddir)
>          self.app.pm.build_sdk(uid)
>  
> +    @rpc(String, Boolean, Boolean)
> +    @authenticated_uid
> +    @soap_faults
> +    def build_cdroms(self, uid, builddir, build_bin, build_src):
> +        self.app.pm.open_project(uid, builddir)
> +        self.app.pm.build_cdroms(uid, build_bin, build_src)
> +
>      @rpc(String, Boolean, Boolean, Boolean)
>      @authenticated_uid
>      @soap_faults
> diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
> index 60d76659..4ab310ca 100644
> --- a/elbepack/projectmanager.py
> +++ b/elbepack/projectmanager.py
> @@ -22,7 +22,7 @@ from elbepack.asyncworker import (AsyncWorker, BuildJob, APTUpdateJob,
>                                    APTUpdUpgrJob, BuildSysrootJob,
>                                    PdebuildJob, CreatePbuilderJob,
>                                    UpdatePbuilderJob, BuildChrootTarJob,
> -                                  BuildSDKJob)
> +                                  BuildSDKJob, BuildCDROMsJob)
>  
>  from elbepack.elbexml import ValidationMode
>  
> @@ -354,6 +354,11 @@ class ProjectManager(object):
>              ep = self._get_current_project(userid, allow_busy=False)
>              self.worker.enqueue(BuildSDKJob(ep))
>  
> +    def build_cdroms(self, userid, build_bin, build_src):
> +        with self.lock:
> +            ep = self._get_current_project(userid, allow_busy=False)
> +            self.worker.enqueue(BuildCDROMsJob(ep, build_bin, build_src))
> +
>      def build_update_package(self, userid, base_version):
>          with self.lock:
>              c = self._get_current_project_apt_cache(userid)
> diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
> index f91081a9..fbb29a97 100644
> --- a/elbepack/soapclient.py
> +++ b/elbepack/soapclient.py
> @@ -390,6 +390,33 @@ class BuildSDKAction(ClientAction):
>  ClientAction.register(BuildSDKAction)
>  
>  
> +class BuildCDROMsAction(ClientAction):
> +
> +    tag = 'build_cdroms'
> +
> +    def __init__(self, node):
> +        ClientAction.__init__(self, node)
> +
> +    def execute(self, client, opt, args):
> +        if len(args) != 1:
> +            print(
> +                "usage: elbe control build-cdroms [--build-bin|--build-sources] <project_dir>",
> +                file=sys.stderr)
> +            sys.exit(20)
> +
> +        if (not opt.build_bin) and (not opt.build_sources):
> +            print(
> +                "usage: elbe control build-cdroms [--build-bin|--build-sources] <project_dir>",
> +                file=sys.stderr)
> +            sys.exit(20)
> +
> +        builddir = args[0]
> +        client.service.build_cdroms(builddir, opt.build_bin, opt.build_sources)
> +
> +
> +ClientAction.register(BuildCDROMsAction)
> +
> +
>  class GetFileAction(ClientAction):
>  
>      tag = 'get_file'



More information about the elbe-devel mailing list