1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

wic: fix short variable names

Made short variable names longer and more readable.

Fixed pylint warnings "Invalid variable name" and
"Invalid argument name".

(From OE-Core rev: 872cb0d5d79b26f34e6b35d7be8870d245021be4)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh
2015-09-02 13:58:16 +03:00
committed by Richard Purdie
parent 14b47e22f9
commit 791a3912d9
16 changed files with 286 additions and 289 deletions
@@ -50,8 +50,8 @@ class DirectPlugin(ImagerPlugin):
"""
krootfs_dir = {}
for rootfs_dir in rootfs_dirs.split(' '):
k, v = rootfs_dir.split('=')
krootfs_dir[k] = v
key, val = rootfs_dir.split('=')
krootfs_dir[key] = val
return krootfs_dir
+13 -13
View File
@@ -41,16 +41,16 @@ class BootimgEFIPlugin(SourcePlugin):
name = 'bootimg-efi'
@classmethod
def do_configure_grubefi(cls, hdddir, cr, cr_workdir):
def do_configure_grubefi(cls, hdddir, creator, cr_workdir):
"""
Create loader-specific (grub-efi) config
"""
options = cr.ks.handler.bootloader.appendLine
options = creator.ks.handler.bootloader.appendLine
grubefi_conf = ""
grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n"
grubefi_conf += "default=boot\n"
timeout = kickstart.get_timeout(cr.ks)
timeout = kickstart.get_timeout(creator.ks)
if not timeout:
timeout = 0
grubefi_conf += "timeout=%s\n" % timeout
@@ -59,7 +59,7 @@ class BootimgEFIPlugin(SourcePlugin):
kernel = "/bzImage"
grubefi_conf += "linux %s root=%s rootwait %s\n" \
% (kernel, cr.rootdev, options)
% (kernel, creator.rootdev, options)
grubefi_conf += "}\n"
msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" \
@@ -69,7 +69,7 @@ class BootimgEFIPlugin(SourcePlugin):
cfg.close()
@classmethod
def do_configure_gummiboot(cls, hdddir, cr, cr_workdir):
def do_configure_gummiboot(cls, hdddir, creator, cr_workdir):
"""
Create loader-specific (gummiboot) config
"""
@@ -79,9 +79,9 @@ class BootimgEFIPlugin(SourcePlugin):
install_cmd = "install -d %s/loader/entries" % hdddir
exec_cmd(install_cmd)
options = cr.ks.handler.bootloader.appendLine
options = creator.ks.handler.bootloader.appendLine
timeout = kickstart.get_timeout(cr.ks)
timeout = kickstart.get_timeout(creator.ks)
if not timeout:
timeout = 0
@@ -100,7 +100,7 @@ class BootimgEFIPlugin(SourcePlugin):
boot_conf = ""
boot_conf += "title boot\n"
boot_conf += "linux %s\n" % kernel
boot_conf += "options LABEL=Boot root=%s %s\n" % (cr.rootdev, options)
boot_conf += "options LABEL=Boot root=%s %s\n" % (creator.rootdev, options)
msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \
% cr_workdir)
@@ -110,7 +110,7 @@ class BootimgEFIPlugin(SourcePlugin):
@classmethod
def do_configure_partition(cls, part, source_params, cr, cr_workdir,
def do_configure_partition(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot):
"""
@@ -125,9 +125,9 @@ class BootimgEFIPlugin(SourcePlugin):
try:
if source_params['loader'] == 'grub-efi':
cls.do_configure_grubefi(hdddir, cr, cr_workdir)
cls.do_configure_grubefi(hdddir, creator, cr_workdir)
elif source_params['loader'] == 'gummiboot':
cls.do_configure_gummiboot(hdddir, cr, cr_workdir)
cls.do_configure_gummiboot(hdddir, creator, cr_workdir)
else:
msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader'])
except KeyError:
@@ -135,7 +135,7 @@ class BootimgEFIPlugin(SourcePlugin):
@classmethod
def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
rootfs_dir, native_sysroot):
"""
@@ -148,7 +148,7 @@ class BootimgEFIPlugin(SourcePlugin):
if not bootimg_dir:
msger.error("Couldn't find HDDDIR, exiting\n")
# just so the result notes display it
cr.set_bootimg_dir(bootimg_dir)
creator.set_bootimg_dir(bootimg_dir)
staging_kernel_dir = kernel_dir
@@ -41,36 +41,36 @@ class BootimgPcbiosPlugin(SourcePlugin):
name = 'bootimg-pcbios'
@classmethod
def do_install_disk(cls, disk, disk_name, cr, workdir, oe_builddir,
def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
bootimg_dir, kernel_dir, native_sysroot):
"""
Called after all partitions have been prepared and assembled into a
disk image. In this case, we install the MBR.
"""
mbrfile = "%s/syslinux/" % bootimg_dir
if cr.ptable_format == 'msdos':
if creator.ptable_format == 'msdos':
mbrfile += "mbr.bin"
elif cr.ptable_format == 'gpt':
elif creator.ptable_format == 'gpt':
mbrfile += "gptmbr.bin"
else:
msger.error("Unsupported partition table: %s" % cr.ptable_format)
msger.error("Unsupported partition table: %s" % creator.ptable_format)
if not os.path.exists(mbrfile):
msger.error("Couldn't find %s. If using the -e option, do you "
"have the right MACHINE set in local.conf? If not, "
"is the bootimg_dir path correct?" % mbrfile)
full_path = cr._full_path(workdir, disk_name, "direct")
full_path = creator._full_path(workdir, disk_name, "direct")
msger.debug("Installing MBR on disk %s as %s with size %s bytes" \
% (disk_name, full_path, disk['min_size']))
rc = runner.show(['dd', 'if=%s' % mbrfile,
'of=%s' % full_path, 'conv=notrunc'])
if rc != 0:
rcode = runner.show(['dd', 'if=%s' % mbrfile,
'of=%s' % full_path, 'conv=notrunc'])
if rcode != 0:
raise ImageError("Unable to set MBR to %s" % full_path)
@classmethod
def do_configure_partition(cls, part, source_params, cr, cr_workdir,
def do_configure_partition(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot):
"""
@@ -89,11 +89,11 @@ class BootimgPcbiosPlugin(SourcePlugin):
else:
splashline = ""
options = cr.ks.handler.bootloader.appendLine
options = creator.ks.handler.bootloader.appendLine
syslinux_conf = ""
syslinux_conf += "PROMPT 0\n"
timeout = kickstart.get_timeout(cr.ks)
timeout = kickstart.get_timeout(creator.ks)
if not timeout:
timeout = 0
syslinux_conf += "TIMEOUT " + str(timeout) + "\n"
@@ -110,7 +110,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
syslinux_conf += "KERNEL " + kernel + "\n"
syslinux_conf += "APPEND label=boot root=%s %s\n" % \
(cr.rootdev, options)
(creator.rootdev, options)
msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \
% cr_workdir)
@@ -119,7 +119,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
cfg.close()
@classmethod
def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
rootfs_dir, native_sysroot):
"""
@@ -141,7 +141,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
if not _has_syslinux(bootimg_dir):
msger.error("Please build syslinux first\n")
# just so the result notes display it
cr.set_bootimg_dir(bootimg_dir)
creator.set_bootimg_dir(bootimg_dir)
staging_kernel_dir = kernel_dir
@@ -54,7 +54,7 @@ class IsoImagePlugin(SourcePlugin):
name = 'isoimage-isohybrid'
@classmethod
def do_configure_syslinux(cls, cr, cr_workdir):
def do_configure_syslinux(cls, creator, cr_workdir):
"""
Create loader-specific (syslinux) config
"""
@@ -64,9 +64,9 @@ class IsoImagePlugin(SourcePlugin):
else:
splashline = ""
options = cr.ks.handler.bootloader.appendLine
options = creator.ks.handler.bootloader.appendLine
timeout = kickstart.get_timeout(cr.ks, 10)
timeout = kickstart.get_timeout(creator.ks, 10)
syslinux_conf = ""
syslinux_conf += "PROMPT 0\n"
@@ -90,7 +90,7 @@ class IsoImagePlugin(SourcePlugin):
cfg.write(syslinux_conf)
@classmethod
def do_configure_grubefi(cls, part, cr, cr_workdir):
def do_configure_grubefi(cls, part, creator, cr_workdir):
"""
Create loader-specific (grub-efi) config
"""
@@ -100,13 +100,13 @@ class IsoImagePlugin(SourcePlugin):
else:
splashline = ""
options = cr.ks.handler.bootloader.appendLine
options = creator.ks.handler.bootloader.appendLine
grubefi_conf = ""
grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
grubefi_conf += "--parity=no --stop=1\n"
grubefi_conf += "default=boot\n"
timeout = kickstart.get_timeout(cr.ks, 10)
timeout = kickstart.get_timeout(creator.ks, 10)
grubefi_conf += "timeout=%s\n" % timeout
grubefi_conf += "\n"
grubefi_conf += "search --set=root --label %s " % part.label
@@ -185,7 +185,7 @@ class IsoImagePlugin(SourcePlugin):
return initrd
@classmethod
def do_stage_partition(cls, part, source_params, cr, cr_workdir,
def do_stage_partition(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot):
"""
@@ -231,7 +231,7 @@ class IsoImagePlugin(SourcePlugin):
exec_cmd("bitbake mtools-native")
@classmethod
def do_configure_partition(cls, part, source_params, cr, cr_workdir,
def do_configure_partition(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot):
"""
@@ -249,11 +249,11 @@ class IsoImagePlugin(SourcePlugin):
msger.debug("%s" % source_params)
if 'image_name' in source_params and \
source_params['image_name'].strip():
cr.name = source_params['image_name'].strip()
msger.debug("The name of the image is: %s" % cr.name)
creator.name = source_params['image_name'].strip()
msger.debug("The name of the image is: %s" % creator.name)
@classmethod
def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
rootfs_dir, native_sysroot):
"""
@@ -353,7 +353,7 @@ class IsoImagePlugin(SourcePlugin):
exec_cmd(install_cmd)
if not os.path.isfile("%s/EFI/BOOT/boot.cfg" % bootimg_dir):
cls.do_configure_grubefi(part, cr, bootimg_dir)
cls.do_configure_grubefi(part, creator, bootimg_dir)
# Builds bootx64.efi/bootia32.efi if ISODIR didn't exist or
# didn't contains it
@@ -463,7 +463,7 @@ class IsoImagePlugin(SourcePlugin):
install_cmd = "install -d %s/isolinux" % isodir
exec_cmd(install_cmd)
cls.do_configure_syslinux(cr, cr_workdir)
cls.do_configure_syslinux(creator, cr_workdir)
install_cmd = "install -m 444 %s/syslinux/ldlinux.sys " % syslinux_dir
install_cmd += "%s/isolinux/ldlinux.sys" % isodir
@@ -508,7 +508,7 @@ class IsoImagePlugin(SourcePlugin):
part.set_source_file(iso_img)
@classmethod
def do_install_disk(cls, disk, disk_name, cr, workdir, oe_builddir,
def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
bootimg_dir, kernel_dir, native_sysroot):
"""
Called after all partitions have been prepared and assembled into a
@@ -516,9 +516,9 @@ class IsoImagePlugin(SourcePlugin):
utility for booting via BIOS from disk storage devices.
"""
full_path = cr._full_path(workdir, disk_name, "direct")
full_path = creator._full_path(workdir, disk_name, "direct")
iso_img = "%s.p1" % full_path
full_path_iso = cr._full_path(workdir, disk_name, "iso")
full_path_iso = creator._full_path(workdir, disk_name, "iso")
isohybrid_cmd = "isohybrid -u %s" % iso_img
msger.debug("running command: %s" % \