Red Hat Bugzilla – Bug 1284876
Rpm ignores a dependency
Last modified: 2016-07-21 14:31:12 EDT
Description of problem:
On my systems RPM ignores the dependency on perl-macros from perl. When using dnf, the dependency is recognised.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. rpm --test -e perl-macros
RPM should say that the perl package depends on perl-macros.
To further illustrate, see the below commands:
[göran@freddi Hämtat]$ sudo rpm --rebuilddb
[sudo] password for root:
[göran@freddi Hämtat]$ cd
[göran@freddi ~]$ rpm -q perl-macros
[göran@freddi ~]$ rpm -q --whatprovides perl-macros
[göran@freddi ~]$ rpm -q --whatrequires perl-macros
no package requires perl-macros
[göran@freddi ~]$ rpm -q --requires perl | grep macros
[göran@freddi ~]$ rpm --test -e perl-macros
Actually running the last command, without "--test", also succeeds. But trying to do "dnf remove perl-macros" attempts to remove more than 2000 packages. And that appears more correct, given that perl depends on perl-macros.
This is expected rpm behaviour. Have a look at perl.spec:
212 Requires(post): perl-macros
From rpm documentation:
Context Marked Dependencies
Recent versions of RPM support context marked dependencies. This is a special type of a dependency that applies only in a specified context. Using this feature, one can specify dependencies for pre- and post(un)install scriptlets, ie. the context of a dependency is the execution time of the specified scriptlet.
The syntax for specifying these dependencies is:
Here, X can be one of pre, post, preun, or postun, which tells RPM that the package depends on package foo for running the corresponding %pre, %post, %preun, or %postun script.
In practice, RPM enforces the above dependencies until the specified script has been run, not at that time. In other words, it will allow erasing a dependency that was marked for eg. the %post script for an already installed package, but will not allow erasing one that is required for a %postun script for such a package. This is to reduce confusion; it would be somewhat odd if RPM told one to install a package in order to get another one erased.
Why does dnf attempt to remove more than 2000 packages is another question. I tried it with yum too and yum also removed only one package.
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
I think this has been fixed already somewhere in libsolv/dnf/whatever.
It works for me too with the current dnf. It only removes one package.