phase1: move cleanup.sh script out of build/ subdir
authorJo-Philipp Wich <jo@mein.io>
Tue, 9 Jan 2018 14:33:04 +0000 (15:33 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 9 Jan 2018 14:33:04 +0000 (15:33 +0100)
When cleanup.sh itself is placed into the build/ subdir, subsequent Git()
source steps will fail with a directory not empty error.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
phase1/cleanup.sh
phase1/master.cfg

index f2d0bcc33c8d0cff6c18ae7412ea8668f944c143..42609580ee10da9a786fb0263092dde0c573e8be 100755 (executable)
@@ -60,7 +60,7 @@ if [ "$current_mode" = full ]; then
                exit 1
        fi
 
-       for build_dir in ../../*; do
+       for build_dir in ../*; do
 
                build_dir="$(readlink -f "$build_dir")"
 
@@ -86,14 +86,17 @@ if [ "$current_mode" = full ]; then
                )
        done
 
-) 200>../../cleanup.lock
+) 200>../cleanup.lock
 
 #
 # Clean up current build
 #
 
 else
-       do_cleanup
+       if [ -d build ]; then (
+               cd build
+               do_cleanup
+       ); fi
 fi
 
 exit 0
index 8f53f9de0e586969b2058e4be5d1564f52244835..94bbfad4c7ebab9af66dc66447b8eeab477e0d44 100644 (file)
@@ -404,7 +404,7 @@ for target in targets:
        # cleanup.sh if needed
        factory.addStep(FileDownload(
                mastersrc = "cleanup.sh",
-               slavedest = "cleanup.sh",
+               slavedest = "../cleanup.sh",
                mode = 0755,
                doStepIf = IsCleanupRequested))
 
@@ -412,6 +412,7 @@ for target in targets:
                name = "cleanold",
                description = "Cleaning previous builds",
                command = ["./cleanup.sh", c['buildbotURL'], WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "full"],
+               workdir = ".",
                haltOnFailure = True,
                doStepIf = IsCleanupRequested,
                timeout = 2400))
@@ -420,6 +421,7 @@ for target in targets:
                name = "cleanup",
                description = "Cleaning work area",
                command = ["./cleanup.sh", c['buildbotURL'], WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "single"],
+               workdir = ".",
                haltOnFailure = True,
                doStepIf = IsCleanupRequested,
                timeout = 2400))