[Yum-devel] Re: [Fedora-packaging] Kernel modules (was: Re: tpctl in extras missing dependancy for kernel-module-thinkpad)
Jack Neely
jjneely at pams.ncsu.edu
Thu Jun 30 04:06:29 UTC 2005
Folks,
Attached is a patch that implements some of the kernel magic needed by
Yum to work with kernel modules as decided on fedora-packaging-list.
This keys off of kernel modules requiring
kernel-%{_target_cpu} = %{kver}
Couple points of note:
* You must still have your kernel modules provide "kernel-modules" to
enable the install only behavior. However, the code uses the package
name "kernel-module-foo" to identify if this is a kernel module.
* The next question is when you do "yum install kernel-module-openafs"
which packages do we apply to the system? Not covered by this patch.
Jack
--
Jack Neely <slack at quackmaster.net>
Realm Linux Administration and Development
PAMS Computer Operations at NC State University
GPG Fingerprint: 1917 5AC1 E828 9337 7AA4 EA6B 213B 765F 3B6A 5B89
-------------- next part --------------
? .transactioninfo.py.swp
? kernel-module-2.patch
? rhn.py
Index: depsolve.py
===================================================================
RCS file: /home//groups/yum/cvs/yum/yum/depsolve.py,v
retrieving revision 1.66
diff -u -r1.66 depsolve.py
--- depsolve.py 27 Jun 2005 06:34:05 -0000 1.66
+++ depsolve.py 30 Jun 2005 03:51:57 -0000
@@ -110,7 +110,39 @@
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
+
+
def populateTs(self, test=0, keepold=1):
"""take transactionData class and populate transaction set"""
@@ -139,6 +171,8 @@
rpmfile = txmbr.po.localPkg()
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'
More information about the Yum-devel
mailing list