Date: Sun, 20 May 2007 09:01:49 +0200 From: Alexander Leidinger <Alexander@Leidinger.net> To: ports@freebsd.org Subject: Speedup for make clean-depends (and thus make clean) Message-ID: <20070520090149.190a919c@deskjail>
next in thread | raw e-mail | index | archive | help
--MP_Yc2gvYwNIEW+YG=E=1MeZhr Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, the attached patch speeds up make clean-depends in the case when not a lot of work directories exist (basic idea by Jeremy Lea). It does this by only including dirs in the cleaning where a WRKDIR exists. In the X.org 7.2 dependency tree case and a completely clean ports tree it is a speedup from about 7min10 to 4min40 on my system. For a not so clean ports tree the time should be more than this, as the cleaning itself will take a good amount of time. But on a system where you only build a leaf port, or in case of portupgrade where a lot of subdirs are clean, it should give a nice speed improvement. This version does not change the semantics of a make clean. If we are allowed to change the semantic (not calculating the dependency-subtree in case a port is already clean), it should be possible to speed this up more. I could write such a new target, e.g. limited-clean, which could be used with update tools if there's some interest in something like this from the author of such a tool. Bye, Alexander. -- The only way to make up for being lost is to make record time while you are lost. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 --MP_Yc2gvYwNIEW+YG=E=1MeZhr Content-Type: text/x-patch; name=bsd.port.mk2.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=bsd.port.mk2.diff --- bsd.port.mk Fri May 18 13:34:19 2007 +++ bsd.port.mk Sun May 20 08:37:53 2007 @@ -5047,9 +5058,46 @@ L=$$l; \ done +CLEAN-DEPENDS-LIST= \ + L="${_DEPEND_DIRS}"; \ + checked=""; \ + while [ -n "$$L" ]; do \ + l=""; \ + for d in $$L; do \ + case $$checked in \ + $$d\ *|*\ $$d\ *|*\ $$d) \ + continue;; \ + esac; \ + checked="$$checked $$d"; \ + if [ ! -d "$$d" ]; then \ + ${ECHO_MSG} "${PKGNAME}: \"$$d\" non-existent -- dependency list incomplete" >&2; \ + continue; \ + fi; \ + if [ -d ${WRKDIRPREFIX}$$(${REALPATH} $$d)/work ]; then \ + ${ECHO_CMD} $$d; \ + else \ + if [ -d $$(cd $$d && ${MAKE} -V WRKDIR) ]; then \ + ${ECHO_CMD} $$d; \ + fi; \ + fi; \ + if ! children=$$(cd $$d && ${MAKE} -V _DEPEND_DIRS); then \ + ${ECHO_MSG} "${PKGNAME}: \"$$d\" erroneous -- dependency list incomplete" >&2; \ + continue; \ + fi; \ + for child in $$children; do \ + case "$$checked $$l" in \ + $$child\ *|*\ $$child\ *|*\ $$child) \ + continue;; \ + esac; \ + l="$$l $$child"; \ + done; \ + done; \ + L=$$l; \ + done + .if !target(clean-depends) clean-depends: - @for dir in $$(${ALL-DEPENDS-LIST}); do \ + @for dir in $$(${CLEAN-DEPENDS-LIST}); do \ (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean); \ done .endif --MP_Yc2gvYwNIEW+YG=E=1MeZhr--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070520090149.190a919c>