Subject: pkgsrc make clean speedup
To: None <tech-pkg@netbsd.org>
From: David Maxwell <david@fundy.net>
List: tech-pkg
Date: 12/04/2002 19:34:03
Below, I've attached a patch for pkgsrc/mk/bsd.pkg.subdir.mk which
implements a new target 'fastclean'. This could of course replace the
'clean' target instead, if appropriate.

current clean target from toplevel
497.330u 218.665s 12:56.43 92.2%        0+0k 6112+7401io 117pf+0wo
fastclean with Skipping (patch below) from toplevel
3.397u 2.219s 0:36.31 15.4%     0+0k 4848+80io 0pf+0w
fastclean quietly (patch below, minus 'Skipping' echo) from toplevel
3.287u 1.815s 0:35.89 14.1%     0+0k 4848+80io 0pf+0w

So, 13 minutes before, and 36 seconds using this patch. I tried taking
out the 'Skipping' echo, since I thought output overhead might be
getting significant, but it didn't matter much. Personally, I prefer the
cleaner (hah) output though.

If there's no discussion, I'll talk to the pkgsrc infrastructure people
about applying some form of this.

							David


Index: bsd.pkg.subdir.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.subdir.mk,v
retrieving revision 1.49
diff -r1.49 bsd.pkg.subdir.mk
239a240,280
> 
> 
> fastclean: 
> 	@for entry in "" ${SUBDIR}; do \
> 		if [ "X$$entry" = "X" ]; then continue; fi; \
> 		OK=""; \
> 		for dud in "" ${DUDS}; do \
> 			if [ "X$$dud" = "X" ]; then continue; fi; \
> 			if [ $${dud} = $${entry} ]; then \
> 				OK="false"; \
> 				${ECHO_MSG} "===> ${_THISDIR_}$${entry} skipped"; \
> 			fi; \
> 		done; \
> 		if [ -d ${.CURDIR}/$${entry}.${MACHINE} ]; then \
> 			edir=$${entry}.${MACHINE}; \
> 		elif [ -d ${.CURDIR}/$${entry} ]; then \
> 			edir=$${entry}; \
> 		else \
> 			OK="false"; \
> 			${ECHO_MSG} "===> ${_THISDIR_}$${entry} non-existent"; \
> 		fi; \
> 		if [ "$$OK" = "" ]; then \
> 			if [ "X${PKGSRCTOP}" = "Xyes" ]; then \
> 				cd ${.CURDIR}/$${edir}; \
> 				${ECHO_MSG} "===> ${_THISDIR_}$${edir}"; \
> 				${MAKE} ${MAKEFLAGS} "_THISDIR_=${_THISDIR_}$${edir}/" \
> 				    ${.TARGET} || true; \
> 			else \
> 				if [ -d ${.CURDIR}/$${edir}/$WRKDIR ]; then \
> 					cd ${.CURDIR}/$${edir}; \
> 					${ECHO_MSG} "===> ${_THISDIR_}$${edir}"; \
> 					${MAKE} ${MAKEFLAGS} "_THISDIR_=${_THISDIR_}$${edir}/" \
> 					    ${.TARGET:fastclean=clean} || true; \
> 				else \
> 					${ECHO_MSG} "===> Skipping ${_THISDIR_}$${edir} - No work to do"; \
> 				fi; \
> 			fi; \
> 		fi; \
> 	done
> 
> 

-- 
David Maxwell, david@vex.net|david@maxwell.net --> Although some of you out
there might find a microwave oven controlled by a Unix system an attractive
idea, controlling a microwave oven is easily accomplished with the smallest
of microcontrollers. - Russ Hersch - (Microcontroller primer and FAQ)