91 lines
3.1 KiB

.\" man page for prt-cache
.\" Johannes Winkelmann,
.TH prt-cache 8
prt\-cache \- call prt\-get using a cache file as a data source
.B prt\-cache command [options] <arguments>
prt\-cache is a synonym for
.B prt\-get --cache.
It's perfectly the same as calling prt\-get --cache, just shorter. See
.B man prt-get(8)
for details on how to use prt-get.
Even though there are almost restrictions on using prt-cache over prt-get,
it's mostly recommended for the following commands:
.B search, dsearch, list, info, depends, quickdep, diff, quickdiff
.B info.
It won't work for the
.B dup
.B prt-cache isinst
is not recommended (really not!)
Note that if the cache is not up to date (and there's a newer port in the
ports tree),
.B prt-cache install
.B prt-cache update
will use the version from the ports tree anyway, so there's no real
risk. On the other hand,
.B prt-cache depinst
will use the outdated cache for dependency resolution, which might be a problem
if the maintainer of your desired port has added dependencies since the last
time you generated the cache.
If you're using prt-cache, make sure to regenerate the cache by calling
.B prt-get cache
each time you make changes to the ports tree!
To create a cache, just invoke
.B prt-get cache.
Make sure you have the right permissions to do this.
The cache is a flat-text file, typically found at /var/lib/pkg/prt-get.cache.
The first line records the cache format identifier, to prevent prt-cache from
performing an operation using an incompatible cache format. The rest of the
file consists of 13 lines per port: name, absolute path to the repository,
version, release, description, dependencies, URL, optional dependencies,
maintainer, readme, pre-install, post-install, and a blank (separator) line. If
multiple ports with the same name appear among the active collections (as
reported by \fBprt\-get dup\fP), only the first port will be listed in the
Suppose you want to create a dependency map, like the one used by the setup
program when installing from a CRUX ISO. One way to do so is to run \fBprt\-get
cache\fP, and then process the resulting file with \fBawk(1)\fP:
tail -n +2 /var/lib/pkg/prt-get.cache | awk '((NR-1) % 13 < 2) { printf("%s : ",$0) } (NR %13 == 6) { gsub(/,/," ",$0); printf("%s\\n",$0) }' | awk -F: '/ \\/usr\\/ports\\/(core|opt|xorg) / { printf("%-25s : %s\\n",$1,$3) }' | tee -a setup.dependencies
A slight variation will also extract all the optional dependencies of each
port, in case you want to mimic Gentoo USE flags by editing the resulting file
and referring to it in a wrapper script, as illustrated by the ffmpeg example
in the \fBprt\-get\fP(8) man-page.
tail -n +2 /var/lib/pkg/prt-get.cache | awk '((NR-1) % 13 == 0) { printf("%s : ",$0) } (NR %13 == 8) { gsub(/,/," ",$0); printf("%s\\n",$0) }' | sudo tee -a /etc/prt-get.softdeps
Johannes Winkelmann <>, John McQuah <>
prt-get(8), pkgmk(8) pkgadd(8), ports(8)