pkgviews is a new technology in pkgsrc; in fact it's not that new, but it is getting popular nowadays. What does it provide over the regular pkgsrc? It lets you install every package in an independent directory, called the depot directory. Lets say you install the buildtool-0.16 package; all of its files will end up in /usr/pkg/packages/buildtool-0.16, and nothing will be installed outside that location.

Which are the advantages of this approach? On the first hand, all the files coming from a single package are grouped in a single directory, making things a lot clearer when searching for files. On the other hand, it allows the concurrent installation of multiple versions of the same program. This last reason is specially important, as it simplifies the process of updating a shared library (which is a PITA if has changed its major version number) or updating a server with a very short offline window (consider PostgreSQL, where you have to dump the database using the old version and import it in the new one).

Even though, you may be asking yourself if this is worth the effort, as doing it makes PATH settings unviable. Well, here is where views come to play. pkgviews lets you create a directory that holds symlinks to the packages installed under /usr/pkg/packages; these directories are views. The default view, /usr/pkg, contains links to all installed packages (unless modified by the administrator). But if that's not enough for you, you can create as much views as you want. For example, you could create a /usr/gnome view that hold links to all your GNOME packages, and nothing else. Then, the end user has to configure his path to point to the view he wants and he gets direct access to all the packages in it.

Cool, isn't it? Of course! ;-) But there are still some problems, like handling packages that use "shared" directories (i.e., directories holding plugins and similar stuff). This is something being worked on at the moment, and it's worth a future post. For now, read the pkgsrc/mk/buildlink3/PKGVIEWS_UG file included in pkgsrc and start playing!