[elbe-devel] [PATCH v2 3/5] pbuilder: allow passing the buildprofile with --profile option

Manuel Traut manut at linutronix.de
Fri Feb 8 16:23:02 CET 2019


On 00:57 Sat 02 Feb     , Torben Hohn wrote:
> pdebuild from jessie-backports allows to specify the DEB_BUILD_PROFILES
> env var.

what's better by using the env var instead of passing the option via
--debbuildopts as in v1?

> Add --profile option to 'elbe pbuilder' command, and pass the value
> through to elbe control -> soap -> asyncworker -> elbeproject -> pdebuild
> 
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
>  elbepack/asyncworker.py        |  5 +++--
>  elbepack/commands/control.py   |  3 +++
>  elbepack/commands/pbuilder.py  |  3 +++
>  elbepack/daemons/soap/esoap.py |  6 +++---
>  elbepack/elbeproject.py        | 11 ++++++-----
>  elbepack/pbuilderaction.py     |  6 ++++--
>  elbepack/projectmanager.py     |  4 ++--
>  elbepack/soapclient.py         |  2 +-
>  8 files changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
> index 7f6173ba..7b64a0d5 100644
> --- a/elbepack/asyncworker.py
> +++ b/elbepack/asyncworker.py
> @@ -215,9 +215,10 @@ class BuildJob(AsyncWorkerJob):
>  
>  
>  class PdebuildJob(AsyncWorkerJob):
> -    def __init__(self, project, cpuset=-1):
> +    def __init__(self, project, cpuset=-1, profile=""):
>          AsyncWorkerJob.__init__(self, project)
>          self.cpuset=cpuset
> +        self.profile=profile
>  
>      def enqueue(self, queue, db):
>          db.set_busy(self.project.builddir,
> @@ -229,7 +230,7 @@ class PdebuildJob(AsyncWorkerJob):
>      def execute(self, db):
>          try:
>              self.project.log.printo("Pdebuild started")
> -            self.project.pdebuild(self.cpuset)
> +            self.project.pdebuild(self.cpuset, self.profile)
>              db.update_project_files(self.project)
>              self.project.log.printo("Pdeb finished successfully")
>              db.reset_busy(self.project.builddir, "build_done")
> diff --git a/elbepack/commands/control.py b/elbepack/commands/control.py
> index 11855a00..cb539b70 100644
> --- a/elbepack/commands/control.py
> +++ b/elbepack/commands/control.py
> @@ -79,6 +79,9 @@ def run_command(argv):
>      oparser.add_option("--cpuset", default=-1, type="int",
>                         help="Limit cpuset of pbuilder commands (bitmask) (defaults to -1 for all CPUs)")
>  
> +    oparser.add_option("--profile", dest="profile", default="",
> +                       help="Make pbuilder commands build the specified profile")
> +
>      devel = OptionGroup(
>          oparser,
>          "options for elbe developers",
> diff --git a/elbepack/commands/pbuilder.py b/elbepack/commands/pbuilder.py
> index 5b8542d4..2e5f55d9 100644
> --- a/elbepack/commands/pbuilder.py
> +++ b/elbepack/commands/pbuilder.py
> @@ -43,6 +43,9 @@ def run_command(argv):
>                         help="Limit cpuset of pbuilder commands (bitmask) "
>                              "(defaults to -1 for all CPUs)")
>  
> +    oparser.add_option("--profile", dest="profile", default="",
> +                       help="profile that shall be built")
> +
>      PreprocessWrapper.add_options(oparser)
>  
>      (opt, args) = oparser.parse_args(argv)
> diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
> index e29d18a0..09fb45fb 100644
> --- a/elbepack/daemons/soap/esoap.py
> +++ b/elbepack/daemons/soap/esoap.py
> @@ -291,12 +291,12 @@ class ESoap (ServiceBase):
>          fp.write(binascii.a2b_base64(data))
>          fp.close()
>  
> -    @rpc(String, Integer)
> +    @rpc(String, Integer, String)
>      @authenticated_uid
>      @soap_faults
> -    def finish_pdebuild(self, uid, builddir, cpuset):
> +    def finish_pdebuild(self, uid, builddir, cpuset, profile):
>          self.app.pm.open_project(uid, builddir)
> -        self.app.pm.build_current_pdebuild(uid, cpuset)
> +        self.app.pm.build_current_pdebuild(uid, cpuset, profile)
>  
>      @rpc(String, String)
>      @authenticated_uid
> diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
> index 709d9cb0..69f93df6 100644
> --- a/elbepack/elbeproject.py
> +++ b/elbepack/elbeproject.py
> @@ -353,7 +353,7 @@ class ElbeProject (object):
>              self.log.printo("unknown pbuild source vcs: %s" % p.tag)
>  
>          # pdebuild_build(-1) means use all cpus
> -        self.pdebuild_build(cpuset=-1)
> +        self.pdebuild_build(cpuset=-1, profile="")
>  
>      def build_cdroms(self, build_bin=True,
>                       build_sources=False, cdrom_size=None):
> @@ -602,7 +602,7 @@ class ElbeProject (object):
>          self.log.do('mkdir -p "%s"' % os.path.join(self.builddir,
>                                                     "pbuilder", "result"))
>  
> -    def pdebuild(self, cpuset):
> +    def pdebuild(self, cpuset, profile):
>          self.pdebuild_init()
>  
>          pbdir = os.path.join(self.builddir, "pdebuilder", "current")
> @@ -626,10 +626,10 @@ class ElbeProject (object):
>                  "current_pdebuild.tar.gz"),
>                  pbdir))
>  
> -        self.pdebuild_build(cpuset)
> +        self.pdebuild_build(cpuset, profile)
>          self.repo.finalize()
>  
> -    def pdebuild_build(self, cpuset):
> +    def pdebuild_build(self, cpuset, profile):
>          # check whether we have to use taskset to run pdebuild
>          # this might be useful, when things like java dont
>          # work with multithreading
> @@ -650,7 +650,8 @@ class ElbeProject (object):
>                              cpuset_cmd,
>                              cfg['pbuilder_jobs'],
>                              os.path.join(self.builddir, "pbuilderrc"),
> -                            os.path.join(self.builddir, "pbuilder", "result")))
> +                            os.path.join(self.builddir, "pbuilder", "result")),
> +                        env_add={'DEB_BUILD_PROFILES': profile})
>  
>              self.repo.remove(os.path.join(self.builddir,
>                                            "pdebuilder",
> diff --git a/elbepack/pbuilderaction.py b/elbepack/pbuilderaction.py
> index bd3d3afa..1a567a33 100644
> --- a/elbepack/pbuilderaction.py
> +++ b/elbepack/pbuilderaction.py
> @@ -244,8 +244,10 @@ class BuildAction(PBuilderAction):
>          print("")
>  
>          try:
> -            system('%s control set_pdebuild --cpuset "%d" "%s" "%s"' %
> -                   (elbe_exe, opt.cpuset, prjdir, tmp.fname("pdebuild.tar.gz")))
> +            system('%s control set_pdebuild --cpuset "%d" --profile "%s" '
> +                   '"%s" "%s"' %
> +                   (elbe_exe, opt.cpuset, opt.profile,
> +                    prjdir, tmp.fname("pdebuild.tar.gz")))
>          except CommandError:
>              print("elbe control set_pdebuild Failed", file=sys.stderr)
>              print("Giving up", file=sys.stderr)
> diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
> index e8613bca..7738ee28 100644
> --- a/elbepack/projectmanager.py
> +++ b/elbepack/projectmanager.py
> @@ -314,14 +314,14 @@ class ProjectManager(object):
>              ep = self._get_current_project(userid, allow_busy=False)
>              self.worker.enqueue(CreatePbuilderJob(ep))
>  
> -    def build_current_pdebuild(self, userid, cpuset):
> +    def build_current_pdebuild(self, userid, cpuset, profile):
>          with self.lock:
>              ep = self._get_current_project(userid, allow_busy=False)
>              if not path.isdir(path.join(ep.builddir, "pbuilder")):
>                  raise InvalidState('No pbuilder exists: run "elbe pbuilder '
>                                     'create --project %s" first' % ep.builddir)
>  
> -            self.worker.enqueue(PdebuildJob(ep, cpuset))
> +            self.worker.enqueue(PdebuildJob(ep, cpuset, profile))
>  
>      def set_orig_fname(self, userid, fname):
>          with self.lock:
> diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
> index a65af8d0..a5b26500 100644
> --- a/elbepack/soapclient.py
> +++ b/elbepack/soapclient.py
> @@ -745,7 +745,7 @@ class SetPdebuilderAction(ClientAction):
>              if len(bindata) != size:
>                  break
>  
> -        client.service.finish_pdebuild(builddir, opt.cpuset)
> +        client.service.finish_pdebuild(builddir, opt.cpuset, opt.profile)
>  
>  
>  ClientAction.register(SetPdebuilderAction)
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel



More information about the elbe-devel mailing list