[elbe-devel] [PATCH 4/4] init: dont tar up the ./initvm in devel mode

Torben Hohn torben.hohn at linutronix.de
Mon Oct 1 16:37:48 CEST 2018


"./elbe initvm create --devel" creates the initvm in ./initvm, and
tars up the build directory. this produces:

tar: ./initvm/.elbe-in/elbe-devel.tar.bz2: file changed as we read it

this is not critical, but should be avoided.
Check whether the output directory lies in the devel directory, and
add a proper "--exclude" parameter.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/commands/init.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index 61a30447..e43307e4 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -205,9 +205,14 @@ def run_command(argv):
             (out_path, opt.cdrom))
 
     if opt.devel:
+        out_real = os.path.realpath(out_path)
+        ignore = ''
+        if out_real.startswith(elbe_dir + os.sep):
+            ignore = '--exclude "%s"' % os.path.relpath(out_path,
+                                                        start=elbe_dir)
+
         os.system(
-            'tar cfj "%s" -C "%s" .' %
-            (os.path.join(
-                out_path,
-                "elbe-devel.tar.bz2"),
+            'tar cfj "%s" %s -C "%s" .' % (
+                os.path.join(out_path, "elbe-devel.tar.bz2"),
+                ignore,
                 elbe_dir))
-- 
2.11.0




More information about the elbe-devel mailing list