build: handle directory with whitespace in AUTOREMOVE clean

Package with whitespace in their build directory are not correctly
removed when CONFIG_AUTOREMOVE is enabled. This is caused by xargs that
use whitespace as delimiters. To handle this use \0 as the delimiter and
set find to use \0 as the delimiter.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi 2022-09-07 23:50:36 +02:00
parent d7382cc0e4
commit dccee21792
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7
2 changed files with 4 additions and 4 deletions

View File

@ -198,8 +198,8 @@ ifndef DUMP
ifneq ($(CONFIG_AUTOREMOVE),)
host-compile:
$(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' | \
$(XARGS) rm -rf
$(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | \
$(XARGS) -0 rm -rf
endif
endef
endif

View File

@ -259,8 +259,8 @@ define Build/CoreTargets
ifneq ($(CONFIG_AUTOREMOVE),)
compile:
-touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
$(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \
$(XARGS) rm -rf
$(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' -print0 | \
$(XARGS) -0 rm -rf
endif
endef