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

Torben Hohn torben.hohn at linutronix.de
Thu May 23 17:08:59 CEST 2019


On Wed, May 22, 2019 at 03:33:44PM +0200, dion at linutronix.de wrote:
> 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>

Reviewed-by: Torben Hohn <torben.hohn 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
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list