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

Torben Hohn torben.hohn at linutronix.de
Mon Feb 11 09:13:06 CET 2019


On Fri, Feb 08, 2019 at 04:23:02PM +0100, Manuel Traut wrote:
> 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?

short answer: it works ! v1 does not work.

long answer: build dependencies are resolved by pbuilder. When pbuilder
             does not know about build profiles (as is the case, if we
	     only pass the profile option through some generic machanism
	     to dpkg-buildpackage) it will pull the dependencies for the
	     default profile.
	     Andreas use case is to break a cyclic dependency using
	     profile nodoc.
> 
> > 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

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20190211/f3ed7f22/attachment.sig>


More information about the elbe-devel mailing list