File:  [NetBSD Developer Wiki] / wikisrc / pkgsrc / how_to_clean_all_pkgsrc_work_directories.mdwn
Revision 1.3: download - view: text, annotated - select for diffs
Wed Dec 14 02:31:12 2011 UTC (11 years, 1 month ago) by asau
Branches: MAIN
CVS tags: HEAD
Provide more efficient find+rm example.

Don't mention xargs, it is tricky and dangerous tool.
One ought to be cautious when using it.

While here, fix spelling of "basics."

When working with pkgsrc, pkgsrc leaves working directories called work in the application directory. If you invoke the build with clean, then this directory is cleaned, but not the working directories of the dependencies. To avoid this problem, you should set [[DISTDIR|pkgsrc/How to use pkgsrc]] and [[WRKOBJDIR|pkgsrc/How to use pkgsrc]] in mk.conf.

    # make install clean

If you want to clean the directories of the dependencies aswell you have to run:

    # make install clean clean-depends

Either way, sometimes it is not possible or wanted to clean the working directories. You can clean them all using this one line shell command:

    # find /usr/pkgsrc -name work -exec rm -r {} +

or this one:

    # find /usr/pkgsrc -maxdepth 3 -mindepth 3 -name work -exec rm -r {} +

You can also change the place where the work directories are created by setting WORKOBJDIR in /etc/mk.conf.

You can clean them using make clean in the parent directory, but this is not advised. It takes a very long time. Using pkgclean is another option.
#See also

* [[pkgsrc/How to use pkgsrc]]
* [[basics/rm]]
* [[basics/find]]

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb