buildscript: do not overwrite build directory on prepare

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 <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2021-02-03 22:36:10 +01:00
parent 8aad142794
commit 2d8334e2df
1 changed files with 10 additions and 13 deletions

View File

@ -62,6 +62,11 @@ checkout_git(){
if [ -d "$DIRECTORY" ]; then
if $MYGIT remote -v | grep -q "$REPO_URL" ; then
echo "Right remote detected"
# Reset tracked files
$MYGIT reset --hard HEAD
# Remove untracked files
$MYGIT clean -f -d
# Select desired commit
if ! $MYGIT checkout "$COMMITID" ; then
echo "commitid not found trying to fetch new commits"
$MYGIT pull && $MYGIT checkout "$COMMITID"
@ -82,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
@ -129,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"
@ -342,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