[elbe-devel] [PATCH] Import Debian repository key to chroot directory

Philipp Arras philipp.arras at linutronix.de
Wed May 10 16:04:33 CEST 2017


https://github.com/Linutronix/elbe/issues/100

Signed-off-by: Philipp Arras <philipp.arras at linutronix.de>
---
 elbepack/elbeproject.py |  4 ++++
 elbepack/rfs.py         | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 7197b5f..4b63eae 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -240,6 +240,10 @@ class ElbeProject (object):
                                       build_sources = build_sources, clean = True )
             skip_pkglist = False
 
+        # Import keyring
+        self.buildenv.import_keys()
+        self.log.printo ("Keys imported")
+
         # Install packages
         if not skip_pkglist:
             self.install_packages()
diff --git a/elbepack/rfs.py b/elbepack/rfs.py
index eadf0e0..cd24d0f 100644
--- a/elbepack/rfs.py
+++ b/elbepack/rfs.py
@@ -188,6 +188,18 @@ class BuildEnv ():
         self.rfs.mkdir_p ("/state/lists/partial")
         self.rfs.touch_file ("/state/status")
 
+    def import_keys(self):
+        if self.xml.has('project/mirror/url-list'):
+            for url in self.xml.node('project/mirror/url-list'):
+                if url.has('key'):
+                    l = url.text('key').strip()    # URL to key
+                    name = l.split('/')[-1]        # Filename of key
+
+                    # Download key and add it to Debian keyring
+                    self.log.chroot(self.rfs.path, 'wget %s' % l )
+                    self.log.chroot(self.rfs.path, 'apt-key add %s' % name )
+                    self.log.chroot(self.rfs.path, 'rm %s' % name)
+
     def initialize_dirs (self, build_sources=False):
         mirror = self.xml.create_apt_sources_list (build_sources=build_sources)
 
-- 
2.1.4





More information about the elbe-devel mailing list