Remove outputtree.py

This commit is contained in:
Martin Gracik 2011-06-27 12:42:57 +02:00
parent be1178f4c5
commit 00302d9434
2 changed files with 29 additions and 83 deletions

View File

@ -50,7 +50,6 @@ import constants
from sysutils import * from sysutils import *
from installtree import LoraxInstallTree from installtree import LoraxInstallTree
from outputtree import LoraxOutputTree
from buildstamp import BuildStamp from buildstamp import BuildStamp
from treeinfo import TreeInfo from treeinfo import TreeInfo
from discinfo import DiscInfo from discinfo import DiscInfo
@ -337,15 +336,11 @@ class Lorax(BaseLoraxClass):
# get anaconda portions # get anaconda portions
self.installtree.get_anaconda_portions() self.installtree.get_anaconda_portions()
# set up output tree
self.outputtree = LoraxOutputTree(self.outputdir, self.installtree,
self.product, self.version)
# write .discinfo # write .discinfo
discinfo = DiscInfo(self.workdir, self.release, self.basearch) discinfo = DiscInfo(self.workdir, self.release, self.basearch)
discinfo.write() discinfo.write()
shutil.copy2(discinfo.path, self.outputtree.root) shutil.copy2(discinfo.path, self.outputdir)
# move grubefi to workdir # move grubefi to workdir
grubefi = joinpaths(self.installtree.root, "boot/efi/EFI/redhat", grubefi = joinpaths(self.installtree.root, "boot/efi/EFI/redhat",
@ -368,7 +363,25 @@ class Lorax(BaseLoraxClass):
splash = None splash = None
# copy kernels to output directory # copy kernels to output directory
self.outputtree.get_kernels(self.workdir) self.kernels = []
for n, kernel in enumerate(self.installtree.kernels):
suffix = ""
if kernel.ktype == constants.K_PAE:
suffix = "-PAE"
elif kernel.ktype == constants.K_XEN:
suffix = "-XEN"
kname = "vmlinuz{0}".format(suffix)
dst = joinpaths(self.workdir, kname)
shutil.copy2(kernel.fpath, dst)
# change the fname and fpath to new values
self.kernels.append(DataHolder(fname=kname,
fpath=dst,
version=kernel.version,
ktype=kernel.ktype))
# create .treeinfo # create .treeinfo
treeinfo = TreeInfo(self.workdir, self.product, self.version, treeinfo = TreeInfo(self.workdir, self.product, self.version,
@ -384,9 +397,9 @@ class Lorax(BaseLoraxClass):
if self.basearch in bcj: if self.basearch in bcj:
cargs += " -Xbcj %s" % bcj.get(self.basearch) cargs += " -Xbcj %s" % bcj.get(self.basearch)
i = imgclass(kernellist=self.outputtree.kernels, i = imgclass(kernellist=self.kernels,
installtree=self.installtree, installtree=self.installtree,
outputroot=self.outputtree.root, outputroot=self.outputdir,
product=self.product, product=self.product,
version=self.version, version=self.version,
treeinfo=treeinfo, treeinfo=treeinfo,
@ -443,13 +456,11 @@ class Lorax(BaseLoraxClass):
efiboot = None efiboot = None
if grubefi and self.efiarch not in ("IA32",): if grubefi and self.efiarch not in ("IA32",):
# create efibootdir # create efibootdir
self.outputtree.efibootdir = joinpaths(self.outputtree.root, self.efibootdir = joinpaths(self.outputdir, "EFI/BOOT")
"EFI/BOOT") os.makedirs(self.efibootdir)
os.makedirs(self.outputtree.efibootdir)
# set imgdir # set imgdir
self.outputtree.imgdir = joinpaths(self.outputtree.root, self.imgdir = joinpaths(self.outputdir, "images")
"images")
kernel = i.kernels[0] kernel = i.kernels[0]
initrd = i.initrds[0] initrd = i.initrds[0]
@ -483,8 +494,8 @@ class Lorax(BaseLoraxClass):
sys.exit(1) sys.exit(1)
# copy efiboot and efidisk to imgdir # copy efiboot and efidisk to imgdir
shutil.copy2(efiboot, self.outputtree.imgdir) shutil.copy2(efiboot, self.imgdir)
shutil.copy2(efidisk, self.outputtree.imgdir) shutil.copy2(efidisk, self.imgdir)
# create boot iso # create boot iso
logger.info("creating boot iso") logger.info("creating boot iso")
@ -492,7 +503,7 @@ class Lorax(BaseLoraxClass):
treeinfo.write() treeinfo.write()
shutil.copy2(treeinfo.path, self.outputtree.root) shutil.copy2(treeinfo.path, self.outputdir)
def get_buildarch(self): def get_buildarch(self):
# get architecture of the available anaconda package # get architecture of the available anaconda package
@ -603,7 +614,7 @@ class Lorax(BaseLoraxClass):
shutil.copy2(fpath, dst) shutil.copy2(fpath, dst)
if not include_kernel: if not include_kernel:
shutil.copy2(fpath, self.outputtree.efibootdir) shutil.copy2(fpath, self.efibootdir)
# unmount the efiboot image # unmount the efiboot image
cmd = [self.lcmds.UMOUNT, efibootdir] cmd = [self.lcmds.UMOUNT, efibootdir]

View File

@ -1,65 +0,0 @@
#
# outputtree.py
#
# Copyright (C) 2010 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Red Hat Author(s): Martin Gracik <mgracik@redhat.com>
#
import logging
logger = logging.getLogger("pylorax.outputtree")
import sys
import os
import shutil
import glob
import subprocess
from base import BaseLoraxClass, DataHolder
from sysutils import *
import constants
class LoraxOutputTree(BaseLoraxClass):
def __init__(self, root, installtree, product, version):
BaseLoraxClass.__init__(self)
self.root = root
self.installtree = installtree
self.product = product
self.version = version
def get_kernels(self, workdir):
self.kernels = []
for n, kernel in enumerate(self.installtree.kernels):
suffix = ""
if kernel.ktype == constants.K_PAE:
suffix = "-PAE"
elif kernel.ktype == constants.K_XEN:
suffix = "-XEN"
kname = "vmlinuz{0}".format(suffix)
dst = joinpaths(workdir, kname)
shutil.copy2(kernel.fpath, dst)
# change the fname and fpath to new values
self.kernels.append(DataHolder(fname=kname,
fpath=dst,
version=kernel.version,
ktype=kernel.ktype))