prt-get - Quick start
Getting started with prt-get
Table of Contents
This section is a quick start guide to using prt-get. If you'd like to get an idea what prt-get is and what it can do, this is a good starting point.
For further information, have a look at the user manual which covers prt-get's functionality much more in depth.
prt-get is a frontend to pkgmk and pkgadd from Per Lidén's pkgutils. Therefore, no changes are required to make ports work with prt-get. The ideas which led to the development of prt-get took place in 2002 in the CRUX mailing list, and the tool modelled after that. Since then, prt-get has evolved quite a bit, and has been improved continuously to address upcoming problems/issues during package management, following the philosophy of CRUX and the CRUX Linux Community CLC as strictly as possible.
The idea behind prt-get is to simplify common tasks and therefore help to avoid repetitive work and making unnecessary errors. It has support for dependency resolution (given a port specifies dependecies) and different search and query functionality. Furthermore, it has several commands to install and update ports, including one to update all outdated ports.
One particularly interestion feature is the abstraction layer for the ports tree prt-get provides: in order to install packages, you don't have to know it's location, prt-get will search it in the file system. The next subsection will contain more information about how prt-get searches for ports.
One important design decision was to keep prt-get from thinking for its user, since this would move the control to the tool which is not wanted. As a consequence, prt-get never does the wrong thing without being told to do so. I tried hard to avoid cases where prt-get would guess what the right thing would be if there's a chance that it's wrong.
In order to build a stable and consistent system, it's important that ports are tested against each other. Because of that, prt-get requires you to specify the directories where prt-get should look for package, and the order of these directories are used to choose a port; if more than one port exists for a certain package, the first matching port is used. To illustrate this, consider the following example:
Let's assume you have both CLC's
collection and a private repository in your ports tree. The
recommended configuration would be to list
contrib before the private repository, like this
(excerpt from prt-get.conf; note that the default repositories
are already there, you just have to add new repositories you
... prtdir /usr/ports/contrib prtdir /usr/ports/private ...
This ensures that packages will first be taken from
contrib and therefore gurantee that it'll work
fine with other packages, most notably its dependencies. Of
course, you can exchange those two lines to achieve the same
effect: prt-get will then choose all matching packages from
the private repository, again choosing the matching packages
(not one dependency from one collection, and another
dependency from another collection). So you see the order is
the only criteria here, which is the one I consider the most stable.
A question which comes up from time to time is what to do if you'd like just a single port from one collection, for example if the private repository contains. This can easily be done like this:
... prtdir /usr/ports/private1:x11 prtdir /usr/ports/private2:freetype,fontconfig,expat prtdir /usr/ports/contrib prtdir /usr/ports/private1 prtdir /usr/ports/private2 ...
The first line tells prt-get to prefer
x11, the second shows how to prefer a list of
ports. You'll see that
private2 are added in the end without any
filters, which will give you access to all their ports, but
with lower priority than
Searching for a port by its name is done using the
$ prt-get search mysql mysql mysql-client mysql-python mysql-ruby mysqlcc
The argument to search is currently just a substring. Future versions of prt-get will have support for regular expressions.
You can get more information out of
search by increasing it's verbosity using the
-v (show version) and
version and description) options. In addition, using
--path also prints out the path information:
$ prt-get search -v mysql mysql 4.1.12-1 mysql-client 4.1.11-1 mysql-python 1.2.0-1 mysql-ruby 2.6-1 mysqlcc 0.9.4-2 $ prt-get search -vv qt qt-engines-bluecurve 0.117-1: Bluecurve engine for qt qt3 3.3.4-1: Qt Free Edition $ prt-get search --path qt /usr/ports/contrib/qt-engines-bluecurve /usr/ports/contrib/qt3 $ prt-get search --path -v qt /usr/ports/contrib/qt-engines-bluecurve 0.117-1 /usr/ports/contrib/qt3 3.3.4-1
If you want to include search the package descriptions, use
dsearch command; it is just like the
search command except that it searches both port
name and description:
$ prt-get dsearch irc -vv bnc 2.9.4-1: BouNCe - simple IRC proxy epic4 2.2-1: EPIC - Enhanced Programmable ircII Client epic4-help 20050315-1: Help files for the epic IRC client irssi 0.8.9-3: irssi - Console IRC client. ngircd 0.8.3-1: Next Generation IRC Server opera 8.0-1: Lightweight web browser with news, e-mail and IRC xcircuit 3.3.11-1: electrical circuit schematics editor
If you're interested which package provides or would provide a
certain file, use the
fsearch command. It
searches the footprints of the ports in your ports tree for
the pattern you specify. Unlike
fsearch doesn't take a substring as argument but
a shell wildcard pattern (see
man(7) for more
--full to search both filename
$ prt-get fsearch iwconfig Found in /usr/ports/contrib/wireless-tools: usr/sbin/iwconfig $ prt-get fsearch libttf\* Found in /usr/ports/contrib/freetype1: usr/lib/libttf.a usr/lib/libttf.la usr/lib/libttf.so -> libttf.so.2.2.0 usr/lib/libttf.so.2 -> libttf.so.2.2.0 usr/lib/libttf.so.2.2.0
Once you've found a port of interest, you'd probably like to
know more about it. Use the
info command to start:
$ prt-get info cups Name: cups Path: /usr/ports/contrib Version: 1.1.23 Release: 2 Description: CUPS - Common UNIX Printing System URL: http://www.cups.org Maintainer: Jürgen Daubert, juergen dot daubert at t-online dot de Dependencies: openssl Files: README
This shows you the most interesting things about the package as an overview.
prt-get can cope with package dependencies if they are
specified in the Pkgfiles. To list them, use the
$ prt-get depends gconf -- dependencies ([i] = installed) [i] gettext [i] pkgconfig [i] libxml2 [i] popt [i] glib [i] libidl [ ] orbit2 [ ] gconf
This output also tells you which packages you already have installed on your system.
To unterstand the dependencies better, the
deptree command prints a tree structure of the
dependencies where you can directly see which packages depend
$ prt-get deptree x11 -- dependencies ([i] = installed, '-->' = seen before) [i] x11 [i] fontconfig [i] freetype [i] expat [i] pkgconfig [i] libpng [i] pkgconfig
The output here can be interpreted as "x11 depends fontconfig and libpng; fontconfig depends on freetype, expat and pkgconfig; libpng depends on pkgconfig".
If you'd like to know which packages depend on a certain
package, there's a command to list reverse
$ prt-get dependent freetype fontconfig imlib2 qt3 gimp imagemagick libgd
By default, this command only lists packages currently
installed. Use the
--all switch to display all
dependent packages found in your ports tree. It also
which do the same as for
search. Note that
dependent only lists direct dependencies.
prt-get diff to find packages which are outdated:
$ prt-get diff Differences between installed packages and ports tree: Ports Installed Available in the ports tree bash 3.0-1 3.0-2 bmp 0.9.7-1 0.9.7-2
Have a look at the next section to learn how to update those packages (either selectively, or all together).
If you're uncertain whether a particular is installed, you
can used the
isinst command. If it is,
current will print its version:
$ prt-get isinst xmms package xmms is not installed $ prt-get isinst bmp package bmp is installed prt-get current bmp 0.9.7-1
Installing a package is a simple matter of executing
prt-get install <packagename>. You can also
specify a list of packages to install in a single command.
The very same applies for updating already installed packages, except that the update command has to be used.
prt-get can install packages including its dependencies, using
$ prt-get depinst licq [...]
Just like all other install commands, you'll get a nice
listing about installed packages afterwards, or a note saying
where a build failed. There are too options which are common
to all install commands but make especially sense for
--test which just
calculates the dependencies and prints the installation result
without actually performing the install, and
--log which creates log files per port (by
default, can be configured differently). In order to use log
files, make sure you have a valid 'logfile' pattern in your
To update all outdated packages, use the
command. The same notes as for
--test option to do a test run first is
a good idea, and
--log for the actual update run.
If you'd like to exclude certain packages from being updated
in sysup, you have two choices: you can use the
lock command to lock a package permanentely, or
--ignore=<package> option, like this:
$ prt-get sysup --log --ignore=gcc,glibc
For more information on package locking, please have a look in the user manual.
The fact that prt-get abtracts the physical location from ports doesn't mean that we don't want to inspect or edit their files. There are a few commands to simplify that, which are:
ls - list files in a port's directory
cat - write out a file to stdout
readme - write out the readme file
edit - edit a file (one must set environment variable
EDITOR to be able to use it)
$ prt-get ls cups .footprint .md5sum Pkgfile README cups cups#1.1.23-1.pkg.tar.gz cups-1.1.23-source.tar.bz2 $ prt-get cat cups .footprint drwxr-xr-x root/root etc/ drwxr-xr-x root/root etc/cups/ drwx--x--x root/root etc/cups/certs/ -rw-r--r-- root/root etc/cups/classes.conf [full output omitted] $ prt-get readme cups README for cups 1.1.x REQUIREMENTS [full output omitted] $ prt-get edit cups Pkgfile [opens editor]