2. Resources

A resource represents any of the following objects:

A packages contains several different classes of resources:

Provided resources

These are files, libraries, and all other modules that are included in the package.

Required resources

These resources must be installed already, before this package can be installed.

Conflicting resources

These resources cannot be installed together with this package. These resources, if they are provided by some other package, are considered incompatible, in some way.

Obsoleted resources

Installing this package obsoletes these resources. All currently installed packages which provide the obsoleted resource are identified, and automatically uninstalled as part of installing this package.

Superceded resources

These resources are very similar to obsoleted resources, but apply to the upgrade mode only. A package can be installed either in install or upgrade mode. The install mode allows concurrent installation of different versions of the same package; the upgrade mode removes any older versions of the package, upon installation.

This functionality is implemented using superceded resources. Normally, each package includes a resource setting which specifies that older versions of the package are superceded, as well as any version of the package for a different release of the base system distribution, so that the package is selected for upgrading when when upgrading to a newer version of the base system distribution.

Updated resources

These resources indicate which resources are updated by this package. In most cases, a package is presumed to update any package, of the same name, with an older version/release. Sometimes, however, a large software application that consists of multiple packages is reorganized, and certain resources are moved into different packages. For example, some library is moved into a different package. The different package would then specify that it updates the library resource. When checking for available updates, LPMtool would then correctly determine that a new package needs to be installed in order to update an existing package with a different name.

Note

File-based resources cannot be specified as updated resources, only non-file resources, like package names or library names. This is a temporary limitation that will be removed in the future.

Extended resources

A package's extended resources are consulted only in install mode. The extended resources are ignored in upgrade mode. If a package defines any extended resources, those resources must be provided by some other package that's already installed. If the extended resources are not already provided, the package does not get installed, but no error is reported.

Any extended resources defined by a package should also be listed as updated resources. The package then gets consistently installed, in either install or upgrade mode, only if these resources are already provided by another package. Extended resources allow the package to be automatically installed only when some other package is already present, and to skip this package if the prerequisite package is absent.

Note

A package gets processed in upgrade mode if any one of its updates resources are already provided by some package that's already installed. A package gets processed in install mode only if all of its extended resources are already provided by another package.

A resource specification consists of the resource name, plus an optional constraints that specify a particular resource version. A package that installs a file /usr/bin/prog, for example, will specify two resources:

Provided resource: /usr/bin/prog=checksum
Conflicting resource: /usr/bin/prog!=checksum

LPMtool automatically computes a checksum of every installed file. The same file, with the same checksum, can be installed by more than one package. The conflicting resource will stop an attempt to install a different version of the file.

2.1. Required resources: /etc/passwd, /etc/group

LPMtool automatically adds two required resources to all packages that contain files owned by a non-root user and group: /etc/passwd and /etc/group. When installing files owned by someone other than root, lpm needs to look up the userid and groupid in /etc/passwd (and /etc/shadow), in order to set the ownership of the file installed by the package.

Therefore, these packages will get the required resources /etc/passwd and /etc/group. Presumably, when LPMtool gets used to build a set of packages for an entire system, one of the packages will install a stock password and group file:

%files

...

%config(noreplace) /etc/passwd
%config(noreplace) /etc/group

The required resources will assure that the package with the stock /etc/passwd and /etc/group will get installed first, before all other packages that install non root-owned files.

2.2. Generic resources

Resources whose names do not begin with the / character refer to a generic resource, such as a shared library or a module, and may have the following constraints:

  • name = version-release
  • name != version-release
  • name < version-release
  • name > version-release
  • name <= version-release
  • name >= version-release

Generic resources use the same version-release concept as LPMtool packages; a resource is often named after a package (but it doesn't have to be). The release is optional: foo=1.0 matches all resources called foo with version of 1.0, and any release.