prt-get/doc/prt-cache.8
John McQuah 8ac36484c5 expand the prt-get man-page with more examples
add more details to the prt-cache man-page
2023-03-13 14:37:34 -04:00

91 lines
3.1 KiB
Groff

.\" man page for prt-cache
.\" Johannes Winkelmann, jw@tks6.net
.PU
.TH prt-cache 8
.SH "NAME"
.LP
prt\-cache \- call prt\-get using a cache file as a data source
.SH "SYNOPSIS"
.B prt\-cache command [options] <arguments>
.br
.SH "DESCRIPTION"
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.
.PP
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
and
.B info.
It won't work for the
.B dup
command.
.PP
Using
.B prt-cache isinst
is not recommended (really not!)
.PP
Note that if the cache is not up to date (and there's a newer port in the
ports tree),
.B prt-cache install
and
.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.
.PP
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!
.PP
To create a cache, just invoke
.B prt-get cache.
Make sure you have the right permissions to do this.
.SH "CACHE FORMAT"
.PP
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
cache.
.PP
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:
.B
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
.PP
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.
.B
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
.SH "AUTHORS"
Johannes Winkelmann <jw@tks6.net>, John McQuah <jmcquah@disroot.org>
.SH "SEE ALSO"
prt-get(8), pkgmk(8) pkgadd(8), ports(8)