[elbe-devel] [PATCH] pbuilderaction: call elbe preprocess before submitting xmlfile in create
Torben Hohn
torben.hohn at linutronix.de
Fri Sep 7 09:17:38 CEST 2018
archivedir feature is handled in elbe preprocess. When an xml
with archivedir is submitted via "elbe pbuilder create --xmlfile=a.xml"
preprocess is not called, and validation inside the initvm fails.
call "elbe preprocess" and submit the tmpfile, that is produced.
Fixes: #177
Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
elbepack/pbuilderaction.py | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/elbepack/pbuilderaction.py b/elbepack/pbuilderaction.py
index a161a7bf..2f9948fd 100644
--- a/elbepack/pbuilderaction.py
+++ b/elbepack/pbuilderaction.py
@@ -9,6 +9,8 @@ from __future__ import print_function
import sys
import os
+from tempfile import NamedTemporaryFile
+
from elbepack.directories import elbe_exe
from elbepack.shellhelper import CommandError, system, command_out_stderr
from elbepack.filesystem import TmpdirFilesystem
@@ -68,6 +70,16 @@ class CreateAction(PBuilderAction):
def execute(self, opt, _args):
if opt.xmlfile:
+ outxml = NamedTemporaryFile(prefix='elbe', suffix='xml')
+ cmd = '%s preprocess -o %s %s' % (elbe_exe, outxml.name, opt.xmlfile)
+ ret, _, err = command_out_stderr(cmd)
+ if ret != 0:
+ print("elbe preprocess failed.", file=sys.stderr)
+ print(err, file=sys.stderr)
+ print("Giving up", file=sys.stderr)
+ sys.exit(20)
+ xmlfile = outxml.name
+
ret, prjdir, err = command_out_stderr(
'%s control create_project' % (elbe_exe))
if ret != 0:
@@ -79,7 +91,7 @@ class CreateAction(PBuilderAction):
prjdir = prjdir.strip()
ret, _, err = command_out_stderr(
'%s control set_xml "%s" "%s"' %
- (elbe_exe, prjdir, opt.xmlfile))
+ (elbe_exe, prjdir, xmlfile))
if ret != 0:
print("elbe control set_xml failed.", file=sys.stderr)
--
2.11.0
More information about the elbe-devel
mailing list