[elbe-devel] [PATCH v2 3/4] elbepack: efilesystem: drop protection feature

Thomas Weißschuh thomas.weissschuh at linutronix.de
Fri Apr 26 17:20:46 CEST 2024


All files are now automatically preserved when modified, so this feature
is not needed anymore.

Also replace the call to "ln" in LnAction with something recognizable.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/efilesystem.py | 10 +---------
 elbepack/finetuning.py  |  5 +----
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index 97601336a291..39868e2b4835 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -259,9 +259,7 @@ class Excursion:
             shutil.copy2(self.origin, rfs.fname(dst))
 
     def end(self, rfs):
-        if self.origin not in rfs.protect_from_excursion:
-            self._undo_excursion(rfs)
-
+        self._undo_excursion(rfs)
         self._del_rfs_file(self._saved_to(), rfs)
 
     def _saved_to(self):
@@ -295,7 +293,6 @@ class ChRootFilesystem(ElbeFilesystem):
         self.interpreter = interpreter
         self.cwd = os.open('/', os.O_RDONLY)
         self.inchroot = False
-        self.protect_from_excursion = set()
 
     def __del__(self):
         os.close(self.cwd)
@@ -334,11 +331,6 @@ class ChRootFilesystem(ElbeFilesystem):
 
         for excursion in self._excursions:
             excursion.end(self)
-        self.protect_from_excursion = set()
-
-    def protect(self, files):
-        self.protect_from_excursion = files
-        return self
 
     def mount(self):
         if self.path == '/':
diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index 91600ea6d16e..2e0c4d568134 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -181,10 +181,7 @@ class LnAction(FinetuningAction):
     def execute(self, _buildenv, target):
         target_name = self.node.et.attrib['path']
         link_name = self.node.et.text
-        with target.protect({link_name}):
-            chroot(
-                target.path,
-                f"""/bin/sh -c 'ln -sf {target_name} "{link_name}"' """)
+        chroot(target.path, ['ln', '-sf', target_name, link_name])
 
 
 @FinetuningAction.register('buildenv_mv')

-- 
2.44.0



More information about the elbe-devel mailing list