Remove unused code
This commit is contained in:
		
							parent
							
								
									19637aa986
								
							
						
					
					
						commit
						be1178f4c5
					
				| @ -341,13 +341,6 @@ class Lorax(BaseLoraxClass): | |||||||
|         self.outputtree = LoraxOutputTree(self.outputdir, self.installtree, |         self.outputtree = LoraxOutputTree(self.outputdir, self.installtree, | ||||||
|                                           self.product, self.version) |                                           self.product, self.version) | ||||||
| 
 | 
 | ||||||
|         #self.outputtree.prepare() |  | ||||||
|         #self.outputtree.get_isolinux() |  | ||||||
|         #self.outputtree.get_memtest() |  | ||||||
|         #self.outputtree.get_splash() |  | ||||||
|         #self.outputtree.get_msg_files() |  | ||||||
|         #self.outputtree.get_grub_conf() |  | ||||||
| 
 |  | ||||||
|         # write .discinfo |         # write .discinfo | ||||||
|         discinfo = DiscInfo(self.workdir, self.release, self.basearch) |         discinfo = DiscInfo(self.workdir, self.release, self.basearch) | ||||||
|         discinfo.write() |         discinfo.write() | ||||||
| @ -446,47 +439,6 @@ class Lorax(BaseLoraxClass): | |||||||
|         logger.info("creating the initrd") |         logger.info("creating the initrd") | ||||||
|         i.create_initrd(self.libdir) |         i.create_initrd(self.libdir) | ||||||
| 
 | 
 | ||||||
|         #initrds = [] |  | ||||||
|         #for kernel in self.outputtree.kernels: |  | ||||||
|         #    suffix = "" |  | ||||||
|         #    if kernel.ktype == constants.K_PAE: |  | ||||||
|         #        suffix = "-PAE" |  | ||||||
|         #    elif kernel.ktype == constants.K_XEN: |  | ||||||
|         #        suffix = "-XEN" |  | ||||||
|         # |  | ||||||
|         #    fname = "initrd{0}.img".format(suffix) |  | ||||||
|         # |  | ||||||
|         #    initrd = DataHolder(fname=fname, |  | ||||||
|         #                        fpath=joinpaths(self.workdir, fname), |  | ||||||
|         #                        itype=kernel.ktype) |  | ||||||
|         # |  | ||||||
|         #    logger.info("compressing install tree ({0})".format(kernel.version)) |  | ||||||
|         #    success, elapsed = self.installtree.compress(initrd, kernel) |  | ||||||
|         #    if not success: |  | ||||||
|         #        logger.error("error while compressing install tree") |  | ||||||
|         #    else: |  | ||||||
|         #        logger.info("took {0:.2f} seconds".format(elapsed)) |  | ||||||
|         # |  | ||||||
|         #    initrds.append(initrd) |  | ||||||
|         # |  | ||||||
|         #    # add kernel and initrd paths to .treeinfo |  | ||||||
|         #    section = "images-{0}".format("xen" if suffix else self.basearch) |  | ||||||
|         #    data = {"kernel": "images/pxeboot/{0}".format(kernel.fname)} |  | ||||||
|         #    treeinfo.add_section(section, data) |  | ||||||
|         #    data = {"initrd": "images/pxeboot/{0}".format(initrd.fname)} |  | ||||||
|         #    treeinfo.add_section(section, data) |  | ||||||
|         # |  | ||||||
|         ## copy initrds to outputtree |  | ||||||
|         #shutil.copy2(initrds[0].fpath, self.outputtree.isolinuxdir) |  | ||||||
|         # |  | ||||||
|         ## create hard link |  | ||||||
|         #source = joinpaths(self.outputtree.isolinuxdir, initrds[0].fname) |  | ||||||
|         #link_name = joinpaths(self.outputtree.pxebootdir, initrds[0].fname) |  | ||||||
|         #os.link(source, link_name) |  | ||||||
|         # |  | ||||||
|         #for initrd in initrds[1:]: |  | ||||||
|         #    shutil.copy2(initrd.fpath, self.outputtree.pxebootdir) |  | ||||||
| 
 |  | ||||||
|         # create efi images |         # create efi images | ||||||
|         efiboot = None |         efiboot = None | ||||||
|         if grubefi and self.efiarch not in ("IA32",): |         if grubefi and self.efiarch not in ("IA32",): | ||||||
| @ -538,18 +490,6 @@ class Lorax(BaseLoraxClass): | |||||||
|         logger.info("creating boot iso") |         logger.info("creating boot iso") | ||||||
|         i.create_boot(efiboot) |         i.create_boot(efiboot) | ||||||
| 
 | 
 | ||||||
|         #bootiso = self.create_bootiso(self.outputtree, efiboot) |  | ||||||
|         #if bootiso is None: |  | ||||||
|         #    logger.critical("unable to create boot iso") |  | ||||||
|         #    sys.exit(1) |  | ||||||
|         # |  | ||||||
|         #shutil.move(bootiso, self.outputtree.imgdir) |  | ||||||
|         # |  | ||||||
|         ## add the boot.iso |  | ||||||
|         #section = "images-{0}".format(self.basearch) |  | ||||||
|         #data = {"boot.iso": "images/{0}".format(os.path.basename(bootiso))} |  | ||||||
|         #treeinfo.add_section(section, data) |  | ||||||
| 
 |  | ||||||
|         treeinfo.write() |         treeinfo.write() | ||||||
| 
 | 
 | ||||||
|         shutil.copy2(treeinfo.path, self.outputtree.root) |         shutil.copy2(treeinfo.path, self.outputtree.root) | ||||||
| @ -733,42 +673,3 @@ class Lorax(BaseLoraxClass): | |||||||
|         remove_loop_dev(loopdev) |         remove_loop_dev(loopdev) | ||||||
| 
 | 
 | ||||||
|         return efidisk |         return efidisk | ||||||
| 
 |  | ||||||
|     def create_bootiso(self, outputtree, efiboot=None): |  | ||||||
|         bootiso = joinpaths(self.workdir, "boot.iso") |  | ||||||
|         if os.path.isfile(bootiso): |  | ||||||
|             os.unlink(bootiso) |  | ||||||
| 
 |  | ||||||
|         if efiboot is not None: |  | ||||||
|             efiargs = ["-eltorito-alt-boot", "-e", "images/efiboot.img", |  | ||||||
|                        "-no-emul-boot"] |  | ||||||
|             efigraft = ["EFI/BOOT={0}".format(outputtree.efibootdir)] |  | ||||||
|         else: |  | ||||||
|             efiargs = [] |  | ||||||
|             efigraft = [] |  | ||||||
| 
 |  | ||||||
|         cmd = [self.lcmds.MKISOFS, "-o", bootiso, |  | ||||||
|                "-b", "isolinux/isolinux.bin", "-c", "isolinux/boot.cat", |  | ||||||
|                "-no-emul-boot", "-boot-load-size", "4", |  | ||||||
|                "-boot-info-table"] + efiargs + ["-R", "-J", "-V", self.product, |  | ||||||
|                "-T", "-graft-points", |  | ||||||
|                "isolinux={0}".format(outputtree.isolinuxdir), |  | ||||||
|                "images={0}".format(outputtree.imgdir)] + efigraft |  | ||||||
|         logger.debug(cmd) |  | ||||||
|         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) |  | ||||||
|         retcode = proc.wait() |  | ||||||
| 
 |  | ||||||
|         if not retcode == 0: |  | ||||||
|             return None |  | ||||||
| 
 |  | ||||||
|         # create hybrid iso |  | ||||||
|         cmd = [self.lcmds.ISOHYBRID, bootiso] |  | ||||||
|         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) |  | ||||||
|         retcode = proc.wait() |  | ||||||
| 
 |  | ||||||
|         # implant iso md5 |  | ||||||
|         cmd = [self.lcmds.IMPLANTISOMD5, bootiso] |  | ||||||
|         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) |  | ||||||
|         retcode = proc.wait() |  | ||||||
| 
 |  | ||||||
|         return bootiso |  | ||||||
|  | |||||||
| @ -43,28 +43,6 @@ class LoraxOutputTree(BaseLoraxClass): | |||||||
|         self.product = product |         self.product = product | ||||||
|         self.version = version |         self.version = version | ||||||
| 
 | 
 | ||||||
|     def prepare(self): |  | ||||||
|         imgdir = joinpaths(self.root, "images") |  | ||||||
|         os.makedirs(imgdir) |  | ||||||
|         logger.debug("created directory {0}".format(imgdir)) |  | ||||||
| 
 |  | ||||||
|         pxebootdir = joinpaths(self.root, "images/pxeboot") |  | ||||||
|         os.makedirs(pxebootdir) |  | ||||||
|         logger.debug("created directory {0}".format(pxebootdir)) |  | ||||||
| 
 |  | ||||||
|         isolinuxdir = joinpaths(self.root, "isolinux") |  | ||||||
|         os.makedirs(isolinuxdir) |  | ||||||
|         logger.debug("created directory {0}".format(isolinuxdir)) |  | ||||||
| 
 |  | ||||||
|         efibootdir = joinpaths(self.root, "EFI/BOOT") |  | ||||||
|         os.makedirs(efibootdir) |  | ||||||
|         logger.debug("created directory {0}".format(efibootdir)) |  | ||||||
| 
 |  | ||||||
|         self.imgdir = imgdir |  | ||||||
|         self.pxebootdir = pxebootdir |  | ||||||
|         self.isolinuxdir = isolinuxdir |  | ||||||
|         self.efibootdir = efibootdir |  | ||||||
| 
 |  | ||||||
|     def get_kernels(self, workdir): |     def get_kernels(self, workdir): | ||||||
|         self.kernels = [] |         self.kernels = [] | ||||||
| 
 | 
 | ||||||
| @ -80,109 +58,8 @@ class LoraxOutputTree(BaseLoraxClass): | |||||||
|             dst = joinpaths(workdir, kname) |             dst = joinpaths(workdir, kname) | ||||||
|             shutil.copy2(kernel.fpath, dst) |             shutil.copy2(kernel.fpath, dst) | ||||||
| 
 | 
 | ||||||
|             #if n == 0: |  | ||||||
|             #    # copy main kernel to isolinuxdir |  | ||||||
|             #    dst = joinpaths(self.isolinuxdir, kname) |  | ||||||
|             #    shutil.copy2(kernel.fpath, dst) |  | ||||||
|             # |  | ||||||
|             #    # create hard link to main kernel in pxebootdir |  | ||||||
|             #    link_name = joinpaths(self.pxebootdir, kname) |  | ||||||
|             #    os.link(dst, link_name) |  | ||||||
|             #else: |  | ||||||
|             #    # copy other kernels to pxebootdir |  | ||||||
|             #    dst = joinpaths(self.pxebootdir, kname) |  | ||||||
|             #    shutil.copy2(kernel.fpath, dst) |  | ||||||
| 
 |  | ||||||
|             # change the fname and fpath to new values |             # change the fname and fpath to new values | ||||||
|             self.kernels.append(DataHolder(fname=kname, |             self.kernels.append(DataHolder(fname=kname, | ||||||
|                                            fpath=dst, |                                            fpath=dst, | ||||||
|                                            version=kernel.version, |                                            version=kernel.version, | ||||||
|                                            ktype=kernel.ktype)) |                                            ktype=kernel.ktype)) | ||||||
| 
 |  | ||||||
|     def get_isolinux(self): |  | ||||||
|         isolinuxbin = joinpaths(self.installtree.root, |  | ||||||
|                                 "usr/share/syslinux/isolinux.bin") |  | ||||||
|         syslinuxcfg = joinpaths(self.installtree.root, |  | ||||||
|                                 "usr/share/anaconda/boot/syslinux.cfg") |  | ||||||
| 
 |  | ||||||
|         # copy isolinux.bin |  | ||||||
|         shutil.copy2(isolinuxbin, self.isolinuxdir) |  | ||||||
| 
 |  | ||||||
|         # copy syslinux.cfg |  | ||||||
|         self.isolinuxcfg = joinpaths(self.isolinuxdir, "isolinux.cfg") |  | ||||||
|         shutil.copy2(syslinuxcfg, self.isolinuxcfg) |  | ||||||
| 
 |  | ||||||
|         # set product and version in isolinux.cfg |  | ||||||
|         replace(self.isolinuxcfg, r"@PRODUCT@", self.product) |  | ||||||
|         replace(self.isolinuxcfg, r"@VERSION@", self.version) |  | ||||||
| 
 |  | ||||||
|     def get_memtest(self): |  | ||||||
|         # copy memtest |  | ||||||
|         memtest = joinpaths(self.installtree.root, |  | ||||||
|                             "boot/memtest*") |  | ||||||
| 
 |  | ||||||
|         for fname in glob.glob(memtest): |  | ||||||
|             shutil.copy2(fname, joinpaths(self.isolinuxdir, "memtest")) |  | ||||||
| 
 |  | ||||||
|             text = """label memtest86 |  | ||||||
|   menu label ^Memory test |  | ||||||
|   kernel memtest |  | ||||||
|   append - |  | ||||||
| 
 |  | ||||||
| """ |  | ||||||
| 
 |  | ||||||
|             with open(self.isolinuxcfg, "a") as fobj: |  | ||||||
|                 fobj.write(text) |  | ||||||
| 
 |  | ||||||
|             break |  | ||||||
| 
 |  | ||||||
|     def get_splash(self): |  | ||||||
|         vesasplash = joinpaths(self.installtree.root, "usr/share/anaconda", |  | ||||||
|                                "boot/syslinux-vesa-splash.jpg") |  | ||||||
| 
 |  | ||||||
|         vesamenu = joinpaths(self.installtree.root, |  | ||||||
|                              "usr/share/syslinux/vesamenu.c32") |  | ||||||
| 
 |  | ||||||
|         splashtolss = joinpaths(self.installtree.root, |  | ||||||
|                                 "usr/share/anaconda/splashtolss.sh") |  | ||||||
| 
 |  | ||||||
|         syslinuxsplash = joinpaths(self.installtree.root, "usr/share/anaconda", |  | ||||||
|                                    "boot/syslinux-splash.jpg") |  | ||||||
| 
 |  | ||||||
|         splashlss = joinpaths(self.installtree.root, "usr/share/anaconda", |  | ||||||
|                               "boot/splash.lss") |  | ||||||
| 
 |  | ||||||
|         if os.path.isfile(vesasplash): |  | ||||||
|             shutil.copy2(vesasplash, joinpaths(self.isolinuxdir, "splash.jpg")) |  | ||||||
|             shutil.copy2(vesamenu, self.isolinuxdir) |  | ||||||
|             replace(self.isolinuxcfg, r"default linux", "default vesamenu.c32") |  | ||||||
|             replace(self.isolinuxcfg, r"prompt 1", "#prompt 1") |  | ||||||
|         elif os.path.isfile(splashtolss): |  | ||||||
|             cmd = [splashtolss, syslinuxsplash, splashlss] |  | ||||||
|             proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) |  | ||||||
|             retcode = proc.wait() |  | ||||||
|             if not retcode == 0: |  | ||||||
|                 logger.error("failed to create splash.lss") |  | ||||||
|                 sys.exit(1) |  | ||||||
| 
 |  | ||||||
|             if os.path.isfile(splashlss): |  | ||||||
|                 shutil.copy2(splashlss, self.isolinuxdir) |  | ||||||
| 
 |  | ||||||
|     def get_msg_files(self): |  | ||||||
|         msgfiles = joinpaths(self.installtree.root, |  | ||||||
|                              "usr/share/anaconda/boot/*.msg") |  | ||||||
| 
 |  | ||||||
|         for fname in glob.glob(msgfiles): |  | ||||||
|             shutil.copy2(fname, self.isolinuxdir) |  | ||||||
|             path = joinpaths(self.isolinuxdir, os.path.basename(fname)) |  | ||||||
|             replace(path, r"@VERSION@", self.version) |  | ||||||
| 
 |  | ||||||
|     def get_grub_conf(self): |  | ||||||
|         grubconf = joinpaths(self.installtree.root, |  | ||||||
|                              "usr/share/anaconda/boot/grub.conf") |  | ||||||
| 
 |  | ||||||
|         shutil.copy2(grubconf, self.isolinuxdir) |  | ||||||
| 
 |  | ||||||
|         grubconf = joinpaths(self.isolinuxdir, "grub.conf") |  | ||||||
|         replace(grubconf, r"@PRODUCT@", self.product) |  | ||||||
|         replace(grubconf, r"@VERSION@", self.version) |  | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user