jcfaracco
jcfaracco

Reputation: 894

"Requires" entry in .spec file does not work

I was writing an .spec file for a rpm package and I'm having an issue. I need to install that package with a specific version of another package. Let's take a python package example. So, I write it:

Requires        : bash, grep, python >= 2.6.7-4b

But, the package is installed even if the python package is in the 2.6.6 version. If I remove python package, the system shows me that my package needs python 2.6.7.

Is there something wrong?

Output from rpm -q --provides python:

Distutils
python(abi) = 2.6
python-abi = 2.6
python-ctypes = 1.0.1
python-hashlib = 20081120
python-sqlite = 2.3.2
python-uuid = 1.31
python-x86_64 = 2.6.6-52.el6
python2 = 2.6.6
python = 2.6.6-52.el6
python(x86-64) = 2.6.6-52.el6

Output from rpm -qpR $yourpackage.rpm:

/bin/sh
python >= 2.6.7-4b
bash
grep
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PartialHardlinkSets) <= 4.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1

Upvotes: 2

Views: 2675

Answers (1)

Bruno9779
Bruno9779

Reputation: 1669

The ''Requires:'' tag is ignored unless you add ''Autoreq: no'' as well.

Newer versions of rpmbuild calculate the requirements automatically and ignore ''Requires:'' unless the feature is turned off.

I have run into this issue multiple times and it is worth noting that you should at first run rpmbuild without ''Autoreq: no'', note the autodetected dependencies, and add them to the ''Required:'' tag before the final run with ''Autoreq: no''.

Is also worth noting that the automatic detection of dependencies is a little buggy and has some issues with comments. I packaged a perl script with a comment containing " ... then use a module ... " a while ago. Autoreq detected that as being perl module "perl a" and added it to the dependencies making my rpm useless.

Upvotes: 3

Related Questions