From owner-freebsd-questions@FreeBSD.ORG Wed Dec 19 03:43:24 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1836016A420 for ; Wed, 19 Dec 2007 03:43:24 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from ns1.jnielsen.net (ns1.jnielsen.net [69.55.238.237]) by mx1.freebsd.org (Postfix) with ESMTP id EBE7B13C467 for ; Wed, 19 Dec 2007 03:43:23 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from [192.168.2.243] (jn@stealth.jnielsen.net [74.218.226.254]) (authenticated bits=0) by ns1.jnielsen.net (8.12.9p2/8.12.9) with ESMTP id lBJ3hMgh054850; Tue, 18 Dec 2007 22:43:22 -0500 (EST) (envelope-from lists@jnielsen.net) From: John Nielsen To: freebsd-questions@freebsd.org Date: Tue, 18 Dec 2007 22:43:55 -0500 User-Agent: KMail/1.9.7 References: <47688E99.4050802@pacific.net.sg> In-Reply-To: <47688E99.4050802@pacific.net.sg> X-Face: #X5#Y*q>F:]zT!DegL3z5Xo'^MN[$8k\[4^3rN~wm=s=Uw(sW}R?3b^*f1Wu*.<=?utf-8?q?of=5F4NrS=0A=09P*M/9CpxDo!D6?=)IY1w<9B1jB; tBQf[RU-R<,I)e"$q7N7 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200712182243.55376.lists@jnielsen.net> X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on ns1.jnielsen.net X-Virus-Status: Clean Cc: Erich Dollansky Subject: Re: rough method of cleaning the ports tree X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2007 03:43:24 -0000 On Tuesday 18 December 2007, Erich Dollansky wrote: > after noticing how large my ports tree grows while compiling, I thought > of simply deleting it and do a CVSup to get a new one after the > compilation is finished. > > This should be much faster and also should do some kind o > defragmentation. I simply cannot believe that the huge ports tree will > still be very well organised after some months. > > What does the list think of this method? There are at least two better ways of doing this that will take less time and not put unnecessary load on the CVS servers. 1) Delete "work" directories after building ports. If you use the "clean" make target it will do this automatically. I typically do "make install clean" to install the port then delete the work directory in one command. Portupgrade and other tools will generally do this as well. If you already installed a port you can just do "make clean" to get rid of its work directory. If you (suspect that you) have a large number of work directories (either because your builds got interrupted or you forgot to use the "clean" target) you can do something like "find /usr/ports -maxdepth 3 -type d -name work -delete" to get them all in one go. 2) Use WRKDIRPREFIX. I set this in my .cshrc, but you can set it manually or in whatever file is appropriate for your (root) shell. e.g. after doing a "setenv WRKDIRPREFIX /usr/scratch" all of the work directories are created under /usr/scratch/usr/ports// instead of under /usr/ports directly. Whenever I feel like cleaning up I can just "rm -r /usr/scratch/usr/ports" without losing anything. See "man ports" for more information on the port build infrastructure and associated make targets and environment variables. The other thing in the ports collection that tends to take up space is the distfiles directory. If you want to delete it wholesale then go ahead ("rm -r /usr/ports/distfiles"), but it's not uncommon to have multiple ports or multiple revisions of the same port use the same distfile(s), so you'll end up downloading them again and again. I prefer to use the script /usr/ports/Tools/scripts/distclean.sh. Run with a "-f" flag it will automatically delete all distfiles no longer referenced by any port in your ports tree. HTH, JN