121 lines
5.0 KiB

.\" prtsweep manual page.
.\" (C) 2e003 by Martin Opel
.\" Revised 2022 by John McQuah
.TH prtsweep 1
prtsweep \- sweep old files from the ports directories
.B prtsweep
[\-a] [\-d] [\-n] [\-q] [PORTDIR ...]
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
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.
The following options are supported:
.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.
.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
prtsweep \-d /
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.
.I "\-p"
Also removes the built package.
.I "\-n"
Dry-run. Do not remove anything really.
.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.
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).
\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.
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).
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.
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.
You can call \fIprtsweep\fP with one port:
root@hostname:/root # prtsweep /usr/ports/opt/dialog
=======> /usr/ports/opt/dialog
+ removing file dialog-0.9b-20020814.tgz
Or you could call the automatic mode, which scans your supfiles in /etc/ports
for all ports directories and cleans them automatically:
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
Martin Opel <mo at obbl-net dot de>, John McQuah <jmcquah at disroot dot org>
prtwash(1), oldfiles(1)