5. Resource Databases

A ResourceDB object holds a collection of resources. Actually, the resource database maintains a list of resources and their associated package, which is the equivalent to a dependency. A Resource Database provides methods for:

5.1. Finding dependencies

This subject needs further explanation. There are several ways to search for dependencies.

Find an exact, matching dependency

Take a resource, such as foo=1.0, and find all dependencies that contain this exact resource, essentially returning all packages that installed this resource.

Find any matching dependency

This time, all dependencies that contain a resource that satisfies the given resource are returned. A search for foo=1.0 would return dependencies that might contain the resources foo<5.0, foo=1.0-2.1, or simply foo.

This is the mechanism which allows multiple packages to install the same file, with the same checksum, but prevent packages from installing the same file with a different checksum. A package which installs, for example, /usr/bin/prog with a checksum of 43 (this is just an example) will include a provided resource of /usr/bin/prog=43 and a conflicting resource of /usr/bin/prog!=43. An attempt to install this package will include a search for any provided resource that matches /usr/bin/prog!=43. This will find another package that a provided resource of /usr/bin/prog=27, which means that the other package already installed this file, but it has a different checksum.

The rules for determining whether a given pair of resources match are intuitive. A resource of name=version can be matched by any release of the same package, as long as the version is the same, so name=version-release is a match. The opposite is also true. A resource that demands a specific release can be matched by a resource that targets the same version only, because that resource is considered as matching any release of this version.

Packages, which are described in Section 7, “Packages”, automatically provide the following resources: name=version-release and name(arch)=version-release. In most situations the package's architecture can be ignored, so the resource foo=1.0 will be matched by any release of the 1.0 version of the foo package, while a resource of foo(i386)=1.0 can be used to target a specific architecture and release.