From 50941aa7a78ee2eb6917fedab234f2d2fe03dbf1 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Thu, 31 May 2018 11:06:13 +0200 Subject: use find -delete instead of find | xargs rm Also add -r to all instances of xargs to prevent execution when no matches are found. --- rules/cross-gcc.make | 2 +- rules/post/cleanup.make | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/rules/cross-gcc.make b/rules/cross-gcc.make index 49577a8..4ddc508 100644 --- a/rules/cross-gcc.make +++ b/rules/cross-gcc.make @@ -192,7 +192,7 @@ $(STATEDIR)/cross-gcc.install: $(STATEDIR)/cross-gcc.report fi || exit 1; \ done - @find $(PTXCONF_SYSROOT_CROSS) -name "*.la" -print0 | xargs -0 rm -v -f + @find $(PTXCONF_SYSROOT_CROSS) -name "*.la" -printf 'removing %p' -delete ifneq ($(call remove_quotes,$(PTXCONF_DESTDIR)),) sed -i -e 's;$(call remove_quotes,$(PTXCONF_DESTDIR));;' \ $(PTXCONF_SYSROOT_CROSS)/lib/gcc/$(PTXCONF_GNU_TARGET)/$(CROSS_GCC_VERSION)/install-tools/mkheaders.conf diff --git a/rules/post/cleanup.make b/rules/post/cleanup.make index c06b920..9bce9a7 100644 --- a/rules/post/cleanup.make +++ b/rules/post/cleanup.make @@ -7,40 +7,39 @@ TOOLCHAIN_CLEANUP_HOST_DIRS := \ $(STATEDIR)/world.cleanup: $(STATEDIR)/world.targetinstall @$(call targetinfo) - @find "$(PTXCONF_SYSROOT_CROSS)/"* -depth -type d -print0 | \ - xargs -r -0 -- rmdir -v --ignore-fail-on-non-empty -- + @find "$(PTXCONF_SYSROOT_CROSS)/"* -depth -type d -empty -delete -printf 'removing %p' + # # remove all static host libraries find $(TOOLCHAIN_CLEANUP_HOST_DIRS) \ -wholename "$(PTXCONF_SYSROOT_CROSS)/lib/gcc" -prune -o \ - -type f -name "*.a" -print0 | xargs -0 -r rm + -type f -name "*.a" -delete # # strip all host binaries find $(TOOLCHAIN_CLEANUP_HOST_DIRS) \ -wholename "$(PTXCONF_SYSROOT_CROSS)/lib/gcc" -prune -o \ -type f \( -executable -o -name "*.so*" \) -print0 \ - | xargs -0 -n1 --verbose strip --preserve-dates || true + | xargs -r -0 -n1 --verbose strip --preserve-dates || true # # make sure there are no bogus rpaths find "$(PTXCONF_SYSROOT_CROSS)/$(call remove_quotes,$(PTXCONF_GNU_TARGET))" \ -type f \( -executable -o -name "*.so*" \) -print0 \ - | xargs -0 chrpath -k -d 2>/dev/null || true + | xargs -r -0 chrpath -k -d 2>/dev/null || true ifdef PTXCONF_TOOLCHAIN_CONFIG_SYSROOT # # size compromise: compressed debug sections in static libraries are too large find "$(PTXCONF_SYSROOT_CROSS)/sysroot-$(call remove_quotes,$(PTXCONF_GNU_TARGET))/usr/lib" \ -type f -name "*.a" -print0 \ - | xargs -0 -n1 $(PTXCONF_SYSROOT_CROSS)/bin/$(PTXCONF_GNU_TARGET)-objcopy \ + | xargs -r -0 -n1 $(PTXCONF_SYSROOT_CROSS)/bin/$(PTXCONF_GNU_TARGET)-objcopy \ --preserve-dates --strip-debug --keep-file-symbols || true endif # # compress debug sections and remove any absolute paths find "$(PTXCONF_SYSROOT_CROSS)" "$(PTXCONF_SYSROOT_CROSS)/lib/gcc" \ $(patsubst %,-wholename % -prune -o,$(TOOLCHAIN_CLEANUP_HOST_DIRS)) \ -type f \( -executable -o -name "*.so*" -o -name "*.a" -o -name "*.o" \) -print0 \ - | xargs -0 -n1 $(PTXCONF_SYSROOT_CROSS)/bin/$(PTXCONF_GNU_TARGET)-objcopy \ + | xargs -r -0 -n1 $(PTXCONF_SYSROOT_CROSS)/bin/$(PTXCONF_GNU_TARGET)-objcopy \ --wildcard \ --strip-symbol=$(GLIBC_BUILDDIR)/*.o \ --strip-symbol=$(GLIBC_BUILDDIR)/*.os \ --strip-symbol=$(PTXCONF_SYSROOT_TARGET)/usr/lib/*.o \ --preserve-dates --compress-debug-sections 2>/dev/null || true - find "$(PTXCONF_SYSROOT_TARGET)" \ - -name "*.cmd" -print0 | xargs -0 -r rm + find "$(PTXCONF_SYSROOT_TARGET)" -name "*.cmd" -delete @$(call touch) -- cgit v1.2.3