152 lines
5.7 KiB
Raw Normal View History

2022-05-28 16:49:56 +00:00
.TH prtwash 1 "May 28, 2022" "prtwash 1.2.1" ""
\fBprtwash \fP- a script to clean the port dirs in CRUX.
.fam C
\fBprtwash\fP [-p] [-b] [-d] [-s] [-t] [-q] [-a] <path> [<path> ...]
.fam T
\fBprtwash\fP 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.
\fBprtwash\fP was inspired by Martin Opel's prtsweep script.
By default prtwash will NOT delete the following items
in a port directory:
.IP \(bu 3
The Pkgfile
.IP \(bu 3
The sources (as stated in the Pkgfile)
.IP \(bu 3
The built package
.IP \(bu 3
The .signature, .footprint, .32bit and .nostrip files
.IP \(bu 3
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
.B \-p
remove the built package (current version)
2022-05-28 16:49:56 +00:00
.B \-b
remove older builds (any package tarball that does NOT match
the current version)
2022-05-28 16:49:56 +00:00
.B \-d
remove add-on files provided by CRUX maintainers
2022-05-28 16:49:56 +00:00
(patches and initscripts downloaded with \fBports -u\fP)
.B \-s
remove upstream sources (those NOT obtained via \fBports -u\fP)
2022-05-28 16:49:56 +00:00
.B \-t
2022-05-28 16:49:56 +00:00
(test mode) display the target files without deleting
.B \-q
2022-05-28 16:49:56 +00:00
(quiet mode) suppress messages about files that are kept;
basically the same as \fBprtwash [OPTIONS] | grep -v "keeping"\fP
.B \-a
2022-05-28 16:49:56 +00:00
(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
.B \-\-parse\-pkgmk\-conf
Revert to the v0.9 behaviour of parsing /etc/pkgmk.conf to determine the
compression mode of built packages
.B \-h
2022-05-28 16:49:56 +00:00
Display usage information
.B \-v
2022-05-28 16:49:56 +00:00
Display version
In automatic mode, \fBprtwash\fP 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, \fBprtwash\fP 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 \fB\-q\fP. After reading the Pkgfile and /etc/pkgmk.conf,
\fBprtwash\fP 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 \fB\-d\fP. Sources from upstream are only deleted if you pass the
option \fB\-s\fP.
You can also delete the built package (current version) by passing
the option \fB\-p\fP. To select only older versions for deletion,
pass the option \fB\-b\fP instead. These two options operate independently,
allowing you to target four distinct subsets (including the empty set)
for deletion.
By passing the option \fB\-\-parse\-pkgmk\-conf\fP, you can modify the behaviour
of the pattern matching performed to detect built packages. By default, the
regexp searches are done with the patterns
.B /${name}#${version}.*.pkg.tar.(gz|lz|xz|bz2)/
.B /${name}#.*pkg.tar.(gz|lz|xz|bz2)/
using the variables defined in the \fBPkgfile\fP(5). Passing the option
.B \-\-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).
2022-05-28 16:49:56 +00:00
Because \fBprtwash\fP reads the location of port collections from \fB/etc/prt-get.conf\fP(5),
you can easily control which collections are cleaned in automatic mode by commenting
or uncommenting the appropriate \fIprtdir\fP directives in that file. This detection
algorithm makes it easy to wash all your locally-curated repositories, in contrast
to the algorithm in \fBprtsweep\fP(1) which looks at the sup files used by \fBports\fP(8).
Another contrast between the two tools is that \fBprtwash\fP sources each Pkgfile to
generate its keep list, whereas \fBprtsweep\fP reads the signatures file. Spawning an
external bash shell for each port should in theory make \fBprtwash\fP slower
than \fBprtsweep\fP (which does everything in native perl), but on modern hardware the
difference is basically undetectable.
Neither \fBprtwash\fP nor \fBprtsweep\fP 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
\fBoldfiles\fP(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 \fBprtwash\fP and
\fBprtsweep\fP still have their place in a CRUX admin's toolbox.
.B prtwash \-a \-t
does a default wash action on the entire port tree;
doesn't really delete the files
.B prtwash \-a \-p \-s
now we're getting serious: removes all downoaded files
and built packages from the entire port tree
.B prtwash \-a \-p \-s \-d
same as the above, but also removes patches, initscripts, etc
.B prtwash \-p \-s /usr/ports/contrib/sitecopy
removes all downoaded files
and built packages from the sitecopy directory
.B prtwash /usr/ports/contrib/*
does the default wash action on the entire contrib collection
Simone Rota <sip at varlock dot com>, John McQuah <jmcquah at disroot dot org>
\fBprtsweep\fP(1), \fBoldfiles\fP(1)