From 4b8e3d2f2737a5e2ce8203b1ac43f2212fb5ea57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Mon, 10 May 2021 22:47:53 -0300 Subject: [PATCH] shutils/pkgtarget: speed up build dir cleanup. We need `chmod -R` to be able to cleanup after Go packages, but it's unnecessary in most other cases. By only running it when the first `rm -rf` fails, we optimize for the most common case and get a tiny speedup for this build step. --- common/xbps-src/shutils/pkgtarget.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/xbps-src/shutils/pkgtarget.sh b/common/xbps-src/shutils/pkgtarget.sh index 314dc5aeabe2..5944b791a4aa 100644 --- a/common/xbps-src/shutils/pkgtarget.sh +++ b/common/xbps-src/shutils/pkgtarget.sh @@ -79,7 +79,7 @@ remove_pkg_autodeps() { remove_pkg_wrksrc() { if [ -d "$wrksrc" ]; then msg_normal "$pkgver: cleaning build directory...\n" - chmod -R +wX "$wrksrc" # Needed to delete Go Modules + rm -rf "$wrksrc" || chmod -R +wX "$wrksrc" # Needed to delete Go Modules rm -rf "$wrksrc" fi }