]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
script/autobuild.py: let cleanup() ignore errors from rmdir_force() by default
authorStefan Metzmacher <metze@samba.org>
Fri, 20 Nov 2020 09:20:14 +0000 (09:20 +0000)
committerStefan Metzmacher <metze@samba.org>
Wed, 27 Jan 2021 18:17:17 +0000 (18:17 +0000)
It's not useful to generate a python backtrace from within the cleanup code.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jan 27 18:17:17 UTC 2021 on sn-devel-184

script/autobuild.py

index c1d59b9c1a538252079983f48ef1c45f4c57ac0b..dded5c9dec96bb1f606bd475b66d198be7fb0f0d 100755 (executable)
@@ -1045,14 +1045,23 @@ class buildlist(object):
         self.tail_proc = Popen(cmd, close_fds=True)
 
 
-def cleanup():
+def cleanup(do_raise=False):
     if options.nocleanup:
         return
     run_cmd("stat %s || true" % test_tmpdir, show=True)
     run_cmd("stat %s" % testbase, show=True)
     do_print("Cleaning up %r" % cleanup_list)
     for d in cleanup_list:
-        rmdir_force(d)
+        ok = rmdir_force(d, re_raise=False)
+        if ok:
+            continue
+        if os.path.isdir(d):
+            do_print("Killing, waiting and retry")
+            run_cmd("killbysubdir %s > /dev/null 2>&1" % d, checkfail=False)
+        else:
+            do_print("Waiting and retry")
+        time.sleep(1)
+        rmdir_force(d, re_raise=do_raise)
 
 
 def daemonize(logfile):
@@ -1318,7 +1327,7 @@ while True:
         (status, failed_task, failed_stage, failed_tag, errstr) = blist.run()
         if status != 0 or errstr != "retry":
             break
-        cleanup()
+        cleanup(do_raise=True)
     except Exception:
         cleanup()
         raise