Cleaning Ports Tree

Mario Lobo lobo at bsd.com.br
Fri Apr 16 17:55:23 UTC 2021


On Fri, Apr 16, 2021 at 2:48 PM Olivier Certner <olivier.freebsd at free.fr>
wrote:

> Hi,
>
> >   find  /usr/ports -type d -name work -exec -vrf {} \;
> >
> > This second approach is much, much (much) faster, I just want to make
> > sure I am not creating nasty side-effects thereby.
>
> It is faster indeed. Even faster, and taking flavors into account:
> find /usr/ports -depth 3 -name 'work*' -exec rm -fR "{}" +
> (And, you could improve it again by using `xargs -P`).
>
> There are no side-effects. No ports currently overrides do-clean, nor uses
> the
> pre and post clean targets, which have existed for more than 20 years, and
> I'm
> willing to bet it's not going to change.
>
> Yasuhiro pointed out some guaranteed advantages of `make clean`, but in
> fact
> you get point 1 with the above command, and point 2 is usually not really
> a
> problem (you could wrap the `find` command inside some shell script
> testing
> for WRKDIRPREFIX, in the case it is not set, and use a simple `rm -fR`
> when it
> is, after appropriate sanity checks that is; but I don't think this is
> worth
> the trouble).
>
> Regards.
>
> --
> Olivier Certner
>
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"
>


ports-mgmt/portupgrade has a utility (portsclean) that does exactly that
among other things, like cleaning unreferenced distfiles, and more.

-- 
Mario Lobo
http://www.mallavoodoo.com.br
FreeBSD since version 2.2.8 [not Pro-Audio.... YET!!]


More information about the freebsd-questions mailing list