prtwash(1)

NAME
prtwash - clean the CRUX port dirs

SYNOPSIS
prtwash [-p] [-b] [-d] [-s] [-t] [-q] <path|-a> [<path> ...]

DESCRIPTION
prtwash is a perl script to clean the ports tree of a CRUX distribution. You can clean a single directory, multiple directories, or the entire ports tree. With the given options it is possible to choose what kind of files the program should delete. A test mode is provided.

prtwash was inspired by Martin Opel's prtsweep script.

OPTIONS
By default prtwash will NOT delete the following items in a port directory:

•   The Pkgfile

•   The sources (as stated in the Pkgfile)

•   The built package

•   The .signature, .footprint, .32bit and .nostrip files

•   Additional files: README, FAQ, pre-install, post-install

All items not included in the previous list WILL be deleted (e.g.: the 'work' dir of pkgmk, if present).

You can choose to delete some of the above by passing the proper option:

-p  remove the built package (current version)

-b  remove older builds (any package tarball that does NOT match the current version)

-d  remove add-on files provided by CRUX maintainers (patches and initscripts downloaded with ports -u)

-s  remove upstream sources (those NOT obtained via ports -u)

-t  (test mode) display the target files without deleting

-q  (quiet mode) suppress messages about files that are kept; basically the same as prtwash [OPTIONS] | grep -v "keeping"

-a  (automatic mode) take the port collections from the /etc/prt-get.conf file and do a recursive cleaning; if omitted, the command line must contain at least one <path> specifying a valid port directory

Misc options

--parse-pkgmk-conf
    Revert to the v0.9 behaviour of parsing /etc/pkgmk.conf to determine the compression mode of built packages

-h  Display usage information

-v  Display version

ENVIRONMENT
In automatic mode, prtwash gets a list of repositories from /etc/prt-get.conf, and for each repository descends into the individual port directories to read the associated Pkgfiles. In non-automatic mode, prtwash only cleans the paths given on the command line. Directories without a Pkgfile are skipped entirely, and a warning is given unless you pass the option -q. After reading the Pkgfile and /etc/pkgmk.conf, prtwash will know the source filenames, the package filename, and the distinction between sources under CRUX version control and sources downloaded directly from upstream.

Sources under CRUX version control are only deleted if you pass the option -d. Sources from upstream are only deleted if you pass the option -s.

You can also delete the built package (current version) by passing the option -p. To select only older versions for deletion, pass the option -b instead. These two options operate independently, allowing you to target four distinct subsets of packages (including the empty set) for deletion.

By passing the option --parse-pkgmk-conf, you can modify the behaviour of the pattern matching performed to detect built packages. By default, the regexp searches are done with the patterns /${name}#${version}-${release}.*.pkg.tar.(gz|lz|xz|bz2|zst)/ and /${name}#.*pkg.tar.(gz|lz|xz|bz2|zst)/ using the variables defined in the Pkgfile(5). Passing the option --parse-pkgmk-conf will result in a more narrow regexp search, allowing the deletion of any package tarball that uses a different compression algorithm than the one currently defined in /etc/pkgmk.conf (which is how the v0.9 bash script worked).

COMPARISON WITH OTHER UTILITIES
Because prtwash reads the location of port collections from /etc/prt-get.conf(5), you can easily control which collections are cleaned in automatic mode by commenting or uncommenting the appropriate prtdir directives in that file. This detection algorithm makes it easy to wash all your locally-curated repositories, in contrast to the algorithm in prtsweep(1) which looks at the sup files used by ports(8).

Another contrast between the two tools is that prtwash sources each Pkgfile to generate its keep list, whereas prtsweep reads the SHA256 or MD5 sums from a manifest. Spawning an external bash shell for each port should in theory make prtwash slower than prtsweep (which does everything in native perl), but on modern hardware the difference is basically undetectable.

Neither prtwash nor prtsweep will ever touch anything outside your ports tree or the directories passed on the command line. If you have centralized directories outside the ports tree for all downloaded sources and built packages, you might find oldfiles(1) more useful. Nevertheless, the pace of CRUX port updates is fast enough that some cruft is bound to accumulate in the ports tree, and for this reason prtwash and prtsweep still have their place in a CRUX admin's toolbox.

EXAMPLES

prtwash -a -t
    does a default wash action on the entire port tree; doesn't really delete the files

prtwash -a -p -s
    now we're getting serious: removes all downoaded files and built packages from the entire port tree

prtwash -a -p -s -d
    same as the above, but also removes patches, initscripts, etc

prtwash -p -s /usr/ports/contrib/sitecopy
    removes all downoaded files and built packages from the sitecopy directory

prtwash /usr/ports/contrib/*
    does the default wash action on the entire contrib collection

AUTHORS
Simone Rota <sip at varlock dot com>

John McQuah <jmcquah at disroot dot org>

SEE ALSO
 prtsweep(1), oldfiles(1), prt-get.conf(5)