[elbe-devel] [PATCH 3/4] pbuilder: add cross option to pbuilder
Torben Hohn
torben.hohn at linutronix.de
Thu Mar 12 12:10:50 CET 2020
On Tue, Mar 10, 2020 at 05:49:42PM +0100, Christian Teklenborg wrote:
> Add a '--cross' option to pbuilder with the 'store_true' action. The option
> defaults to False. Make sure that the stored boolean ends up in the
> elbeproject.
Please use options like SetPdebuilderAction:
--------------------------------------------------------------------------------------
class SetPdebuilderAction(ClientAction):
tag = 'set_pdebuild'
def __init__(self, node):
ClientAction.__init__(self, node)
def execute(self, client, opt, args):
size = 1024 * 1024
if len(args) != 2:
print("usage: elbe control set_pdebuild "
"<project_dir> <pdebuild file>", file=sys.stderr)
sys.exit(20)
builddir = args[0]
filename = args[1]
fp = open(filename, "r")
client.service.start_pdebuild(builddir)
while True:
bindata = fp.read(size)
client.service.append_pdebuild(
builddir, binascii.b2a_base64(bindata))
if len(bindata) != size:
break
client.service.finish_pdebuild(builddir, opt.cpuset, opt.profile)
ClientAction.register(SetPdebuilderAction)
--------------------------------------------------------------------------------------
add --cross to elbepack/commands/control.py too, please.
>
> Signed-off-by: Christian Teklenborg <chris at linutronix.de>
> ---
> elbepack/asyncworker.py | 5 +++--
> elbepack/commands/pbuilder.py | 4 ++++
> elbepack/daemons/soap/esoap.py | 6 +++---
> elbepack/pbuilderaction.py | 5 ++++-
> elbepack/projectmanager.py | 4 ++--
> elbepack/soapclient.py | 5 +++--
> 6 files changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
> index 2d2deeff..a988f38f 100644
> --- a/elbepack/asyncworker.py
> +++ b/elbepack/asyncworker.py
> @@ -239,8 +239,9 @@ class PdebuildJob(AsyncWorkerJob):
> db.reset_busy(self.project.builddir, success)
>
> class CreatePbuilderJob(AsyncWorkerJob):
> - def __init__(self, project):
> + def __init__(self, project, cross=False):
> AsyncWorkerJob.__init__(self, project)
> + self.cross = cross
>
> def enqueue(self, queue, db):
> db.set_busy(self.project.builddir,
> @@ -253,7 +254,7 @@ class CreatePbuilderJob(AsyncWorkerJob):
> success = self.build_failed
> try:
> logging.info("Building pbuilder started")
> - self.project.create_pbuilder()
> + self.project.create_pbuilder(self.cross)
> except Exception:
> logging.exception("Pbuilder failed")
> else:
> diff --git a/elbepack/commands/pbuilder.py b/elbepack/commands/pbuilder.py
> index 2e5f55d9..728201b7 100644
> --- a/elbepack/commands/pbuilder.py
> +++ b/elbepack/commands/pbuilder.py
> @@ -46,6 +46,10 @@ def run_command(argv):
> oparser.add_option("--profile", dest="profile", default="",
> help="profile that shall be built")
>
> + oparser.add_option("--cross", dest="cross", default=False,
> + action="store_true",
> + help="Crossbuilding packages using multiarch.")
> +
> 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 7d76d6a3..27025365 100644
> --- a/elbepack/daemons/soap/esoap.py
> +++ b/elbepack/daemons/soap/esoap.py
> @@ -227,12 +227,12 @@ class ESoap (ServiceBase):
> self.app.pm.build_current_project(uid, build_bin, build_src,
> skip_pbuilder)
>
> - @rpc(String)
> + @rpc(String, Integer)
Thats a Boolean not an Integer.
> @authenticated_uid
> @soap_faults
> - def build_pbuilder(self, uid, builddir):
> + def build_pbuilder(self, uid, builddir, cross):
> self.app.pm.open_project(uid, builddir)
> - self.app.pm.build_pbuilder(uid)
> + self.app.pm.build_pbuilder(uid, cross)
>
> @rpc(String)
> @authenticated_uid
> diff --git a/elbepack/pbuilderaction.py b/elbepack/pbuilderaction.py
> index 1a567a33..eb2afa1d 100644
> --- a/elbepack/pbuilderaction.py
> +++ b/elbepack/pbuilderaction.py
> @@ -67,6 +67,7 @@ class CreateAction(PBuilderAction):
> PBuilderAction.__init__(self, node)
>
> def execute(self, opt, _args):
> + cross = opt.cross
you dont need to assign opt.cross to cross.
>
> if opt.xmlfile:
> try:
> @@ -111,7 +112,9 @@ class CreateAction(PBuilderAction):
> print("Creating pbuilder")
>
> try:
> - system('%s control build_pbuilder "%s"' % (elbe_exe, prjdir))
> + system('%s control build_pbuilder "%s" "%s"' % (elbe_exe,
> + prjdir,
> + int(cross)))
please use --cross flag...
and just test opt.cross
if opt.cross:
crossopt = "--cross"
and insert it into the "control build_pbuilder" line.
> except CommandError:
> print("elbe control build_pbuilder Failed", file=sys.stderr)
> print("Giving up", file=sys.stderr)
> diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
> index f8ed894f..19cbe09e 100644
> --- a/elbepack/projectmanager.py
> +++ b/elbepack/projectmanager.py
> @@ -308,10 +308,10 @@ class ProjectManager(object):
> ep = self._get_current_project(userid, allow_busy=False)
> self.worker.enqueue(UpdatePbuilderJob(ep))
>
> - def build_pbuilder(self, userid):
> + def build_pbuilder(self, userid, cross):
> with self.lock:
> ep = self._get_current_project(userid, allow_busy=False)
> - self.worker.enqueue(CreatePbuilderJob(ep))
> + self.worker.enqueue(CreatePbuilderJob(ep, cross))
>
> def build_current_pdebuild(self, userid, cpuset, profile):
> with self.lock:
> diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
> index 589bdefd..2fad71c9 100644
> --- a/elbepack/soapclient.py
> +++ b/elbepack/soapclient.py
> @@ -753,14 +753,15 @@ class BuildPbuilderAction(ClientAction):
> ClientAction.__init__(self, node)
>
> def execute(self, client, _opt, args):
> - if len(args) != 1:
> + if len(args) != 2:
please use opt.cross
> print(
> "usage: elbe control build_pbuilder <project_dir>",
> file=sys.stderr)
> sys.exit(20)
>
> builddir = args[0]
> - client.service.build_pbuilder(builddir)
> + cross = args[1]
> + client.service.build_pbuilder(builddir, cross)
>
>
> ClientAction.register(BuildPbuilderAction)
> --
> 2.20.1
>
>
> _______________________________________________
> 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
More information about the elbe-devel
mailing list