[elbe-devel] [PATCH 3/3] Use archivedir support in elbe preprocess

Benedikt Spranger b.spranger at linutronix.de
Thu Jul 5 10:44:37 CEST 2018


Plug in the newly introduced <archivedir> support in elbe preprocess.
Among other preprocessing elbe preprocess iterates over all
<archivedir> nodes, process the content of the referenced archives and
replace all <archivedir> nodes by a single combined <archive>.

Signed-off-by: Benedikt Spranger <b.spranger at linutronix.de>
Reviewed-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/xmlpreprocess.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/elbepack/xmlpreprocess.py b/elbepack/xmlpreprocess.py
index 7b5a5488..7697730e 100644
--- a/elbepack/xmlpreprocess.py
+++ b/elbepack/xmlpreprocess.py
@@ -8,6 +8,7 @@ import sys
 import re
 from lxml import etree
 from lxml.etree import XMLParser, parse
+from elbepack.archivedir import ArchivedirError, combinearchivedir
 
 # list of sections that are allowed to exists multiple times before
 # preprocess and that childrens are merge into one section during preprocess
@@ -78,6 +79,9 @@ def xmlpreprocess(fname, output, variants=[]):
                     mergenodes[0].append (c)
                 section.getparent().remove(section)
 
+        # handle archivedir elements
+        xml = combinearchivedir(xml)
+
         if schema.validate(xml):
             # if validation succedes write xml file
             xml.write(
@@ -90,6 +94,9 @@ def xmlpreprocess(fname, output, variants=[]):
 
     except etree.XMLSyntaxError:
         raise XMLPreprocessError("XML Parse error\n" + str(sys.exc_info()[1]))
+    except ArchivedirError:
+        raise XMLPreprocessError("<archivedir> handling failed\n" +
+                                     str(sys.exc_info()[1]))
     except BaseException:
         raise XMLPreprocessError(
             "Unknown Exception during validation\n" + str(sys.exc_info()[1]))
-- 
2.18.0




More information about the elbe-devel mailing list