-->
Page 212
Now that you've seen how it's possible to require a package using the requires tag, you're probably expecting that you'll need to use the provides tag in every single package. After all, RPM has to get those package names from somewhere, right?
While it is true that RPM needs to have the package names available, the provides tag is normally not required. It would actually be redundant because the RPM database already contains the name of every package installed. There's no need to duplicate that information.
But wait! We said earlier that manual dependency requirements are always represented in terms of packages. If RPM doesn't require the package builder to use the provides tag to provide the package name, then what is the provides tag used for?
14.3.3.1. Virtual PackagesEnter the virtual package. A virtual package is nothing more than a name specified with the provides tag. Virtual packages are handy when a package requires a certain capability, and that capability can be provided by any one of several packages. Here's an example: In order to work properly, sendmail needs a local delivery agent to handle mail delivery. There are a number of different local delivery agents available: sendmail will work just fine with any of them.
In this case, it doesn't make sense to force the use of a particular local delivery agent; as long as one's installed, sendmail's requirements will have been satisfied. So sendmail's package builder adds the following line to sendmail's spec file:
requires: lda
There is no package with that name available, so sendmail's requirements must be met with a virtual package. The creators of the various local delivery agents indicate that their packages satisfy the requirements of the lda virtual package by adding the following line to their packages' spec files:
provides: lda
NOTE |
Note that virtual packages may not have version numbers. |
Now, when sendmail is installed, as long as there is a package installed that provides the lda virtual package, there will be no problem.
Page 213
RPM's dependency processing is based on tracking the capabilities a package provides and the capabilities a package requires. A package's requirements can come from two places:
These requirements can be viewed by using RPM's --requires query option. A specific requirement can be viewed by using the --whatrequires query option. Both options are fully described in Chapter 5, "Getting Information About Packages."
The capabilities a package provides can come from three places:
The first two types of information can be viewed by using RPM's --provides query option. A specific capability can be viewed by using the --whatprovides query option. Both options are fully described in Chapter 5.
The package name and version are not considered capabilities that are explicitly provided. Therefore, if a search using --provides or --whatprovides comes up dry, try simply looking for a package by that name.
As you've probably gathered by now, using manual dependencies requires some level of synchronization between packages. This can be tricky, particularly if you're not responsible for both packages. But RPM's dependency processing can make life easier for your users.
Page 214