[elbe-devel] [PATCH 06/21] elbepack: pbuilder: call create_project() directly

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


Instead of going through "elbe control", call the create_project()
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 | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/elbepack/commands/pbuilder.py b/elbepack/commands/pbuilder.py
index 08c94eec1687..43582d989506 100644
--- a/elbepack/commands/pbuilder.py
+++ b/elbepack/commands/pbuilder.py
@@ -43,16 +43,8 @@ def _create(control, args):
     if args.xmlfile:
         with preprocess_file(args.xmlfile, variants=args.variants, sshport=args.sshport,
                              soapport=args.soapport) as preproc:
-            ps = run_elbe(['control', 'create_project'],
-                          capture_output=True, encoding='utf-8')
-            if ps.returncode != 0:
-                print('elbe control create_project failed.',
-                      file=sys.stderr)
-                print(ps.stderr, file=sys.stderr)
-                print('Giving up', file=sys.stderr)
-                sys.exit(152)
+            prjdir = control.service.new_project()
 
-            prjdir = ps.stdout.strip()
             ps = run_elbe(['control', 'set_xml', prjdir, preproc],
                           capture_output=True, encoding='utf-8')
 
@@ -128,15 +120,7 @@ def _build(control, args):
     tmp = TmpdirFilesystem()
 
     if args.xmlfile:
-        ps = run_elbe(['control', '--retries', '60', 'create_project', args.xmlfile],
-                      capture_output=True, encoding='utf-8')
-        if ps.returncode != 0:
-            print('elbe control create_project failed.', file=sys.stderr)
-            print(ps.stderr, file=sys.stderr)
-            print('Giving up', file=sys.stderr)
-            sys.exit(160)
-
-        prjdir = ps.stdout.strip()
+        prjdir = control.service.new_project()
 
         try:
             run_elbe(['control', 'build_pbuilder', prjdir], check=True)

-- 
2.46.0



More information about the elbe-devel mailing list