As noticed by sdk@, with the advent of "fun" languages like go and rust,
we got a truckload of new directories under DISTDIR.
The following patch tries to clean up the infrastructure as best as it can.
It makes things marginally slower in cases with lots of directories
Please test.
Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1570
diff -u -p -r1.1570 bsd.port.mk
--- bsd.port.mk 9 Mar 2022 14:00:43 -0000 1.1570
+++ bsd.port.mk 15 Mar 2022 10:29:26 -0000
@@ -3302,10 +3302,13 @@ _internal-clean:
@${ECHO_MSG} "===> Dist cleaning for ${FULLPKGNAME${SUBPACKAGE}}"
@if cd ${DISTDIR} 2>/dev/null; then \
${_PFETCH} rm -f ${MAKESUMFILES} ${MAKESUMFILES:S/$/.part/}; \
+ for d in ${MAKESUMFILES}; do \
+ while true; do \
+ d=$${d%/*}; \
+ test -d $$d && ${_PFETCH} rmdir 2>/dev/null $$d
|| break; \
+ done; \
+ done; \
fi
-. if !empty(DIST_SUBDIR)
- -@${_PFETCH} rmdir ${FULLDISTDIR}
-. endif
.endif
.if ${_clean:Minstall}
. if ${_clean:Msub}