[yum-cvs] yum-utils/plugins/fedorakmod fedorakmod.conf, 1.3, 1.4 fedorakmod.py, 1.5, 1.6
Jack Neely
slack at linux.duke.edu
Tue Jan 23 23:17:16 UTC 2007
Update of /home/groups/yum/cvs/yum-utils/plugins/fedorakmod
In directory login1.linux.duke.edu:/tmp/cvs-serv11645
Modified Files:
fedorakmod.conf fedorakmod.py
Log Message:
fedorakmod.conf: Turn off installallkmods by default.
fedorakmod.py: Work around Yum not populating the provides prco information
if that is the case. With installallkmods on you can type "yum install
kmod-sysprof" and have that module installed for all installed kernels
and kernel types.
Index: fedorakmod.conf
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/plugins/fedorakmod/fedorakmod.conf,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- fedorakmod.conf 20 Jul 2006 16:39:54 -0000 1.3
+++ fedorakmod.conf 23 Jan 2007 23:17:14 -0000 1.4
@@ -1,3 +1,4 @@
[main]
enabled = 1
pinkernels = 0
+installforallkernels = 0
Index: fedorakmod.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/plugins/fedorakmod/fedorakmod.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- fedorakmod.py 19 Sep 2006 15:13:34 -0000 1.5
+++ fedorakmod.py 23 Jan 2007 23:17:14 -0000 1.6
@@ -31,7 +31,11 @@
plugin_type = (TYPE_CORE,)
kernelProvides = Set([ "kernel-%s" % a for a in rpmUtils.arch.arches.keys() ])
-
+
+# We shouldn't need this if we didn't have to fake stuff so much
+kernelVariants = ["bigmem", "enterprise", "smp", "hugemem", "PAE",
+ "guest", "hypervisor", "xen0", "xenU", "xen"]
+
def getRunningKernel():
# Taken from the installonlyn.py plugin writen by Jeremy Katz
# Copyright 2005 Red Hat, Inc.
@@ -39,8 +43,7 @@
"""This takes the output of uname and figures out the (version, release)
tuple for the running kernel."""
ver = os.uname()[2]
- for s in ("bigmem", "enterprise", "smp", "hugemem", "PAE",
- "guest", "hypervisor", "xen0", "xenU", "xen"):
+ for s in kernelVariants:
if ver.endswith(s):
ver = ver.replace(s, "")
if ver.find("-") != -1:
@@ -96,6 +99,23 @@
return _getKernelDeps(po, "requires")
+def fakeName(po):
+ """When Yum wont give us full PRCO information we yell
+ "Say my name, bitch!"
+ and fake it hard."""
+
+ # Normally, I should be able to pull the <name>-kmod provide
+
+ fields = po.name.split('-')
+ if fields[0] == "kmod":
+ del fields[0]
+ if fields[-1] in kernelVariants:
+ del fields[-1]
+
+ return ('-'.join(fields + ['kmod']), 'EQ',
+ (po.epoch, po.version, po.release))
+
+
def resolveVersions(packageList):
"""The packageDict is a dict of pkgtuple -> PO
We return a dict of kernel version -> list of kmod POs
@@ -104,18 +124,24 @@
dict = {}
for po in packageList:
kernel = getKernelReqs(po)
- if len(kernel) == 1:
+ if len(kernel) == 0:
+ print "Bad kmod package '%s' does not require a kernel" % po
+ continue
+ elif len(kernel) == 1:
kernel = kernel[0]
else:
- print "Bad kmod package: May only require one kernel"
+ print "Bad kmod package: Must require only one kernel"
continue
# Figure out the real name of this kmod
name = []
- for r in po.returnPrco("provides"):
+ for r in po.prco["provides"]:
if r[0].endswith('-kmod'):
name.append(r[0])
- if len(name) != 1:
+ if len(name) == 0:
+ # Yum bug
+ name = fakeName(po)
+ elif len(name) != 1:
print "Non compliant kmod package: %s" % po
continue
po.kmodName = name[0]
@@ -123,10 +149,16 @@
if not dict.has_key(kernel):
dict[kernel] = [po]
else:
- sameName = [ x for x in dict[kernel] if x.name == po.name ][0]
- if packages.comparePoEVR(sameName, po) < 0:
+ sameName = None
+ for tempPo in dict[kernel]:
+ if po.name == tempPo.name:
+ sameName = tempPo
+ break
+ if sameName and packages.comparePoEVR(sameName, po) < 0:
dict[kernel].remove(sameName)
dict[kernel].append(po)
+ elif sameName == None:
+ dict[kernel].append(po)
return dict
@@ -253,12 +285,11 @@
# Install modules for all kernels
if c.confInt('main', 'installforallkernels', default=1) != 0:
- #print "Running installAllKmods()"
- #moreModules = installAllKmods(c, avaModules,
- # newModules + installedModules,
- # newKernels + installedKernels)
- #newModules = newModules + moreModules
- pass
+ print "Running installAllKmods()"
+ moreModules = installAllKmods(c, avaModules,
+ newModules + installedModules,
+ newKernels + installedKernels)
+ newModules = newModules + moreModules
# Pin kernels
if c.confInt('main', 'pinkernels', default=0) != 0:
More information about the Yum-cvs-commits
mailing list