Don't copy kernels to workdir, copy them straight to outputdir

This commit is contained in:
Martin Gracik 2010-11-23 14:13:05 +01:00
parent 9b73b764b8
commit 6dcc1b8666
2 changed files with 23 additions and 25 deletions

View File

@ -340,21 +340,8 @@ class Lorax(BaseLoraxClass):
shutil.move(splash, self.workdir)
splash = joinpaths(self.workdir, os.path.basename(splash))
# move kernels to workdir
for kernel in self.installtree.kernels:
suffix = ""
if kernel.type == K_PAE:
suffix = "-PAE"
elif kernel.type == K_XEN:
suffix = "-XEN"
kname = "vmlinuz{0}".format(suffix)
shutil.move(kernel.fpath, joinpaths(self.workdir, kname))
kernel.fname = kname
kernel.fpath = joinpaths(self.workdir, kname)
# copy kernels to output directory
self.outputtree.get_kernels(self.installtree.kernels[:])
self.outputtree.get_kernels()
# get list of not required packages
logger.info("getting list of not required packages")

View File

@ -65,20 +65,31 @@ class LoraxOutputTree(BaseLoraxClass):
self.efibootdir = efibootdir
def get_kernels(self):
# get the main kernel
self.main_kernel = self.installtree.kernels[0]
for n, kernel in enumerate(self.installtree.kernels):
suffix = ""
if kernel.type == K_PAE:
suffix = "-PAE"
elif kernel.type == K_XEN:
suffix = "-XEN"
kname = "vmlinuz{0}".format(suffix)
if n == 0:
# copy main kernel to isolinuxdir
shutil.copy2(self.main_kernel.fpath, self.isolinuxdir)
dst = joinpaths(self.isolinuxdir, kname)
shutil.copy2(kernel.fpath, dst)
# create hard link to main kernel in pxebootdir
source = joinpaths(self.isolinuxdir, self.main_kernel.fname)
link_name = joinpaths(self.pxebootdir, self.main_kernel.fname)
os.link(source, link_name)
link_name = joinpaths(self.pxebootdir, kname)
os.link(dst, link_name)
else:
# copy other kernels to pxebootdir
for kernel in self.installtree.kernels[1:]:
shutil.copy2(kernel.fpath, self.pxebootdir)
dst = joinpaths(self.pxebootdir, kname)
shutil.copy2(kernel.fpath, dst)
# XXX change the fname and fpath to new values
kernel.fname = kname
kernel.fpath = dst
def get_isolinux(self):
isolinuxbin = joinpaths(self.installtree.root,