On Tue, Mar 15, 2022 at 11:31:14AM +0100, Marc Espie wrote:
> 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
> 
Following semarie@'s remarks, let's leverage mkdir -p

way less expensive, thanks !

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:53:26 -0000
@@ -3302,10 +3302,8 @@ _internal-clean:
        @${ECHO_MSG} "===>  Dist cleaning for ${FULLPKGNAME${SUBPACKAGE}}"
        @if cd ${DISTDIR} 2>/dev/null; then \
                ${_PFETCH} rm -f ${MAKESUMFILES} ${MAKESUMFILES:S/$/.part/}; \
+               ${_PFETCH} rmdir -p 2>/dev/null ${MAKESUMFILES:C@/[^/]*$@@} || 
true; \
        fi
-.  if !empty(DIST_SUBDIR)
-       -@${_PFETCH} rmdir ${FULLDISTDIR}
-.  endif
 .endif
 .if ${_clean:Minstall}
 .  if ${_clean:Msub}

Reply via email to