[elbe-devel] [PATCH] elbepack: efilesystem: only import elbepack.hdimg when needed

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Jul 9 11:17:19 CEST 2024


elbepack.efilsystem is a very central package, imported from many other
parts of elbe. By importing hdimg.py it also imposes its dependency on
tge parted module on all its users.
This is unnecessary as that functionality is only used from within the
buildenv but not otherwise.

Import hdimg only when used and drop the now unnecessary dependency on
python3-parted.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 debian/control                          | 1 -
 elbepack/efilesystem.py                 | 2 +-
 newsfragments/+python-parted.bugfix.rst | 1 +
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index d08771691822..2a3bf77bcf2c 100644
--- a/debian/control
+++ b/debian/control
@@ -63,7 +63,6 @@ Depends: ${misc:Depends}, ${python3:Depends},
   python3-elbe-common (= ${binary:Version}),
   python3,
   python3-mako,
-  python3-parted,
   debian-archive-keyring (>= 2017.5+deb9u1)
 Description: elbe executable
  Common files for ELBE (embedded Linux build environment). These
diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index 6fa87a316f27..887361aa07dd 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -15,7 +15,6 @@ import time
 
 from elbepack.filesystem import Filesystem
 from elbepack.fstab import fstabentry
-from elbepack.hdimg import do_hdimg
 from elbepack.imgutils import mount
 from elbepack.licencexml import copyright_xml
 from elbepack.packers import default_packer
@@ -408,6 +407,7 @@ class TargetFs(ChRootFilesystem):
             f.close()
 
     def part_target(self, targetdir, grub_version, grub_fw_type=None):
+        from elbepack.hdimg import do_hdimg
 
         # create target images and copy the rfs into them
         hdimages = do_hdimg(self.xml,
diff --git a/newsfragments/+python-parted.bugfix.rst b/newsfragments/+python-parted.bugfix.rst
new file mode 100644
index 000000000000..180cb988578d
--- /dev/null
+++ b/newsfragments/+python-parted.bugfix.rst
@@ -0,0 +1 @@
+Remove unnecessary dep on `python3-parted` from `python3-elbe-bin`.

---
base-commit: 71c96e3c70465ed5f3f9491d4628a6b7aececb8c
change-id: 20240709-bin-libparted-83d6a1e359c7

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



More information about the elbe-devel mailing list