prtsweep(1)

NAME
prtsweep - sweep old files from the ports directories

SYNOPSIS

prtsweep [-a] [-d] [-n] [-q] [PORTDIR ...]

DESCRIPTION
The prtsweep perl script sweeps port directories, deleting unneeded files. "Unneeded" here means not listed in the .signature file, and not the built package

	name#version-release.pkg.tar.*

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 .signature file), the directory can be removed with the -d option.

OPTIONS
The following options are supported:

-a  This is the automatic mode. In this mode prtsweep reads the port collections defined by /etc/ports/*.{git,httpup,rsync} files and cleans all ports in those collections.

-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 ports(8) eventually removes such empty directories. This option is retained for backwards compatibility so that non-interactive scripts can continue calling prtsweep the way they always have.

-p  Also removes the built package.

-n  Dry-run. Do not remove anything really.

-q  Quiet mode. Print messages only for the files that are deleted, not for the files that are kept. Equivalent to prtsweep [args] | grep -v "keeping".

ENVIRONMENT
In automatic mode, prtsweep 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, prtsweep will be able to distinguish between needed sources and unneeded clutter. prtsweep 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).

prtsweep 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 -p. Passing this option allows prtsweep 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 prtwash(1) instead.

After a real cleaning by prtsweep (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).

COMPARISON WITH OTHER UTILITIES
The distinction between sources under CRUX version control (rsync, git, httpup) and tarballs downloaded from upstream (ftp, http, https) is not recognized by prtsweep; all sources needed to build the latest package are allowed to remain in the port's directory. The companion script prtwash(1) allows you to delete the sources downloaded from upstream, yet keep the patches and initscripts provided by CRUX maintainers. You might find oldfiles(1) 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 prtsweep 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 prtwash(1) in automatic mode (if that repository appears in a prtdir line of /etc/prt-get.conf), or pass the individual port directories to prtsweep as command-line arguments.

EXAMPLES
You can call prtsweep 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
	...

AUTHORS
Martin Opel <mo at obbl dot net>

John McQuah <jmcquah at disroot dot org>

SEE ALSO
prtwash(1), oldfiles(1)