Remove pseudo code

This commit is contained in:
Martin Gracik 2011-04-13 13:23:25 +02:00
parent 706ac6a55c
commit 0a091838d0
4 changed files with 0 additions and 533 deletions

View File

@ -1,217 +0,0 @@
# ppc.pseudo.py
##### constants #####
ANABOOTDIR = "usr/share/anaconda/boot"
ETCDIR = "etc"
PPCPARENT = "ppc"
CHRPDIR = "ppc/chrp"
IMAGESDIR = "images"
PPC32DIR = "ppc/ppc32"
PPC64DIR = "ppc/ppc64"
MACDIR = "ppc/mac"
NETBOOTDIR = "images/netboot"
MKZIMAGE = "usr/bin/mkzimage"
ZIMAGE_STUB = "usr/share/ppc64-utils/zImage.stub"
ZIMAGE_LDS = "usr/share/ppc64-utils/zImage.lds"
WRAPPER = "usr/sbin/wrapper"
# XXX variable constant :/
WRAPPER_A = "usr/%s/kernel-wrapper/wrapper.a" % libdir
ISOPATHDIR = "isopath"
MKISOFS = "mkisofs"
MAPPING = joinpaths(ANABOOTDIR, "mapping")
MAGIC = joinpaths(ANABOOTDIR, "magic")
IMPLANTISOMD5 = "implantisomd5"
##### main() #####
""" kernellist, installroot, outputroot, product, version, treeinfo, bootiso
"""
# create directories
makedirs(joinpaths(outputroot, ETCDIR))
makedirs(joinpaths(outputroot, PPCPARENT)
makedirs(joinpaths(outputroot, CHRPDIR))
makedirs(joinpaths(outputroot, IMAGESDIR))
# set up biarch test
biarch = lambda: (exists(joinpaths(outputroot, PPC32DIR)) and
exists(joinpaths(outputroot, PPC64DIR)))
# create images
for kernel in kernellist:
# set up bits
if (kernel.arch == "ppc"):
bits = 32
ppcdir = PPC32DIR
fakearch = "ppc"
elif (kernel.arch == "ppc64"):
bits = 64
ppcdir = PPC64DIR
fakearch = ""
else:
raise Exception("unknown kernel arch %s" % kernel.arch)
# create ppc dir
makedirs(joinpaths(outputroot, ppcdir))
if (kernel.arch == "ppc"):
# create mac dir
makedirs(joinpaths(outputroot, MACDIR))
# create netboot dir
makedirs(joinpaths(outputroot, NETBOOTDIR))
# copy kernel
kernel.fname = "vmlinuz"
kernel.fpath = copy(kernel.fpath,
joinpaths(outputroot, ppcdir, kernel.fname))
# create and copy initrd
initrd_fname = "ramdisk.image.gz"
initrd_fpath = copy(create_initrd(kernel),
joinpaths(outputroot, ppcdir, initrd_fname))
# copy yaboot.conf
yabootconf = copy(joinpaths(installroot, ANABOOTDIR, "yaboot.conf.in"),
joinpaths(outputroot, ppcdir, "yaboot.conf"))
replace(yabootconf, "%BITS%", "%d" % bits)
replace(yabootconf, "%PRODUCT%", product)
replace(yabootconf, "%VERSION%", version)
# add kernel and initrd to .treeinfo
with open(treeinfo, "a") as f:
f.write("[images-%s]\n" % kernel.arch)
f.write("kernel = %s\n" % joinpaths(ppcdir, kernel.fname))
f.write("initrd = %s\n" % joinpaths(ppcdir, initrd_fname))
mkzimage = joinpaths(installroot, MKZIMAGE)
zimage_stub = joinpaths(installroot, ZIMAGE_STUB)
wrapper = joinpaths(installroot, WRAPPER)
wrapper_a = joinpaths(installroot, WRAPPER_A)
ppc_img_fname = "ppc%d.img" % bits
ppc_img_fpath = joinpaths(outputroot, NETBOOTDIR, ppc_img_fname)
if (exists(mkzimage) and exists(zimage_stub)):
# copy zImage.lds
zimage_lds = joinpaths(installroot, ZIMAGE_LDS)
zimage_lds = copy(zimage_lds,
joinpaths(outputroot, ppcdir))
# change current working dir
cwd = os.getcwd()
os.chdir(joinpaths(outputroot, ppcdir))
# run mkzimage
rc = exec([mkzimage, kernel.fpath, "no", "no", initrd_fpath,
zimage_stub, ppc_img_fpath])
# remove zImage.lds
remove(zimage_lds)
# return to former working dir
os.chdir(cwd)
elif (exists(wrapper) and exists(wrapper_a)):
# run wrapper
rc = exec([wrapper, "-o", ppc_img_fpath, "-i", initrd_fpath,
"-D", dirname(wrapper_a), kernel.fpath])
if (exists(ppc_img_fpath)):
# add ppc image to .treeinfo
with open(treeinfo, "a") as f:
f.write("zimage = %s\n" % joinpaths(NETBOOTDIR, ppc_img_fname))
if (bits == 32):
# set up prepboot
prepboot = "-prep-boot %s" % joinpaths(NETBOOTDIR, ppc_img_fname)
if (empty(joinpaths(outputroot, NETBOOTDIR))):
remove(joinpaths(outputroot, NETBOOTDIR))
# copy bootinfo.txt
copy(joinpaths(installroot, ANABOOTDIR, "bootinfo.txt"),
joinpaths(outputroot, PPCPARENT))
# copy efika.forth
copy(joinpaths(installroot, ANABOOTDIR, "efika.forth"),
joinpaths(outputroot, PPCPARENT))
# copy yaboot to chrp dir
yaboot = joinpaths(installroot, "usr/lib/yaboot/yaboot")
yaboot = copy(yaboot, joinpaths(outputroot, CHRPDIR))
if (exists(joinpaths(outputroot, MACDIR))):
# copy yaboot and ofboot.b to mac dir
copy(yaboot, joinpaths(outputroot, MACDIR))
copy(joinpaths(installroot, ANABOOTDIR, "ofboot.b"),
joinpaths(outputroot, MACDIR))
# set up macboot
p = joinpaths(outputroot, ISOPATHDIR, MACDIR)
macboot = "-hfs-volid %s -hfs-bless %s" % (version, p)
# add note to yaboot
rc = exec([joinpaths(installroot, "usr/lib/yaboot/addnote"), yaboot])
# copy yaboot.conf to etc dir
if (biarch):
yabootconf = copy(joinpaths(installroot, ANABOOTDIR, "yaboot.conf.3264"),
joinpaths(outputroot, ETCDIR, "yaboot.conf"))
replace(yabootconf, "%BITS%", "32")
replace(yabootconf, "%PRODUCT%", product)
replace(yabootconf, "%VERSION%", version)
else:
copy(joinpaths(outputroot, ppcdir, "yaboot.conf"),
joinpaths(outputroot, ETCDIR))
if (bootiso):
# create isopath dir
isopathdir = joinpaths(outputroot, ISOPATHDIR)
makedirs(isopathdir)
# copy etc dir and ppc dir to isopath dir
copytree(joinpaths(outputroot, ETCDIR), isopathdir)
copytree(joinpaths(outputroot, PPCPARENT), isopathdir)
if (exists(joinpaths(outputroot, NETBOOTDIR))):
# if we have ppc images, create images dir in isopath dir
imagesdir = joinpaths(isopathdir, IMAGESDIR)
makedirs(imagesdir)
# copy netboot dir to images dir
copytree(joinpaths(outputroot, NETBOOTDIR), imagesdir)
# define prepboot and macboot
prepboot = "" if "prepboot" not in locals() else locals()["prepboot"]
macboot = "" if "macboot" not in locals() else locals()["macboot"]
# create boot.iso
bootiso_fpath = joinpaths(outputroot, IMAGESDIR, bootiso)
# run mkisofs
rc = exec([MKISOFS, "-o", bootiso_fpath, "-chrp-boot", "-U", prepboot,
"-part", "-hfs", "-T", "-r", "-l", "-J", "-A",
'"%s %s"' % (product, version), "-sysid", "PPC", "-V", '"PBOOT"',
"-volset", '"%s"' % version, "-volset-size", "1",
"-volset-seqno", "1", macboot, "-map", MAPPING, "-magic", MAGIC,
"-no-desktop", "-allow-multidot", "-graft-points", isopathdir])
# run implantisomd5
rc = exec([IMPLANTISOMD5, bootiso_fpath])
# remove isopath dir
remove(isopathdir)

View File

@ -1,74 +0,0 @@
# s390.pseudo.py
##### constants #####
ANABOOTDIR = "usr/share/anaconda/boot"
IMAGESDIR = "images"
INITRD_ADDRESS = "0x02000000"
ADDRSIZE = "usr/%s/anaconda/addrsize" % libdir
MKS390CDBOOT = "usr/%s/anaconda/mk-s390-cdboot" % libdir
##### main() #####
""" kernellist, installroot, outputroot, product, version, treeinfo, bootiso
"""
# create directories
makedirs(joinpaths(outputroot, IMAGESDIR))
# copy redhat.exec
copy(joinpaths(installroot, ANABOOTDIR, "redhat.exec"),
joinpaths(outputroot, IMAGESDIR))
# copy generic.prm
generic_prm = copy(joinpaths(installroot, ANABOOTDIR, "generic.prm"),
joinpaths(outputroot, IMAGESDIR))
# copy generic.ins
generic_ins = copy(joinpaths(installroot, ANABOOTDIR, "generic.ins"),
outputroot)
replace(generic_ins, "@INITRD_LOAD_ADDRESS@", INITRD_ADDRESS)
for kernel in kernellist:
# copy kernel
kernel.fname = "kernel.img"
kernel.fpath = copy(kernel.fpath,
joinpaths(outputroot, IMAGESDIR, kernel.fname))
# create and copy initrd
initrd_fname = "initrd.img"
initrd_fpath = copy(create_initrd(kernel),
joinpaths(outputroot, IMAGESDIR, initrd_fname))
# run addrsize
initrd_addrsize = "initrd_addrsize"
rc = exec([ADDRSIZE, INITRD_ADDRESS, initrd_fpath,
joinpaths(outputroot, IMAGESDIR, initrd_addrsize)])
# add kernel and initrd to .treeinfo
with open(treeinfo, "a") as f:
f.write("[images-%s]\n" % kernel.arch)
f.write("kernel = %s\n" % joinpaths(IMAGESDIR, kernel.fname))
f.write("initrd = %s\n" % joinpaths(IMAGESDIR, initrd_fname))
f.write("initrd.addrsize = %s\n" % joinpaths(IMAGESDIR,
initrd_addrsize))
f.write("generic.prm = %s\n" % joinpaths(IMAGESDIR,
basename(generic_prm)))
f.write("generic.ins = %s\n" % basename(generic_ins))
f.write("cdboot.img = %s\n" % joinpaths(IMAGESDIR, bootiso))
if (bootiso):
# create boot.iso
bootiso_fpath = joinpaths(outputroot, IMAGESDIR, bootiso)
# run mks390cdboot
rc = exec([MKS390CDBOOT, "-i", kernel.fpath, "-r", initrd_fpath,
"-p", generic_prm, "-o", bootiso_fpath])

View File

@ -1,87 +0,0 @@
# sparc.pseudo.py
##### constants #####
ANABOOTDIR = "usr/share/anaconda/boot"
IMAGESDIR = "images"
SPARCDIR = "boot"
ISOPATHDIR = "isopath"
MKISOFS = "mkisofs"
IMPLANTISOMD5 = "implantisomd5"
##### main() #####
""" kernellist, installroot, outputroot, product, version, treeinfo, bootiso
"""
# create directories
makedirs(joinpaths(outputroot, IMAGESDIR))
makedirs(joinpaths(outputroot, SPARCDIR))
# copy silo.conf
siloconf = copy(joinpaths(installroot, ANABOOTDIR, "silo.conf"),
joinpaths(outputroot, SPARCDIR))
# copy boot.msg
bootmsg = copy(joinpaths(installroot, ANABOOTDIR, "boot.msg"),
joinpaths(outputroot, SPARCDIR))
replace(bootmsg, "%PRODUCT%", product)
replace(bootmsg, "%VERSION%", version)
# copy *.b to sparc dir
copy(joinpaths(installroot, ANABOOTDIR, "*.b"),
joinpaths(outputroot, SPARCDIR))
# create images
for kernel in kernellist:
# copy kernel
kernel.fname = "vmlinuz"
kernel.fpath = copy(kernel.fpath,
joinpaths(outputroot, SPARCDIR, kernel.fname))
# create and copy initrd
initrd_fname = "initrd.img"
initrd_fpath = copy(create_initrd(kernel),
joinpaths(outputroot, SPARCDIR, initrd_fname))
# add kernel and initrd to .treeinfo
with open(treeinfo, "a") as f:
f.write("[images-%s]\n" % kernel.arch)
f.write("kernel = %s\n" % joinpaths(SPARCDIR, kernel.fname))
f.write("initrd = %s\n" % joinpaths(SPARCDIR, initrd_fname))
if (bootiso):
# create isopath dir
isopathdir = joinpaths(outputroot, ISOPATHDIR)
makedirs(isopathdir)
# copy sparc dir to isopath dir
copytree(joinpaths(outputroot, SPARCDIR), isopathdir)
# create boot.iso
bootiso_fpath = joinpaths(outputroot, IMAGESDIR, bootiso)
# run mkisofs (XXX what's with the "Fedora" exclude?)
rc = exec([MKISOFS, "-R", "-J", "-T",
"-G", "/%s" % joinpaths(SPARCDIR, "isofs.b"),
"-B", "...",
"-s", "/%s" % joinpaths(SPARCDIR, "silo.conf"),
"-r", "-V", '"PBOOT"', "-A", '"%s %s"' % (product, version),
"-x", "Fedora", "-x", "repodata",
"-sparc-label", '"%s %s Boot Disc"' % (product, version),
"-o", bootiso_fpath, "-graft-points",
"boot=%s" % joinpaths(outputroot, SPARCDIR)])
# run implantisomd5
rc = exec([IMPLANTISOMD5, bootiso_fpath])
# remove isopath dir
remove(isopathdir)

View File

@ -1,155 +0,0 @@
# x86.pseudo.py
##### constants #####
ANABOOTDIR = "usr/share/anaconda/boot"
ISOLINUXDIR = "isolinux"
IMAGESDIR = "images"
PXEBOOTDIR = "images/pxeboot"
ISOLINUX_BIN = "usr/share/syslinux/isolinux.bin"
SYSLINUX_CFG = "usr/share/anaconda/boot/syslinux.cfg"
ISOHYBRID = "isohybrid"
IMPLANTISOMD5 = "implantisomd5"
##### main() #####
""" kernellist, installroot, outputroot, product, version, treeinfo, bootiso,
basearch, uefi_boot_iso
"""
# create directories
makedirs(joinpaths(outputroot, ISOLINUXDIR))
makedirs(joinpaths(outputroot, PXEBOOTDIR))
# check for isolinux.bin
isolinux_bin = joinpaths(installroot, ISOLINUX_BIN)
if (not exists(isolinux_bin)):
# XXX fatal?
raise Exception("isolinux.bin not present")
# copy isolinux.bin to isolinux dir
copy(isolinux_bin, joinpaths(outputroot, ISOLINUXDIR))
# copy syslinux.cfg to isolinux dir (XXX rename to isolinux.cfg)
isolinux_cfg = copy(joinpaths(installroot, SYSLINUX_CFG),
joinpaths(outputroot, ISOLINUXDIR, "isolinux.cfg"))
replace(isolinux_cfg, "@PRODUCT@", product)
replace(isolinux_cfg, "@VERSION@", version)
# copy memtest (XXX not from installroot/boot ?
memtest = glob(joinpaths(installroot, ANABOOTDIR, "memtest*"))
if memtest:
copy(memtest[-1], joinpaths(outputroot, ISOLINUXDIR, "memtest"))
with open(isolinux_cfg, "a") as f:
f.write("label memtest86\n")
f.write(" menu label ^Memory test\n")
f.write(" kernel memtest\n")
f.write(" append -\n")
# copy *.msg files
msgfiles = glob(joinpaths(installroot, ANABOOTDIR, "*.msg"))
if (not msgfiles):
raise Exception("message files not present")
for source_path in msgfiles:
target_path = copy(source_path, joinpaths(outputroot, ISOLINUXDIR))
replace(target_path, "@VERSION@", version)
# copy syslinux vesa splash and vesamenu.c32
splash = joinpaths(installroot, ANABOOTDIR, "syslinux-vesa-splash.jpg")
if (not exists(splash)):
raise Exception("syslinux-vesa-splash.jpg not present")
splash = copy(splash, joinpaths(outputroot, ISOLINUXDIR, "splash.jpg"))
copy(joinpaths(installroot, "usr/share/syslinux/vesamenu.c32"),
joinpaths(outputroot, ISOLINUXDIR))
# set up isolinux.cfg
replace(isolinux_cfg, "default linux", "default vesamenu.c32")
replace(isolinux_cfg, "prompt 1", "#prompt 1")
# copy grub.conf
grubconf = copy(joinpaths(installroot, ANABOOTDIR, "grub.conf"),
joinpaths(outputroot, ISOLINUXDIR))
replace(grubconf, "@PRODUCT@", product)
replace(grubconf, "@VERSION@", version)
# create images
for kernel in kernellist:
# set up file names
suffix = ""
if (kernel.type == K_PAE):
suffix = "-PAE"
elif (kernel.type == K_XEN):
suffix = "-XEN"
kernel.fname = "vmlinuz%s" % suffix
if (not suffix):
# copy kernel to isolinux dir
kernel.fpath = copy(kernel.fpath,
joinpaths(outputroot, ISOLINUXDIR, kernel.fname))
# create link in pxeboot dir
os.link(kernel.fpath, joinpaths(outputroot, PXEBOOTDIR, kernel.fname))
else:
# copy kernel to pxeboot dir
kernel.fpath = copy(kernel.fpath,
joinpaths(outputroot, PXEBOOTDIR, kernel.fname))
# create and copy initrd to pxeboot dir
initrd_fname = "initrd%s.img" % suffix
initrd_fpath = copy(create_initrd(kernel),
joinpaths(outputroot, PXEBOOTDIR, initrd_fname))
if (not suffix):
# create link in isolinux dir
os.link(initrd_fpath, joinpaths(outputroot, ISOLINUXDIR, initrd_fname))
# add kernel and initrd to .treeinfo
with open(treeinfo, "a") as f:
f.write("[images-%s]\n" % "xen" if suffix else basearch)
f.write("kernel = %s\n" % joinpaths(PXEBOOTDIR, kernel.fname))
f.write("initrd = %s\n" % joinpaths(PXEBOOTDIR, initrd_fname))
if (not suffix):
# add boot.iso to .treeinfo
with open(treeinfo, "a") as f:
f.write("boot.iso = %s\n" % joinpaths(IMAGESDIR, bootiso))
if (bootiso):
# define efiargs and efigraft
efiargs, efigraft = [], []
if (uefi_boot_iso and
exists(joinpaths(outputroot, IMAGESDIR, "efiboot.img"))):
efiargs = ["-eltorito-alt-boot", "-e",
joinpaths(IMAGESDIR, "efiboot.img"), "-no-emul-boot"]
efigraft = ["EFI/BOOT=%s/EFI/BOOT" % outputroot]
# create boot.iso
bootiso_fpath = joinpaths(outputroot, IMAGESDIR, bootiso)
# run mkisofs
rc = exec([MKISOFS, "-v", "-o", bootiso_fpath, "-b",
"%s/isolinux.bin" % ISOLINUXDIR, "-c",
"%s/boot.cat" % ISOLINUXDIR, "-no-emul-boot", "-boot-load-size",
"4", "-boot-info-table"] + EFIARGS + ["-R", "-J", "-V",
"'%s'" % product, "-T", "-graft-points",
"isolinux=%s" % joinpaths(outputroot, ISOLINUXDIR),
"images=%s" % joinpaths(outputroot, IMAGESDIR)] + EFIGRAFT)
if (exists(ISOHYBRID)):
# run isohybrid
rc = exec([ISOHYBRID, bootiso_fpath])
# run implantisomd5
rc = exec([IMPLANTISOMD5, bootiso_fpath])