HOWTOUseRequires

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
m (1 revision(s))
(fix wiki links)
 
Line 1: Line 1:
= How to use ''Requires'' =
 
 
 
RPM has very good capabilities of automatically finding dependencies for libraries and eg. Perl modules. In short, don't reinvent the wheel, but just let rpm do its job. There's usually no need to explicitly list eg. ''Requires: XFree86'' when the dependency has already been picked up by rpm in the form of depending on libraries in the XFree86 package.
 
RPM has very good capabilities of automatically finding dependencies for libraries and eg. Perl modules. In short, don't reinvent the wheel, but just let rpm do its job. There's usually no need to explicitly list eg. ''Requires: XFree86'' when the dependency has already been picked up by rpm in the form of depending on libraries in the XFree86 package.
  
Build requirements are different, though. There's no automatic dependency find procedure for them, which means that you must explicitly list stuff that the package requires to build successfully. Typically, some ''-devel'' packages are listed there. See also ["HOWTOFindMissingBuildRequires"] .
+
Build requirements are different, though. There's no automatic dependency find procedure for them, which means that you must explicitly list stuff that the package requires to build successfully. Typically, some ''-devel'' packages are listed there. See also [[HOWTOFindMissingBuildRequires]].
  
 
Sometimes we know that a package requires eg. gtk+-devel 1.2 or newer to build (and thus gtk+ 1.2 or newer to run, but that's handled automatically). There are two things to consider here:
 
Sometimes we know that a package requires eg. gtk+-devel 1.2 or newer to build (and thus gtk+ 1.2 or newer to run, but that's handled automatically). There are two things to consider here:

Latest revision as of 00:56, 3 June 2008

RPM has very good capabilities of automatically finding dependencies for libraries and eg. Perl modules. In short, don't reinvent the wheel, but just let rpm do its job. There's usually no need to explicitly list eg. Requires: XFree86 when the dependency has already been picked up by rpm in the form of depending on libraries in the XFree86 package.

Build requirements are different, though. There's no automatic dependency find procedure for them, which means that you must explicitly list stuff that the package requires to build successfully. Typically, some -devel packages are listed there. See also HOWTOFindMissingBuildRequires.

Sometimes we know that a package requires eg. gtk+-devel 1.2 or newer to build (and thus gtk+ 1.2 or newer to run, but that's handled automatically). There are two things to consider here:

First, if the lowest possible requirement is so old that nobody has a version older than that installed on any target distribution release, there's no need to include the version in the dependency at all. In that case we know the available software is new enough. For example, the version in gtk+-devel 1.2 dependency above is unnecessary for all Red Hat Linux distributions since (at least) release 6.2. As a rule of thumb, if the version is not required, don't add it just for fun.

Second, the Epoch must be listed when adding a versioned dependency to achieve robust epoch-version-release comparison. A quick way to check the Epoch of package foo is to run:

rpm --query --qf "%{EPOCH}\n" packagename

Typically, the requirements for -devel packages need yet another look. They're not usually picked up automatically by rpm. If the foo-devel package has a foo-config script, you can try doing a foo-config --libs and foo-config --cflags to get strong hints what packages should be marked as foo's requirements. For example:

$ gtk-config --cflags
-I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include
$ gtk-config --libs
-L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm

This means that gtk+-devel should contain

Requires: glib-devel XFree86-devel