Speedup for make clean-depends (and thus make clean)

Yoshihiro Ota ota at j.email.ne.jp
Mon May 21 04:31:26 UTC 2007


This is the fastest one.


It is about O(1) and takes a couple of seconds to delete files whether millions or billions.

1.) Set WRKDIRPREFIX like WRKDIRPREFIX=/ports in /etc/make.conf
2.) Give a device to it.  It could be via mdconfig as well.
For example, "mount /dev/ad0s2c /ports"
3.) Build which ever you need but NEVER run "clean" during this time.

4.) Let's clean with "umount /ports && newfs -U /dev/ad0s2c && mount /dev/ad0s2c /ports"

You can also play with this metnod with "mdconfig -a -t vnode" or "mdconfig -a -t swap", too.


If my way takes more than 10 sec., I will be very surprized how big disk/disks you have for building ports ;p

Regards,
Hiro

PS  If someone is really willing to speed this up, write this technique in the FreeBSD doc. so that people can take advantage of this, or let FreeBSD sets default WRKDIRPREFIX so that it builds everything under one directory (mounting a separate device is at user's wills.) 

On Sun, 20 May 2007 19:13:13 -0700
Jeremy Lea <reg at FreeBSD.ORG> wrote:

> 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 ;-)


More information about the freebsd-ports mailing list