.\" .\" prtsweep manual page. .\" (C) 2e003 by Martin Opel .\" Revised 2021 by John McQuah .\" .TH prtsweep 1 .SH NAME prtsweep \- sweep old files from the ports directories .SH SYNOPSIS .PP .B prtsweep [\-a] [\-d] [\-n] [PORTDIR ...] .SH DESCRIPTION The \fIprtsweep\fP program sweeps port directories, deleting unneeded files. "Unneeded" here means not found in the Pkgfile source array, and not the built package .PP .nf name#version-release.pkg.tar.gz .fi .PP All other files are removed. If a port directory is empty, the whole directory can be removed with the \fI\-d\fP option. .SH OPTIONS The following options are supported: .TP .I "\-a" This is the automatic mode. In this mode \fIprtsweep\fP reads the ports directories from the rsync and httpup files in /etc/ports and cleans all ports in these directories. .TP .I "\-d" Removes empty directories completely. This happens when ports are moved for example from opt to contrib or vice versa. Note that this option only deletes empty directories, so accidently removing whole directory trees should not happen, even if you use .IP .nf prtsweep \-d / .fi .IP To remove these moved ports completely you have to run \fIprtsweep\fP twice to first remove the files and second remove the empty directory. .TP .I "\-p" Also removes the built package. .TP .I "\-n" Dry-run. Do not remove anything really. .TP .I "\-q" Quiet mode. Do not pause to inform the user when analysis of the config file indicates that clutter from building ports might still remain elsewhere in the filesystem. .SH ENVIRONMENT In automatic mode, \fBprtsweep\fP reads from /etc/pkgmk.conf any custom settings for PKGMK_SOURCE_DIR and PKGMK_PACKAGE_DIR to determine where the clutter from a pkgmk build is likely to appear. If the directories potentially cluttered by pkgmk builds are shared among many ports, e.g., by setting a nonempty PKGMK_SOURCE_DIR with no reference to the port name, then \fBprtsweep\fP will pause and inform the user that a follow-up cleaning using other tools might be needed. This warning can be suppressed by passing the \fB\-q\fP option. .PP \fBprtsweep\fP then gets a list of active port collections from /etc/ports/*.{rsync,httpup}, and for each collection descends into the individual port directories to read the associated Pkgfiles. After reading the Pkgfile, \fBprtsweep\fP will know the source filenames and the package filename. \fBprtsweep\fP then compares the contents of the port directory with this list of needed files, and any non-matching filename is deleted (or just printed to stderr if dry-run mode is enabled). .PP After a real cleaning by \fBprtsweep\fP (not dry-run mode), each port directory should contain only the Pkgfile, source files obtained by rsync or httpup, and the built package (if present, and option -p was not given on the command line). .SH EXAMPLES You can call \fIprtsweep\fP with one port: .PP .nf root@hostname:/root # prtsweep /usr/ports/opt/dialog =======> /usr/ports/opt/dialog + removing file dialog-0.9b-20020814.tgz .fi .PP Or you could call the automatic mode, which scans your supfiles in /etc/ports for all ports directories and cleans them automatically: .PP .nf root@hostname:/root # prtsweep -a =======> /usr/ports/clc/stable/atop + removing file atop-1.8.tar.gz =======> /usr/ports/clc/stable/coldsync + removing file coldsync-2.2.5-gcc3.diff + removing file coldsync-2.2.5.tar.gz =======> /usr/ports/clc/stable/dnsmasq + removing file dnsmasq-1.10.tar.gz ... .fi .SH AUTHORS Martin Opel , John McQuah .SH "SEE ALSO" prtwash(1)