From owner-freebsd-ports@FreeBSD.ORG Mon May 21 02:31:26 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 7350016A468 for ; Mon, 21 May 2007 02:31:26 +0000 (UTC) (envelope-from reg@openpave.org) Received: from havana.ucdavis.edu (havana.ucdavis.edu [128.120.32.40]) by mx1.freebsd.org (Postfix) with ESMTP id 5C07C13C45B for ; Mon, 21 May 2007 02:31:26 +0000 (UTC) (envelope-from reg@openpave.org) Received: from flint.openpave.org ([169.237.230.40]) by havana.ucdavis.edu (8.13.7/8.13.1/it-defang-5.4.0) with ESMTP id l4L2Cmkp013303 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 May 2007 19:12:48 -0700 (PDT) Received: from sandy.local (flint.local [192.168.1.5]) by flint.openpave.org (8.13.8/8.13.8) with ESMTP id l4L2DD7M066511; Mon, 21 May 2007 02:13:13 GMT (envelope-from reg@sandy.local) Received: (from reg@localhost) by sandy.local (8.13.8/8.13.8/Submit) id l4L2DD0I066510; Sun, 20 May 2007 19:13:13 -0700 (PDT) (envelope-from reg) Date: Sun, 20 May 2007 19:13:13 -0700 From: Jeremy Lea To: Alexander Leidinger Message-ID: <20070521021313.GA63269@flint.openpave.org> References: <20070520090149.190a919c@deskjail> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070520090149.190a919c@deskjail> User-Agent: Mutt/1.4.2.2i X-Scanned-By: MIMEDefang 2.57 on 128.120.32.40 Cc: ports@FreeBSD.ORG Subject: Re: 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: Mon, 21 May 2007 02:31:26 -0000 Hi, On Sun, May 20, 2007 at 09:01:49AM +0200, Alexander Leidinger wrote: > 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. The patch below should get you going on this. The first will save a stat and a make for each port, so it should reduce your time even more, and the second does the limited-clean. I've just added little targets to test them. One might want to use the logic that 'make clean' does a 'make clean limited-clean' if NOCLEANDEPENDS is not defined, and 'make clean' if it is, and leave 'make clean-depends' to do the full clean. One might want to make a switch like DEPENDS_CLEAN which did a clean before doing the install in dependency directories, so that stale port builds were not used. One might also want to document DEPENDS_CLEAN better so people know that it can be used like this 'cd /usr/ports/x11/xorg && make -DNOCLEANDEPENDS -DDEPENDS_CLEAN install clean', and not only will it clean up like 'make install clean', it will use a lot less disk space... (Although DEPENDS_CLEAN is broken in the case of ports which overide DEPENDS_TARGET via the third depends arguement. It should be implemented directly in _INSTALL_DEPENDS) Regards, -Jeremy PS. ALL-DEPENDS-LIST has tabs set to 8 not 4 like bsd.port.mk should be. I don't think I'm responsible - it's been reimplemented a few times since I did the first rewrite... But maybe it was me ;-) -- FreeBSD - Because the best things in life are free... http://www.freebsd.org/ --- /usr/ports/Mk/bsd.port.mk Sat May 19 12:57:27 2007 +++ /tmp/bsd.port.mk Sun May 20 18:07:05 2007 @@ -5050,6 +5050,91 @@ L=$$l; \ done +CLEAN-DEPENDS-FULL= \ + 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 ! children=$$(cd $$d && ${MAKE} -V WRKDIR -V _DEPEND_DIRS); then \ + ${ECHO_MSG} "${PKGNAME}: \"$$d\" erroneous -- dependency list incomplete" >&2; \ + continue; \ + fi; \ + state=0; \ + for child in $$children; do \ + case $$state in \ + 0) \ + if [ -d $child ]; then \ + ${ECHO_CMD} $$d; \ + fi; \ + state=1;; \ + 1) \ + case "$$checked $$l" in \ + $$child\ *|*\ $$child\ *|*\ $$child) \ + continue;; \ + esac; \ + l="$$l $$child";; \ + esac; \ + done; \ + done; \ + L=$$l; \ + done + +CLEAN-DEPENDS-QUICK= \ + 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 ! children=$$(cd $$d && ${MAKE} -V WRKDIR -V _DEPEND_DIRS); then \ + ${ECHO_MSG} "${PKGNAME}: \"$$d\" erroneous -- dependency list incomplete" >&2; \ + continue; \ + fi; \ + state=0; \ + for child in $$children; do \ + case $$state in \ + 0) \ + if [ ! -d $child ]; then \ + continue; \ + fi; \ + state=1; \ + ${ECHO_CMD} $$d;; \ + 1) \ + case "$$checked $$l" in \ + $$child\ *|*\ $$child\ *|*\ $$child) \ + continue;; \ + esac; \ + l="$$l $$child";; \ + esac; \ + done; \ + done; \ + L=$$l; \ + done + +clean-depends-full: + @${CLEAN-DEPENDS-FULL} + +clean-depends-quick: + @${CLEAN-DEPENDS-QUICK} + .if !target(clean-depends) clean-depends: @for dir in $$(${ALL-DEPENDS-LIST}); do \