blogstrapping

Add Package Description Alias To FreeBSD

One thing I find rather annoying about the pkg tools on FreeBSD -- the only thing that has really annoyed me about it lately, once all the confusion and mess of how "pkgng" first got introduced died down -- is the lack of a simple equivalent to apt-cache show. While the YUM equivalent, yum info, isn't quite as nice as apt-cache show, it is still much easier to remember than the FreeBSD pkg equivalent: pkg rquery %e. It's nigh-impossible for me to remember it from one use to the next. Luckily, pkg comes with a nice, built-in command alias feature.

In /usr/local/etc/pkg.conf, I just add this:

alias: {
    desc: "rquery %e"
}

With that, it does this:

$ pkg desc herrie
Herrie is a small command line music player. It has vim-like controls
and has some unique features, like chroot()'ing and dropping privileges.
It also supports submission of songs to AudioScrobbler. This makes it an
ideal application for low-end jukeboxes.

WWW: http://herrie.info/

. . . which is much the same thing as what Debian's apt-cache show does:

> apt-cache show herrie
N: Unable to locate package herrie
E: No packages found

Wait, no, let's try another package. Start with FreeBSD, where the package and port for XSel (written by Conrad Parker) are named "xsel-conrad" for historical reasons:

$ pkg desc xsel-conrad
XSel is a command-line program for getting and setting the contents of
the X selection. Normally this is only accessible by manually
highlighting information and pasting it with the middle mouse button.

This port is similar to x11/xsel, but with different CLI syntax and
a bit more functionality. It is a lot more popular, too.

WWW: http://www.vergenet.net/~conrad/software/xsel/

Now, on Debian:

> apt-cache show xsel
Package: xsel
Version: 1.2.0-2
Installed-Size: 37
Maintainer: Joe Nahmias <jello@debian.org>
Architecture: amd64
Depends: libc6 (>= 2.11), libx11-6
Description-en: command-line tool to access X clipboard and selection buffers
 XSel is a command-line program for getting and setting the contents of
 the X selection.  It can also append and have it follow a growing file
 (similar to tail -f).
Description-md5: 1b3da90ee371818f1298d56f0ca8017a
Homepage: http://www.vergenet.net/~conrad/software/xsel/
Tag: implemented-in::c, interface::commandline, interface::x11,
 role::program, scope::utility, use::viewing, works-with::text,
 x11::application
Section: x11
Priority: optional
Filename: pool/main/x/xsel/xsel_1.2.0-2_amd64.deb
Size: 21006
MD5sum: 7546e5a4a538c5cbdbe88a90aeb16745
SHA1: 3efda826cc262430520c38fb7d5d74f50103e6d2
SHA256: 42b567e2ae2f03c9c26edc234b400c0b27d598b21c2706fb89adea0cd928de16

The description you want is in there somewhere. If you want a giant dump of info like that, you can alias it (perhaps as pkg show-all or something along those lines) using the format string syntax of the rquery command for pkg, but when I just want the description I like having just-the-description. Your mileage may vary.