[elbe-devel] [PATCH v3 01/52] Add xmlpreprocessor for PGP Key URL

dion at linutronix.de dion at linutronix.de
Thu Jun 27 14:44:15 CEST 2019


From: Olivier Dion <dion at linutronix.de>

'mirror/url-list/url/key' is now deprecated.  It should be remove from
schema.  The preprocessor will get the PGP key and replace the 'key'
tag with a 'raw-key' tag.

Signed-off-by: Olivier Dion <dion at linutronix.de>
Reviewed-by: Torben Hohn <torben.hogn at linutronix.de>
---
 elbepack/xmlpreprocess.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/elbepack/xmlpreprocess.py b/elbepack/xmlpreprocess.py
index 3701c716..d9da5dda 100644
--- a/elbepack/xmlpreprocess.py
+++ b/elbepack/xmlpreprocess.py
@@ -8,6 +8,8 @@
 from __future__ import print_function
 
 import sys
+import urllib2
+
 from tempfile import NamedTemporaryFile
 from optparse import OptionGroup
 
@@ -31,10 +33,10 @@ class XMLPreprocessError(Exception):
 
 def preprocess_pgp_key(xml):
 
-    for key in xml.iterfind('project/mirror/url-list/url/key'):
+    for key in xml.iterfind('.//key'):
         print("[WARN] <key>%s</key> is deprecated.  You should use raw-key instead." % key.text)
         try:
-            keyurl = key.text.strip().replace('LOCALMACHINE', '10.0.2.2')
+            keyurl = key.text.strip().replace('LOCALMACHINE', 'localhost')
             myKey = urllib2.urlopen(keyurl).read()
             key.tag = "raw-key"
             key.text = "\n%s\n" % myKey
-- 
2.11.0




More information about the elbe-devel mailing list