[CentOS] Strange behaviour of yum within %post in kickstart

Tue Mar 14 09:29:56 UTC 2017
Ralph Angenendt <ralph.angenendt at gmail.com>


(This is happening on CentOS 6)

during a machine's kickstart I install several yum repositories which are
contained in an RPM. During the %post phase I install an RPM which has a
dependency to nodejs. That package with all of its dependencies can be
found in EPEL. On the other hand I have the Softwarecollections repository,
which also contains nodejs with the same version.

Now nodejs has a dependency on libuv:

| root at devcma01 ~ # yum deplist nodejs -q --disableexcludes=all
| […]
|   dependency: libuv.so.0.10()(64bit)
|    provider: nodejs010-libuv.x86_64 1:0.10.30-1.el6
|    provider: libuv.x86_64 1:0.10.34-1.el6
|    provider: libuv.x86_64 1:0.10.34-1.el6

As you can see, there are two packages satisfying the dependency.

First strange behaviour:

| root at devcma01 ~ # yum --disableexcludes=all -v -d9 install nodejs
| […]
| nodejs-0.10.48-3.el6.x86_64 requires: libuv.so.0.10()(64bit)
| --> Processing Dependency: libuv.so.0.10()(64bit) for package:
| Searching pkgSack for dep: libuv.so.0.10()(64bit)
| Building updates object
| up:simple updates time: 0.010
| up:obs time: 0.014
| up:condense time: 0.000
| updates time: 1.059
| TSINFO: Marking 1:nodejs010-libuv-0.10.30-1.el6.x86_64 as install for
| […]

Why is nodejs010-libuv winning over libuv? It has the longer name *and* an
inferior version number. Does the amount of "requires" play a role here?

| root at devcma01 ~ # repoquery --requires libuv | wc -l
| 32
| root at devcma01 ~ # repoquery --requires nodejs010-libuv | wc -l
| 15

The solution seems easy: Exclude nodejs010 from softwarecollections:

| root at devcma01 /etc/yum.repos.d # grep exclude= *
| python27.repo:exclude=nodejs010*

Now comes the other strange behaviour. As said: I install that repository
during kickstart and then a package gets installed (within %post) that
needs nodejs. The installed repo file has the "exclude" line in it. But:

| --> Processing Dependency: nodejs for package:
| ---> Package nodejs.x86_64 0:0.10.48-3.el6 will be installed
| --> Processing Dependency: libuv.so.0.10()(64bit) for package:
| ---> Package nodejs010-libuv.x86_64 1:0.10.30-1.el6 will be installed

It is as if the exclude line isn't even honoured within the %post section
of kickstart. Any idea on why that is?