From owner-freebsd-ports@FreeBSD.ORG Sun May 20 07:01:56 2007 Return-Path: X-Original-To: ports@freebsd.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA3D316A400 for ; Sun, 20 May 2007 07:01:56 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 6ABB413C4BC for ; Sun, 20 May 2007 07:01:56 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (p54A5FDC1.dip.t-dialin.net [84.165.253.193]) by redbull.bpaserver.net (Postfix) with ESMTP id CC6272E138 for ; Sun, 20 May 2007 09:01:51 +0200 (CEST) Received: from deskjail (deskjail.Leidinger.net [192.168.1.109]) by outgoing.leidinger.net (Postfix) with ESMTP id DFB035B6169 for ; Sun, 20 May 2007 09:01:35 +0200 (CEST) Date: Sun, 20 May 2007 09:01:49 +0200 From: Alexander Leidinger To: ports@freebsd.org Message-ID: <20070520090149.190a919c@deskjail> X-Mailer: Claws Mail 2.9.1 (GTK+ 2.10.12; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_Yc2gvYwNIEW+YG=E=1MeZhr" X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-14.864, required 8, autolearn=not spam, BAYES_00 -15.00, DK_POLICY_SIGNSOME 0.00, FORGED_RCVD_HELO 0.14) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: Subject: Speedup for make clean-depends (and thus make clean) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 May 2007 07:01:56 -0000 --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--