On 8/18/05, Tom 'spot' Callaway <tcallawa(a)redhat.com> wrote:
We're doing this for user sanity as well, and to help
differentiate
userspace packages from kernel-module packages. (Yum might be checking
for it as well, but I'm not the expert on that).
Just FYI on my rawhide box, the current yum magic seems to be partly
relying on packagename syntax and partly on provides syntax right now.
Unless i've misread yum sniplet2 below.
yum sniplet2 seems to say if the packagename starts with
"kernel-module-" then handle it like a kernel module and check for an
upgrade situation versus an install situation by looking at whether
the required kernel version is installed already (see sniplet1).
sniplet2 also says to check to see if the package is in the
installonly list (see sniplet1). For kernel modules to be in the
installonly list by default they need to provide "kernel-modules"
according to sniplet0
from /usr/lib/python2.4/site-packages/yum/config.py
<sniplet0/>
('installonlypkgs', ['kernel', 'kernel-bigmem',
'kernel-enterprise','kernel-smp',
'kernel-modules',
'kernel-debug',
'kernel-unsupported',
'kernel-source',
'kernel-devel']),
</sniplet0>
Anything providing "kernel-modules" will be treated as installonly by default.
From /usr/lib/python2.4/site-packages/yum/depsolve.py on my rawhide
box
<sniplet1/>
def allowedMultipleInstalls(self, po):
"""takes a packageObject, returns 1 or 0 depending on if the
package
should/can be installed multiple times with different vers
like kernels and kernel modules, for example"""
if po.name in self.conf.installonlypkgs:
return 1
provides = po.getProvidesNames()
if filter (lambda prov: prov in self.conf.installonlypkgs, provides):
return 1
return 0
def handleKernelModule(self, txmbr):
"""Figure out what special magic needs to be done to
install/upgrade
this kernel module."""
def getKernelReqs(hdr):
kernels = ["kernel-%s" % a for a in rpmUtils.arch.arches.keys()]
reqs = []
names = hdr[rpm.RPMTAG_REQUIRENAME]
flags = hdr[rpm.RPMTAG_REQUIREFLAGS]
ver = hdr[rpm.RPMTAG_REQUIREVERSION]
if names is not None:
reqs = zip(names, flags, ver)
return filter(lambda r: r[0] in kernels, reqs)
kernelReqs = getKernelReqs(txmbr.po.returnLocalHeader())
instPkgs = self.rpmdb.returnTupleByKeyword(name=txmbr.po.name)
for pkg in instPkgs:
hdr = self.rpmdb.returnHeaderByTuple(pkg)[0]
instKernelReqs = getKernelReqs(hdr)
for r in kernelReqs:
if r in instKernelReqs:
# we know that an incoming kernel module requires the
# same kernel as an already installed module of the
# same name. "Upgrade" this module instead of install
po = packages.YumInstalledPackage(hdr)
self.tsInfo.addErase(po)
self.log(4, 'Removing kernel module %s upgraded to %s' %
(po, txmbr.po))
break
</sniplet1>
<sniplet2/>
if txmbr.ts_state == 'u':
if txmbr.po.name.startswith("kernel-module-"):
self.handleKernelModule(txmbr)
if self.allowedMultipleInstalls(txmbr.po):
self.log(5, '%s converted to install' % (txmbr.po))
txmbr.ts_state = 'i'
txmbr.output_state = 'installing'
</sniplet2>
-jef