[elbe-devel] [PATCH 08/21] elbepack: pbuilder: call build_pbuilder() directly

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Aug 6 11:18:06 CEST 2024


Instead of going through "elbe control", call the build_pbuilder()
method directly. This reuses existing connections and improves the error
reporting.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/commands/pbuilder.py | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/elbepack/commands/pbuilder.py b/elbepack/commands/pbuilder.py
index d27fd7c91b0f..4299b7cba26e 100644
--- a/elbepack/commands/pbuilder.py
+++ b/elbepack/commands/pbuilder.py
@@ -32,14 +32,6 @@ from elbepack.xmlpreprocess import preprocess_file
 @add_argument('--project', help='project directory on the initvm')
 @add_argument_sshport
 def _create(control, args):
-    crossopt = []
-    if args.cross:
-        crossopt = ['--cross']
-    if args.noccache:
-        ccacheopt = ['--no-ccache']
-    else:
-        ccacheopt = ['--ccache-size', args.ccachesize]
-
     if args.xmlfile:
         with preprocess_file(args.xmlfile, variants=args.variants, sshport=args.sshport,
                              soapport=args.soapport) as preproc:
@@ -66,13 +58,7 @@ def _create(control, args):
 
     print('Creating pbuilder')
 
-    try:
-        run_elbe(['control', 'build_pbuilder', prjdir, *crossopt, *ccacheopt],
-                 check=True)
-    except subprocess.CalledProcessError:
-        print('elbe control build_pbuilder Failed', file=sys.stderr)
-        print('Giving up', file=sys.stderr)
-        sys.exit(156)
+    control.service.build_pbuilder(prjdir, args.cross, args.noccache, args.ccachesize)
 
     control.wait_busy(prjdir)
 
@@ -117,12 +103,7 @@ def _build(control, args):
     if args.xmlfile:
         prjdir = control.service.new_project()
 
-        try:
-            run_elbe(['control', 'build_pbuilder', prjdir], check=True)
-        except subprocess.CalledProcessError:
-            print('elbe control build_pbuilder Failed', file=sys.stderr)
-            print('Giving up', file=sys.stderr)
-            sys.exit(161)
+        control.service.build_pbuilder(prjdir, args.cross, False, '10G')
 
         control.wait_busy(prjdir)
 

-- 
2.46.0



More information about the elbe-devel mailing list