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.
This commit is contained in:
Érico Nogueira 2021-05-10 22:47:53 -03:00 committed by Érico Nogueira Rolim
parent bd4fb68ea5
commit d7bf8e06a0

View file

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