.\" .\" prtsweep manual page. .\" (C) 2e003 by Martin Opel .\" Revised 2022 by John McQuah .\" .TH prtsweep 1 .SH NAME prtsweep \- sweep old files from the ports directories .SH SYNOPSIS .PP .B prtsweep [\-a] [\-d] [\-n] [\-q] [PORTDIR ...] .SH DESCRIPTION The \fIprtsweep\fP perl script sweeps port directories, deleting unneeded files. "Unneeded" here means not listed in the .signature file, and not the built package .PP .nf name#version-release.pkg.tar.* .fi .PP All other files are removed. If a traversal of the ports collections in automatic mode reveals an empty directory (or one of the arguments in [PORTDIR ...] is similarly missing the required \fB.signature\fP file), the 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 port collections defined by /etc/ports/*.{git,httpup,rsync} files and cleans all ports in those collections. .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 In practice, regular synchronization using \fBports(8)\fP eventually removes such empty directories. This option is retained for backwards compatibility so that non-interactive scripts can continue calling \fBprtsweep\fP the way they always have. .TP .I "\-p" Also removes the built package. .TP .I "\-n" Dry-run. Do not remove anything really. .TP .I "\-q" Quiet mode. Print messages only for the files that are deleted, not for the files that are kept. Equivalent to \fBprtsweep [args] | grep -v "keeping"\fP. .SH ENVIRONMENT In automatic mode, \fBprtsweep\fP gets a list of active port collections from /etc/ports/*.{rsync,httpup,git}, and for each collection descends into the individual port directories to read the associated .signature files. After reading .signature, \fBprtsweep\fP will be able to distinguish between needed sources and unneeded clutter. \fBprtsweep\fP then compares the contents of the port directory with this list of needed files, and any non-matching files are deleted (or just printed to stderr if dry-run mode is enabled). .PP \fBprtsweep\fP does not distinguish between the current version of the built package and previous versions. All built packages beginning with the name of the port directory (and ending in pkg.tar.*) are normally shielded from deletion, except when you pass the option \fB\-p\fP. Passing this option allows \fBprtsweep\fP to delete every built package, no matter how old. If you want to keep the current version of the built package but delete older versions, you can use the companion script \fBprtwash(1)\fP instead. .PP After a real cleaning by \fBprtsweep\fP (not dry-run mode), each port directory should contain nothing other than the mandatory port files (Pkgfile, .signature, .footprint), source files listed in .signature, READMEs and pre-/post-install scripts, and the built package (if present, and option -p was not given on the command line). .SH COMPARISON WITH OTHER UTILITIES The distinction between sources under CRUX version control (rsync, git, httpup) and tarballs downloaded from upstream (ftp, http, https) is \fInot\fP recognized by \fBprtsweep\fP; all sources needed to build the latest package are allowed to remain in the port's directory. The companion script \fBprtwash(1)\fP allows you to delete the sources downloaded from upstream, yet keep the patches and initscripts provided by CRUX maintainers. You might find \fBoldfiles(1)\fP more useful if you have centralized directories for all downloaded sources and built packages; such a configuration should leave your ports tree relatively uncluttered anyway. .PP Because \fBprtsweep\fP reads the location of port collections from version control files in /etc/ports, any repository you curate yourself will not be detected in automatic mode. To clean such a repository, you can run \fBprtwash(1)\fP in automatic mode (if that repository appears in a \fIprtdir\fP line of \fI/etc/prt\-get.conf\fP), or pass the individual port directories to \fBprtsweep\fP as command-line arguments. .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), oldfiles(1)