Use DataHolder instead of namedtuple for holding kernel info
This commit is contained in:
parent
e9eea0f3ea
commit
0224cdf660
@ -43,8 +43,6 @@ import itertools
|
||||
import glob
|
||||
import math
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
from base import BaseLoraxClass
|
||||
import output
|
||||
|
||||
@ -86,10 +84,6 @@ K_PAE = 1
|
||||
K_XEN = 1
|
||||
|
||||
|
||||
# XXX kernel tuple
|
||||
Kernel = namedtuple("Kernel", "fname fpath version type")
|
||||
|
||||
|
||||
class Lorax(BaseLoraxClass):
|
||||
|
||||
def __init__(self):
|
||||
@ -347,23 +341,20 @@ class Lorax(BaseLoraxClass):
|
||||
splash = joinpaths(self.workdir, os.path.basename(splash))
|
||||
|
||||
# move kernels to workdir
|
||||
kernels = []
|
||||
for kernel in self.installtree.kernels:
|
||||
type = ""
|
||||
suffix = ""
|
||||
if kernel.type == K_PAE:
|
||||
type = "-PAE"
|
||||
suffix = "-PAE"
|
||||
elif kernel.type == K_XEN:
|
||||
type = "-XEN"
|
||||
|
||||
kname = "vmlinuz{0}".format(type)
|
||||
suffix = "-XEN"
|
||||
|
||||
kname = "vmlinuz{0}".format(suffix)
|
||||
shutil.move(kernel.fpath, joinpaths(self.workdir, kname))
|
||||
kernels.append(Kernel(kname,
|
||||
joinpaths(self.workdir, kname),
|
||||
kernel.version,
|
||||
kernel.type))
|
||||
kernel.fname = kname
|
||||
kernel.fpath = joinpaths(self.workdir, kname)
|
||||
|
||||
self.outputtree.get_kernels(kernels[:])
|
||||
# copy kernels to output directory
|
||||
self.outputtree.get_kernels(self.installtree.kernels[:])
|
||||
|
||||
# get list of not required packages
|
||||
logger.info("getting list of not required packages")
|
||||
|
@ -32,10 +32,7 @@ import time
|
||||
import subprocess
|
||||
import operator
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
from base import BaseLoraxClass
|
||||
|
||||
from base import BaseLoraxClass, DataHolder
|
||||
import constants
|
||||
from sysutils import *
|
||||
|
||||
@ -46,10 +43,6 @@ K_PAE = 1
|
||||
K_XEN = 1
|
||||
|
||||
|
||||
# XXX kernel tuple
|
||||
Kernel = namedtuple("Kernel", "fname fpath version type")
|
||||
|
||||
|
||||
class LoraxInstallTree(BaseLoraxClass):
|
||||
|
||||
def __init__(self, yum, basearch, libdir):
|
||||
@ -553,10 +546,10 @@ class LoraxInstallTree(BaseLoraxClass):
|
||||
elif m.group("xen"):
|
||||
type = K_XEN
|
||||
|
||||
kernels.append(Kernel(fname,
|
||||
joinpaths(kerneldir, fname),
|
||||
m.group("ver"),
|
||||
type))
|
||||
kernels.append(DataHolder(fname=fname,
|
||||
fpath=joinpaths(kerneldir, fname),
|
||||
version=m.group("ver"),
|
||||
type=type))
|
||||
|
||||
kernels = sorted(kernels, key=operator.attrgetter("type"))
|
||||
return kernels
|
||||
|
Loading…
Reference in New Issue
Block a user