[elbe-devel] [PATCH] elbepack: pbuilder: remove usage of apt-key

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed May 15 09:32:15 CEST 2024


apt-key will go away in Debian trixie.
Prepare for its removal.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/pbuilder.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elbepack/pbuilder.py b/elbepack/pbuilder.py
index 0b744f6dabde..4502a80a13b1 100644
--- a/elbepack/pbuilder.py
+++ b/elbepack/pbuilder.py
@@ -145,8 +145,8 @@ def pbuilder_write_repo_hook(builddir, xml, cross):
         # /etc/apt/sources.list
         f.write(f'cat -> /etc/apt/sources.list <<EOF\n{mirrors}\nEOF\n')
 
-        for key in keys:
-            f.write(f'cat << EOF | apt-key add -\n{key}\nEOF\n')
+        for name, key in keys:
+            f.write(f'cat -> /etc/apt/trusted.gpg.d/{name}.asc <<EOF\n{key}\nEOF\n')
 
         f.write('apt-get update\n')
 
@@ -159,11 +159,11 @@ def get_apt_keys(builddir, xml):
     if not xml.prj.has('mirror') and not xml.prj.has('mirror/cdrom'):
         return (['# No mirrors configured'], [])
 
-    keys = [pathlib.Path(builddir, 'repo', 'repo.pub').read_text()]
+    keys = [('elbe-localrepo', pathlib.Path(builddir, 'repo', 'repo.pub').read_text())]
 
     if xml.prj.has('mirror/primary_host') and xml.prj.has('mirror/url-list'):
 
-        for url in xml.prj.node('mirror/url-list'):
+        for i, url in enumerate(xml.prj.node('mirror/url-list')):
 
             if url.has('options'):
                 options = '[%s]' % ' '.join([opt.et.text.strip(' \t\n')
@@ -181,6 +181,6 @@ def get_apt_keys(builddir, xml):
                                 for line
                                 in url.text('raw-key').splitlines()[1:-1])
 
-                keys.append(key)
+                keys.append((f'elbe-xml-raw-key{i}', key))
 
     return keys

---
base-commit: dfb4a8a89573e88f4d2d9e297b23973092a524e8
change-id: 20240515-apt-key-3258b65e54cf

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list