From 0c83c0e820ee05379c14381020a2b6655640c6ec Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 3 Feb 2021 22:36:10 +0100 Subject: [PATCH] buildscript: do not overwrite build directory on prepare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So far, we remove the old and copy a fresh new OpenWrt directory into the build directory on prepare. There is no need to do this, as OpenWrt/Make is capable of detecting changes and we do properly update the feeds and patches already. So, just clone the OpenWrt main repo into builddir directly, and just checkout/apply patches during prepare. Signed-off-by: Adrian Schmutzler Reviewed-by: Fabian Bläse --- buildscript | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/buildscript b/buildscript index a3d021ee..aadc581a 100755 --- a/buildscript +++ b/buildscript @@ -64,7 +64,10 @@ checkout_git(){ if [ -d "$DIRECTORY" ]; then if $MYGIT remote -v | grep -q "$REPO_URL" ; then echo "Right remote detected" - if ! $MYGIT checkout "$COMMITID" ; then + # Remove untracked files + $MYGIT clean -f -d + # Select desired commit and remove local changes (-f) + if ! $MYGIT checkout -f "$COMMITID" ; then echo "commitid not found trying to fetch new commits" $MYGIT pull && $MYGIT checkout "$COMMITID" fi @@ -84,14 +87,11 @@ checkout_git(){ } get_source() { - test -d src || mkdir src - cd src + #Get the OpenWrt main repo + checkout_git $builddir $OPENWRTURL $OPENWRTREV - #Get the OpenWrt Core Source for Firmware - checkout_git openwrt $OPENWRTURL $OPENWRTREV - - test -d packages || mkdir packages - cd packages + test -d src/packages || mkdir -p src/packages + cd src/packages #checkout needed package feeds for FEEDVAR in "${FEEDS[@]}" ; do @@ -131,11 +131,6 @@ patch_target() { prepare() { get_source - test -d $builddir || mkdir $builddir - - /bin/rm -rf "$builddir" - cp -a src/openwrt "$builddir" - patch_target # apply variant to ensure the included file "variant.mk" @@ -344,7 +339,7 @@ buildrelease() { } clean() { - /bin/rm -rf bin $builddir src/openwrt + /bin/rm -rf bin $builddir # remove downloaded package feeds for FEEDVAR in "${FEEDS[@]}" ; do