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>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Adrian Schmutzler 2021-02-03 22:36:10 +01:00
parent ec0586bdf6
commit 0c83c0e820
1 changed files with 9 additions and 14 deletions

View File

@ -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