[elbe-devel] [PATCH v2] allow building cdroms via soap interface

John Ogness john.ogness at linutronix.de
Mon Jul 30 10:46:09 CEST 2018


On 2018-07-23, 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>

Reviewed-by: John Ogness <john.ogness at linutronix.de>

> ---
>
> changes since v1:
>
>  * added newly introduced subcommand to elbe-control docs
>
>  docs/elbe-control.txt          |  8 ++++++++
>  elbepack/asyncworker.py        | 26 ++++++++++++++++++++++++++
>  elbepack/daemons/soap/esoap.py |  7 +++++++
>  elbepack/projectmanager.py     |  7 ++++++-
>  elbepack/soapclient.py         | 27 +++++++++++++++++++++++++++
>  5 files changed, 74 insertions(+), 1 deletion(-)
>
> diff --git a/docs/elbe-control.txt b/docs/elbe-control.txt
> index 55bf694a..44ac28c1 100644
> --- a/docs/elbe-control.txt
> +++ b/docs/elbe-control.txt
> @@ -12,6 +12,7 @@ SYNOPSIS
>  'elbe control' [options] 'list_projects'
>  'elbe control' [options] 'create_project'
>  'elbe control' [options] 'build_sysroot' <build-dir>
> +'elbe control' [options] 'build_cdroms' <build-dir>
>  'elbe control' [options] 'set_pdebuild' <project-dir> <pdebuild file>
>  'elbe control' [options] 'get_files' <build-dir>
>  'elbe control' [options] 'build_chroot_tarball' <build-dir>
> @@ -99,6 +100,13 @@ Build a sysroot for the specified project.
>  The sysroot can be used with a toolchain for cross-compiles.
>  
>  
> +'build_cdroms' <build-dir>::
> +
> +Build ISO images containing the Debian binary or source packages used by the
> +given build-dir. Either --build-bin or --build-sources or both needs to be
> +specified.
> +
> +
>  'set_pdebuild' <build-dir> <pdebuild file>
>  
>  Build a Debian Project using a pbuilder.
> 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