[elbe-devel] [PATCH 1/5] elbepack: virtapt: replace usages of system with native APIs

Thomas Weißschuh thomas.weissschuh at linutronix.de
Fri Apr 5 11:53:55 CEST 2024


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

diff --git a/elbepack/virtapt.py b/elbepack/virtapt.py
index 3281abb19bbc..0dca4b5ee1dd 100644
--- a/elbepack/virtapt.py
+++ b/elbepack/virtapt.py
@@ -4,6 +4,7 @@
 # SPDX-FileCopyrightText: 2018 Oliver Brandt <oliver.brandt at lenze.com>
 
 import os
+import shutil
 import sys
 
 # don't remove the apt import, it is really needed, due to some magic in
@@ -15,7 +16,6 @@ import apt_pkg
 from elbepack.egpg import unarmor_openpgp_keyring
 from elbepack.filesystem import TmpdirFilesystem
 from elbepack.rfs import create_apt_prefs
-from elbepack.shellhelper import system
 
 
 def getdeps(pkg):
@@ -186,11 +186,9 @@ class VirtApt:
             sys.exit(204)
 
         if os.path.exists('/etc/apt/trusted.gpg'):
-            system(f'cp /etc/apt/trusted.gpg "{ring_path}"')
+            shutil.copyfile('/etc/apt/trusted.gpg', ring_path)
 
-        trustkeys = os.listdir('/etc/apt/trusted.gpg.d')
-        for key in trustkeys:
-            system(f'cp "/etc/apt/trusted.gpg.d/{key}" "{ring_path}.d"')
+        shutil.copytree('/etc/apt/trusted.gpg.d', ring_path + '.d')
 
     def mark_install(self, pkgname):
         self.depcache.mark_install(self.cache[pkgname])

-- 
2.44.0



More information about the elbe-devel mailing list