[elbe-devel] [PATCH] elbepack: check-build: validate source.xml schema

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Jun 17 12:01:55 CEST 2024


Add "elbe check-build schema" subcommand which validates the built
source.xml against the schema.

Also run that check automatically during unittests.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/commands/check-build.py | 7 +++++++
 elbepack/tests/test_xml.py       | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/elbepack/commands/check-build.py b/elbepack/commands/check-build.py
index 6e2480571562..d1120b8f41bb 100644
--- a/elbepack/commands/check-build.py
+++ b/elbepack/commands/check-build.py
@@ -107,6 +107,13 @@ class CheckBase:
         raise CheckException(reason)
 
 
+ at CheckBase.register('schema')
+class CheckSchema(CheckBase):
+
+    def run(self):
+        run_elbe(['validate', self.directory / 'source.xml'])
+
+
 @CheckBase.register('cdrom')
 class CheckCdroms(CheckBase):
 
diff --git a/elbepack/tests/test_xml.py b/elbepack/tests/test_xml.py
index 012d8aa00f06..ec63a1957e66 100644
--- a/elbepack/tests/test_xml.py
+++ b/elbepack/tests/test_xml.py
@@ -41,7 +41,7 @@ def simple_build(request, tmp_path_factory):
 
 
 @pytest.mark.slow
- at pytest.mark.parametrize('check_build', ('cdrom', 'img', 'sdk', 'rebuild'))
+ at pytest.mark.parametrize('check_build', ('schema', 'cdrom', 'img', 'sdk', 'rebuild'))
 def test_simple_build(simple_build, check_build):
     run_elbe(['check-build', check_build, simple_build], check=True)
 

---
base-commit: 57e78fd9799390ee5ac56d14a37980415ab11c7c
change-id: 20240617-check-build-schema-b07d8e376a9d

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list