From patchwork Wed Oct 2 15:42:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: buildscript: Remove target binaries from build dir before building From: Adrian Schmutzler X-Patchwork-Id: 1199 Message-Id: <20191002154235.34486-1-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Wed, 2 Oct 2019 17:42:35 +0200 So far, if build fails, but images from last successful build are present in OpenWrt build directory (build/bin/targets/...), those are copied even after unsuccessful build. This results in the old images being copied to the bin folder and being labelled with the new firmware revision. (!) As our error check also only looks at whether images are there, the image copying process will look like a success. This patch deletes old images of the target/subtarget to be built, so that the copy-firmware step will find nothing if the build stop to early. Signed-off-by: Adrian Schmutzler Reviewed-by: Fabian Bläse --- buildscript | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/buildscript b/buildscript index c2de5759..81974a97 100755 --- a/buildscript +++ b/buildscript @@ -212,6 +212,8 @@ prebuild() { build() { prebuild + rm_firmware + opath=$(pwd) cd "$target" cpus=$(grep -c processor /proc/cpuinfo) @@ -269,6 +271,12 @@ config() { cd "$opath" } +rm_firmware() { + [ -n "$subtarget" ] || subtarget="generic" + + rm -rf $target/bin/targets/${chipset}/${subtarget} +} + cp_firmware() { [ -n "$subtarget" ] || subtarget="generic"