14.3. DarwinPorts Maintenance

 < Day Day Up > 

14.2. Using DarwinPorts

Once DarwinPorts has been installed, you can see what packages are available with the port list command. Since the list is quite long, you may want to pipe this command through the more command.

You can also use the port command to search for specific packages. For example, the command port search pine returns a listing for the pine package; the command port search kde lists several packages, namely all available packages that contain the string kde.

You can install a package from source with the command sudo port install package. This command actually performs several steps prior to installing the package on your system. These steps include checking dependencies, downloading the necessary source code including source of dependencies, verifying checksums, configuring packages, building and installing any other required packages, and building the requested package in an intermediate directory called a destroot. After these steps have been performed the requested package is installed into an "image repository" directory and "activated." Activation of a port creates hard links to the files in the image repository directory. The port command must be used with sudo whenever the directory /opt/local or /Applications/DarwinPorts is modified.

For example if you installed pine-4.58 using the sudo port install pine command, pine and all its related files are installed into the image repository /opt/local/var/db/dports/software/pine/4.58_1/opt/local/bin, and then activated through the creation of hard links in the ${prefix} directory /opt/local/bin.

The image repository can be revealed via the port location pine command. You can subsequently deactivate pine by issuing the command sudo port deactivate pine, which deletes the hard links in /opt/local/bin while leaving the pine installation in the image repository intact. You can later reactivate pine with the sudo port activate pine command. The chief advantage of this approach, called Port Images , is that it allows you to install multiple versions of a package. With Port Images, you won't need to uninstall one version of a package to make room for another. Instead, you can deactivate one version and activate another version.

This is particularly helpful when you want to test a new version of the software without uninstalling and then reinstalling the older version if you're not happy with the new version.


As mentioned earlier, DarwinPorts automatically checks package dependencies and installs any other required packages. Similarly, if you deactivate a package, you are warned if the package you are deactivating is needed by another installed package.

To uninstall a particular port, use the port uninstall command. For example, to uninstall pine, enter the command:

          sudo port uninstall pine 

To update a particular port, you can enter the following command:

          sudo port upgrade foo 

If a new version of foo is available, this command will deactivate the currently installed foo port, and install and activate the newer version. This command will also update all of foo's dependencies. If you want to remove the older version of foo at the same time, you should enter the following command:

          sudo port -u upgrade foo 

You can update all installed ports with the following command:

          sudo port -a upgrade 

14.2.1. Creating and Installing Packages in pkg Format

Using DarwinPorts, you can create a .pkg package installer using the port command with the package option, For example, to create a .pkg installer for bvi, enter the command:

          port package bvi 

This downloads the source for bvi, builds the application, and creates a double-clickable package installer, named bvi-1.3.1.pkg. This package is saved in ~/darwinports/dports/editors/bvi/work. It's worth noting that this command only creates the package; it does not install the package. To install it (in /opt/local/), double-click bvi-1.3.1.pkg in the Finder, authenticate yourself as an administrative user, and install the package on your system as you would with any other package. When you install a package in this manner, the DarwinPorts database won't list it among its installed packages. For example, if you issue the port installed command, this package won't show up in the list. If you enter the command port clean bvi, the installer bvi-1.3.1.pkg is deleted.

14.2.2. Creating and Installing Packages in RPM Format

If you are planning to create packages in RPM format, the first thing you should do is to install rpm (via the sudo port install rpm command). Once you have installed rpm, you can create RPM packages using the port command with the rpmpackage option. For example, to create an RPM for pine, enter the following command:

          sudo port rpmpackage pine 

This command creates the RPM file in ${prefix}/src/apple/RPMS/${arch}, which in most cases is /opt/local/src/apple/RPMS/ppc. You can safely use the sudo port clean pine command after the RPM is created, since the port clean command won't remove the .rpm installer.

Before installing RPM packages, however, you need to create /etc/mnttab, which is the file that keeps track of which RPM packages have been installed. This can be done with:

          touch /etc/mnttab 

A summary of the use of the port command is provided in Table 14-1.

Table 14-1. Various port commands

Command

Description

port search foo

Lists packages matching the search keyword, foo.

sudo port install foo

Downloads, builds, and installs package foo.

port destroot foo

Downloads, builds, and installs foo into an intermediate destination root, called a "destroot." This is useful for developing and testing new ports.

sudo port uninstall foo

Deletes package foo.

port installed

Lists all the installed packages.

port clean foo

Deletes intermediate files after installation of package foo.

port contents foo

Lists all files installed with package foo.

port deps foo

Lists package foo's dependencies.

port variants foo

Lists variants of package foo.

port package foo

Build .pkg package installer for foo. Does not install foo.

port list

Lists available packages.

port dmg foo

Build an internet-enabled disk image containing a Mac OS X .pkg package installer for foo. Does not install foo.

port rpmpackage foo

Build an RPM package for foo. Does not install foo.

sudo port activate foo

Activates foo. If multiple versions of foo are installed, use port activate foo version.

sudo port deactivate foo

Activates foo. If multiple versions of foo are installed, use port activate foo version.

port location foo

Displays the location of the image directory in which foo is installed.

port outdated foo

Determine if your installed port foo is outdated.

port outdated

List all of your outdated ports.

sudo port upgrade foo

Update foo along with its dependencies, while deactivating the currently install foo.

sudo port selfupdate

Updates DarwinPorts installation, including the infrastructure and the Portfiles.


     < Day Day Up > 


    Mac OS X Tiger for Unix Geeks
    Mac OS X Tiger for Unix Geeks
    ISBN: 0596009127
    EAN: 2147483647
    Year: 2006
    Pages: 176

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net