[elbe-devel] [PATCH 05/12] elbepack: elbexml: add function to return primary key if there is one

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Nov 18 15:45:22 CET 2024


From: Stefan Kempf <stefan at kempfsn.de>

[thomas: rebase, align with project conventions]

Signed-off-by: Stefan Kempf <stefan at kempfsn.de>
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/elbexml.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
index 75e96b43bb16dbe826203c0e7a2e07ef37b2d3fa..a66bfd866ee81c971344e32546e6ca0b41a45f2c 100644
--- a/elbepack/elbexml.py
+++ b/elbepack/elbexml.py
@@ -160,6 +160,19 @@ class ElbeXML:
 
         return replace_localmachine(mirror, initvm)
 
+    def get_primary_key(self, cdrompath, hostsysroot=False):
+        if self.prj.has('mirror/cdrom') and cdrompath:
+            return
+
+        if self.prj.has('mirror/primary_host'):
+            mirror = self.prj.node('mirror')
+
+            if hostsysroot and mirror.has('host') and mirror.has('mirror/host_key'):
+                return mirror.text('host_key')
+
+            if mirror.has('primary_key'):
+                return mirror.text('primary_key')
+
     # XXX: maybe add cdrom path param ?
     def create_apt_sources_list(self, build_sources=False, initvm=True, hostsysroot=False):
 

-- 
2.47.0



More information about the elbe-devel mailing list