From: Christian Marangi Date: Wed, 7 Sep 2022 21:50:36 +0000 (+0200) Subject: build: handle directory with whitespace in AUTOREMOVE clean X-Git-Tag: v21.02.6~57 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11420%2Fhead;p=thirdparty%2Fopenwrt.git 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 (cherry picked from commit dccee21792b89031bcd801030de403f195d80278) --- diff --git a/include/host-build.mk b/include/host-build.mk index 36b3fed1f32..c3e0c26e6ad 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -197,8 +197,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 diff --git a/include/package.mk b/include/package.mk index 389ba4243be..225fdfc7711 100644 --- a/include/package.mk +++ b/include/package.mk @@ -258,8 +258,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