[elbe-devel] [PATCH v1 4/8] Check existance of '/rfs/etc/apt/preferences' with 'lexist'

dion at linutronix.de dion at linutronix.de
Wed May 22 15:33:44 CEST 2019


From: Olivier Dion <dion at linutronix.de>

Since we're going to write to '/rfs/etc/apt/preferences', we
want to make sure that we don't write to a broken link.

Also, change from using 'os.path' methods to 'self.rfs'
methods to be more consistent.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/rfs.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/elbepack/rfs.py b/elbepack/rfs.py
index 15756b76..78da015b 100644
--- a/elbepack/rfs.py
+++ b/elbepack/rfs.py
@@ -271,10 +271,10 @@ class BuildEnv (object):
 
     def create_apt_prefs(self):
 
-        filename = self.rfs.path + "/etc/apt/preferences"
+        filename =  "etc/apt/preferences"
 
-        if os.path.exists(filename):
-            os.remove(filename)
+        if self.rfs.lexists(filename):
+            self.rfs.remove(filename)
 
         self.rfs.mkdir_p("/etc/apt")
 
@@ -304,7 +304,7 @@ class BuildEnv (object):
              "pkgs": self.xml.node("/target/pkg-list"),
              "porgs": pinned_origins}
 
-        write_pack_template(filename, "preferences.mako", d)
+        write_pack_template(self.rfs.fname(filename), "preferences.mako", d)
 
     def seed_etc(self):
         passwd = self.xml.text("target/passwd")
-- 
2.11.0




More information about the elbe-devel mailing list