[elbe-devel] [PATCH 1/1] schema: allow empty debootstrapvariant

Torben Hohn torben.hohn at linutronix.de
Mon Jan 3 13:59:10 CET 2022


The default debootstrapvariant does not have a name. It can only
be specified by omitting the variant option.

In order to specify default variant and includepkgs, support for the
empty variant must be added.

Allow the empty variant in the dbsfed.xsd
Stop validate_xml() from choking when dbsv.text is None
Do not specify --variant, when the string is empty.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/rfs.py      | 3 ++-
 elbepack/validate.py | 2 +-
 schema/dbsfed.xsd    | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/elbepack/rfs.py b/elbepack/rfs.py
index c4d44d4e0..4c2f2a661 100644
--- a/elbepack/rfs.py
+++ b/elbepack/rfs.py
@@ -190,7 +190,8 @@ class BuildEnv:
         if self.xml.has("target/debootstrapvariant"):
             bootstrapvariant = self.xml.text("target/debootstrapvariant")
             includepkgs = self.xml.node("target/debootstrapvariant").et.get("includepkgs")
-            strapcmd += '--variant="%s" ' % bootstrapvariant
+            if bootstrapvariant != "":
+                strapcmd += '--variant="%s" ' % bootstrapvariant
 
         if includepkgs and not "gnupg" in includepkgs.split(','):
             includepkgs += ",gnupg"
diff --git a/elbepack/validate.py b/elbepack/validate.py
index e4dc7e7a2..247ea2cdf 100644
--- a/elbepack/validate.py
+++ b/elbepack/validate.py
@@ -64,7 +64,7 @@ def validate_xml_content(xml):
 
     dbsv = xml.find("/target/debootstrapvariant")
 
-    if (dbsv is not None and "minbase" in dbsv.text
+    if (dbsv is not None and "minbase" == dbsv.text
             and "gnupg" not in dbsv.get("includepkgs", "")
             and xml.find("/project/mirror/url-list/url/key") is not None):
 
diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
index 440b39e35..30e64ad60 100644
--- a/schema/dbsfed.xsd
+++ b/schema/dbsfed.xsd
@@ -1130,6 +1130,7 @@
       <enumeration value="minbase" />
       <enumeration value="buildd" />
       <enumeration value="fakechroot" />
+      <enumeration value="" />
     </restriction>
   </simpleType>
 
-- 
2.20.1



More information about the elbe-devel mailing list