[elbe-devel] [PATCH] elbepack: move dpkg --print-architecture to helper
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Apr 23 07:35:59 CEST 2024
Also fix a bug where xml.is_cross() would always return true as it is
passed bytes instead of str.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/efilesystem.py | 10 ++++++++--
elbepack/rfs.py | 6 +++---
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index a71c368e475f..f233a27bf170 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -15,7 +15,7 @@ from elbepack.fstab import fstabentry
from elbepack.hdimg import do_hdimg
from elbepack.licencexml import copyright_xml
from elbepack.packers import default_packer
-from elbepack.shellhelper import chroot, do, get_command_out
+from elbepack.shellhelper import chroot, do
from elbepack.version import elbe_version
@@ -87,6 +87,12 @@ def copy_filelist(src, file_lst, dst):
shutil.copystat(src.fname(f), dst.fname(f))
+def dpkg_architecture():
+ return subprocess.check_output(
+ ['dpkg', '--print-architecture'], text=True, encoding='ascii',
+ ).rstrip('\n')
+
+
def extract_target(src, xml, dst, cache):
# create filelists describing the content of the target rfs
@@ -143,7 +149,7 @@ def extract_target(src, xml, dst, cache):
for item in pkglist:
f.write(f'{item} install\n')
- host_arch = get_command_out('dpkg --print-architecture').strip()
+ host_arch = dpkg_architecture()
if xml.is_cross(host_arch):
ui = '/usr/share/elbe/qemu-elbe/' + str(xml.defs['userinterpr'])
if not os.path.exists(ui):
diff --git a/elbepack/rfs.py b/elbepack/rfs.py
index b3476f965639..d6bbc761fd51 100644
--- a/elbepack/rfs.py
+++ b/elbepack/rfs.py
@@ -8,9 +8,9 @@ import os
import subprocess
from urllib.parse import urlsplit
-from elbepack.efilesystem import BuildImgFs
+from elbepack.efilesystem import BuildImgFs, dpkg_architecture
from elbepack.egpg import unarmor_openpgp_keyring
-from elbepack.shellhelper import chroot, do, get_command_out
+from elbepack.shellhelper import chroot, do
from elbepack.templates import get_preseed, preseed_to_text, write_pack_template
@@ -170,7 +170,7 @@ class BuildEnv:
if arch == 'default':
arch = self.xml.text('project/buildimage/arch', key='arch')
- host_arch = get_command_out('dpkg --print-architecture').strip().decode()
+ host_arch = dpkg_architecture()
strapcmd = 'debootstrap'
---
base-commit: 9d8411747148c0bc88935c39f13387fcae5238fb
change-id: 20240423-dpkg-architecture-e7f87bedd8d1
Best regards,
--
Thomas Weißschuh <thomas.weissschuh at linutronix.de>
More information about the elbe-devel
mailing list