]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sys-script: remove output directory if it exists 6942/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 29 Sep 2017 10:28:25 +0000 (12:28 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 29 Sep 2017 10:28:25 +0000 (12:28 +0200)
meson will occasionally call us even though the output directory
exists. Let's just nuke and recreate in that case.

test/create-sys-script.py
test/sys-script.py

index 24a00f7a93c9e96edc1c170b8865725fd043079d..a4f1f302f60cd40a0a45131fe81b294dc5984168 100755 (executable)
@@ -36,6 +36,7 @@ OUTFILE_MODE = 0o775
 
 OUTFILE_FUNCS = r"""
 import os, sys
+import shutil
 
 def d(path, mode):
     os.mkdir(path, mode)
@@ -58,6 +59,8 @@ if not os.path.isdir(sys.argv[1]):
 
 os.chdir(sys.argv[1])
 
+if os.path.exists('sys'):
+    shutil.rmtree('sys')
 """
 
 
index ac1369735bb4dc052ba4ea7ba2ec8b0ad6a052c4..2de7d7ea3094d56fa74752eaee1ddfe63970d0f3 100755 (executable)
@@ -20,6 +20,7 @@
 #
 
 import os, sys
+import shutil
 
 def d(path, mode):
     os.mkdir(path, mode)
@@ -40,6 +41,8 @@ if not os.path.isdir(sys.argv[1]):
 
 os.chdir(sys.argv[1])
 
+if os.path.exists('sys'):
+    shutil.rmtree('sys')
 d('sys', 0o755)
 d('sys/kernel', 0o775)
 f('sys/kernel/kexec_crash_loaded', 0o664, b'0\n')