[elbe-devel] [PATCH 2/2] Fix xml catalog

Philipp Arras philipp.arras at linutronix.de
Thu Jun 8 11:48:10 CEST 2017


Add local scheme to python environment. This change is required such that
Elbe xml validation works also in networks behind proxy servers.
---
 debian/catalog.xml             | 18 ------------------
 debian/elbe-common.xmlcatalogs |  5 +++--
 elbepack/directories.py        |  7 +++++++
 schema/catalog.xml             | 18 ++++++++++++++++++
 4 files changed, 28 insertions(+), 20 deletions(-)
 delete mode 100644 debian/catalog.xml
 create mode 100644 schema/catalog.xml

diff --git a/debian/catalog.xml b/debian/catalog.xml
deleted file mode 100644
index d9f8377..0000000
--- a/debian/catalog.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.0//EN"
-  "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
-
-<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
-  <system systemId="http://www.w3.org/2001/03/xml.xsd"
-	  uri="xml.xsd"/>
-
-  <rewriteSystem systemIdStartString="http://www.w3.org/2001/03/"
-		 rewritePrefix="./"/>
-
-  <system systemId="https://www.linutronix.de/projects/Elbe/dbsfed.xsd"
-	  uri="dbsfed.xsd"/>
-
-  <rewriteSystem systemIdStartString="https://www.linutronix.de/projects/Elbe"
-		 rewritePrefix="./"/>
-
-</catalog>
diff --git a/debian/elbe-common.xmlcatalogs b/debian/elbe-common.xmlcatalogs
index b398c40..628ba78 100644
--- a/debian/elbe-common.xmlcatalogs
+++ b/debian/elbe-common.xmlcatalogs
@@ -1,4 +1,5 @@
-local;debian/catalog.xml;/usr/share/xml/elbe-common/catalog.xml
+local;schema/catalog.xml;/usr/share/xml/elbe-common/catalog.xml
 root-and-package;public;https://www.linutronix.de/projects/Elbe;/usr/share/xml/elbe-common/catalog.xml
 root-and-package;system;https://www.linutronix.de/projects/Elbe/dbsfed.xsd;/usr/share/xml/elbe-common/catalog.xml
-root-and-package;public;http://www.w3.org/XML/1998/namespace;/usr/share/xml/elbe-common/catalog.xml
+root-and-package;public;http://www.w3.org/2001/03;/usr/share/xml/elbe-common/catalog.xml
+root-and-package;system;http://www.w3.org/2001/03/xml.xsd;/usr/share/xml/elbe-common/catalog.xml
diff --git a/elbepack/directories.py b/elbepack/directories.py
index 4e703c4..2200215 100644
--- a/elbepack/directories.py
+++ b/elbepack/directories.py
@@ -37,6 +37,13 @@ def init_directories(elbe_relpath):
     else:
         examples_dir = os.path.join (elbe_dir, "examples")
 
+        # Set XML catalog if elbe is run from source
+        xmlcat = os.path.join(elbe_dir, "schema/catalog.xml")
+        if os.environ.get('XML_CATALOG_FILES') is None:
+            os.environ['XML_CATALOG_FILES'] = xmlcat
+        else:
+            os.environ['XML_CATALOG_FILES'] += " "
+            os.environ['XML_CATALOG_FILES'] += xmlcat
 
 def get_cmdlist():
     return [ x for _, x, _ in iter_modules(elbepack.commands.__path__) ]
diff --git a/schema/catalog.xml b/schema/catalog.xml
new file mode 100644
index 0000000..d9f8377
--- /dev/null
+++ b/schema/catalog.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.0//EN"
+  "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
+  <system systemId="http://www.w3.org/2001/03/xml.xsd"
+	  uri="xml.xsd"/>
+
+  <rewriteSystem systemIdStartString="http://www.w3.org/2001/03/"
+		 rewritePrefix="./"/>
+
+  <system systemId="https://www.linutronix.de/projects/Elbe/dbsfed.xsd"
+	  uri="dbsfed.xsd"/>
+
+  <rewriteSystem systemIdStartString="https://www.linutronix.de/projects/Elbe"
+		 rewritePrefix="./"/>
+
+</catalog>
-- 
2.1.4





More information about the elbe-devel mailing list