diff options
| author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-09-02 13:58:16 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-02 23:46:52 +0100 |
| commit | 872cb0d5d79b26f34e6b35d7be8870d245021be4 (patch) | |
| tree | 37cc334e9769e40e1df60e777e934ee7a404282f /scripts/lib | |
| parent | af0a6d547a5a3efefdd4900f7079dfd10b85342d (diff) | |
| download | openembedded-core-872cb0d5d79b26f34e6b35d7be8870d245021be4.tar.gz openembedded-core-872cb0d5d79b26f34e6b35d7be8870d245021be4.tar.bz2 openembedded-core-872cb0d5d79b26f34e6b35d7be8870d245021be4.zip | |
wic: fix short variable names
Made short variable names longer and more readable.
Fixed pylint warnings "Invalid variable name" and
"Invalid argument name".
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/wic/conf.py | 4 | ||||
| -rw-r--r-- | scripts/lib/wic/engine.py | 62 | ||||
| -rw-r--r-- | scripts/lib/wic/imager/direct.py | 70 | ||||
| -rw-r--r-- | scripts/lib/wic/kickstart/__init__.py | 66 | ||||
| -rw-r--r-- | scripts/lib/wic/kickstart/custom_commands/partition.py | 72 | ||||
| -rw-r--r-- | scripts/lib/wic/kickstart/custom_commands/wicboot.py | 12 | ||||
| -rw-r--r-- | scripts/lib/wic/msger.py | 13 | ||||
| -rw-r--r-- | scripts/lib/wic/plugin.py | 4 | ||||
| -rw-r--r-- | scripts/lib/wic/pluginbase.py | 14 | ||||
| -rw-r--r-- | scripts/lib/wic/plugins/imager/direct_plugin.py | 4 | ||||
| -rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-efi.py | 26 | ||||
| -rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-pcbios.py | 28 | ||||
| -rw-r--r-- | scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 32 | ||||
| -rw-r--r-- | scripts/lib/wic/utils/partitionedfs.py | 154 | ||||
| -rw-r--r-- | scripts/lib/wic/utils/runner.py | 16 |
15 files changed, 287 insertions, 290 deletions
diff --git a/scripts/lib/wic/conf.py b/scripts/lib/wic/conf.py index 942c0c106f..1d4363a526 100644 --- a/scripts/lib/wic/conf.py +++ b/scripts/lib/wic/conf.py @@ -87,9 +87,9 @@ class ConfigMgr(object): if not ksconf: return - ks = kickstart.read_kickstart(ksconf) + ksobj = kickstart.read_kickstart(ksconf) - self.create['ks'] = ks + self.create['ks'] = ksobj self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0] self.create['name'] = misc.build_name(ksconf, diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index ce942ea4c4..76b93e82f2 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -53,17 +53,17 @@ def verify_build_env(): CANNED_IMAGE_DIR = "lib/wic/canned-wks" # relative to scripts SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR -def build_canned_image_list(dl): +def build_canned_image_list(path): layers_path = misc.get_bitbake_var("BBLAYERS") canned_wks_layer_dirs = [] if layers_path is not None: for layer_path in layers_path.split(): - path = os.path.join(layer_path, SCRIPTS_CANNED_IMAGE_DIR) - canned_wks_layer_dirs.append(path) + cpath = os.path.join(layer_path, SCRIPTS_CANNED_IMAGE_DIR) + canned_wks_layer_dirs.append(cpath) - path = os.path.join(dl, CANNED_IMAGE_DIR) - canned_wks_layer_dirs.append(path) + cpath = os.path.join(path, CANNED_IMAGE_DIR) + canned_wks_layer_dirs.append(cpath) return canned_wks_layer_dirs @@ -99,14 +99,13 @@ def list_canned_images(scripts_path): continue if fname.endswith(".wks"): fullpath = os.path.join(canned_wks_dir, fname) - f = open(fullpath, "r") - lines = f.readlines() - for line in lines: - desc = "" - idx = line.find("short-description:") - if idx != -1: - desc = line[idx + len("short-description:"):].strip() - break + with open(fullpath) as wks: + for line in wks: + desc = "" + idx = line.find("short-description:") + if idx != -1: + desc = line[idx + len("short-description:"):].strip() + break basename = os.path.splitext(fname)[0] print " %s\t\t%s" % (basename.ljust(30), desc) @@ -115,24 +114,23 @@ def list_canned_image_help(scripts_path, fullpath): """ List the help and params in the specified canned image. """ - f = open(fullpath, "r") - lines = f.readlines() found = False - for line in lines: - if not found: - idx = line.find("long-description:") + with open(fullpath) as wks: + for line in wks: + if not found: + idx = line.find("long-description:") + if idx != -1: + print + print line[idx + len("long-description:"):].strip() + found = True + continue + if not line.strip(): + break + idx = line.find("#") if idx != -1: - print - print line[idx + len("long-description:"):].strip() - found = True - continue - if not line.strip(): - break - idx = line.find("#") - if idx != -1: - print line[idx + len("#:"):].rstrip() - else: - break + print line[idx + len("#:"):].rstrip() + else: + break def list_source_plugins(): @@ -186,10 +184,10 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, if debug: msger.set_loglevel('debug') - cr = creator.Creator() + crobj = creator.Creator() - cr.main(["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, - wks_file, image_output_dir, oe_builddir, compressor or ""]) + crobj.main(["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, + wks_file, image_output_dir, oe_builddir, compressor or ""]) print "\nThe image(s) were created using OE kickstart file:\n %s" % wks_file diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 761e436db5..31c0edc7d3 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -80,11 +80,11 @@ class DirectImageCreator(BaseImageCreator): in the partition table and logical partitions """ realnum = 0 - for n, p in enumerate(parts, 1): - if not p.no_table: + for pnum, part in enumerate(parts, 1): + if not part.no_table: realnum += 1 - if n == num: - if p.no_table: + if pnum == num: + if part.no_table: return 0 if self.ptable_format == 'msdos' and realnum > 3: # account for logical partition numbering, ex. sda5.. @@ -154,9 +154,9 @@ class DirectImageCreator(BaseImageCreator): if not self.ks.handler.partition.partitions: partstr = "part / --size 1900 --ondisk sda --fstype=ext3" args = partstr.split() - pd = self.ks.handler.partition.parse(args[1:]) - if pd not in self.ks.handler.partition.partitions: - self.ks.handler.partition.partitions.append(pd) + part = self.ks.handler.partition.parse(args[1:]) + if part not in self.ks.handler.partition.partitions: + self.ks.handler.partition.partitions.append(part) # partitions list from kickstart file return kickstart.get_partitions(self.ks) @@ -221,19 +221,19 @@ class DirectImageCreator(BaseImageCreator): self.__image = Image(self.native_sysroot) - for p in parts: + for part in parts: # as a convenience, set source to the boot partition source # instead of forcing it to be set via bootloader --source - if not self.ks.handler.bootloader.source and p.mountpoint == "/boot": - self.ks.handler.bootloader.source = p.source + if not self.ks.handler.bootloader.source and part.mountpoint == "/boot": + self.ks.handler.bootloader.source = part.source fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) - for p in parts: + for part in parts: # get rootfs size from bitbake variable if it's not set in .ks file - if not p.size: + if not part.size: # and if rootfs name is specified for the partition - image_name = p.get_rootfs() + image_name = part.get_rootfs() if image_name: # Bitbake variable ROOTFS_SIZE is calculated in # Image._get_rootfs_size method from meta/lib/oe/image.py @@ -242,7 +242,7 @@ class DirectImageCreator(BaseImageCreator): rsize_bb = get_bitbake_var('ROOTFS_SIZE', image_name) if rsize_bb: # convert from Kb to Mb - p.size = int(rsize_bb) / 1024 + part.size = int(rsize_bb) / 1024 # need to create the filesystems in order to get their # sizes before we can add them and do the layout. # Image.create() actually calls __format_disks() to create @@ -250,22 +250,22 @@ class DirectImageCreator(BaseImageCreator): # self.assemble() calls Image.assemble() which calls # __write_partitition() for each partition to dd the fs # into the partitions. - p.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir, - self.bootimg_dir, self.kernel_dir, self.native_sysroot) - - - self.__image.add_partition(int(p.size), - p.disk, - p.mountpoint, - p.source_file, - p.fstype, - p.label, - fsopts=p.fsopts, - boot=p.active, - align=p.align, - no_table=p.no_table, - part_type=p.part_type, - uuid=p.uuid) + part.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir, + self.bootimg_dir, self.kernel_dir, self.native_sysroot) + + + self.__image.add_partition(int(part.size), + part.disk, + part.mountpoint, + part.source_file, + part.fstype, + part.label, + fsopts=part.fsopts, + boot=part.active, + align=part.align, + no_table=part.no_table, + part_type=part.part_type, + uuid=part.uuid) if fstab_path: shutil.move(fstab_path + ".orig", fstab_path) @@ -336,14 +336,14 @@ class DirectImageCreator(BaseImageCreator): msg += ' %s\n\n' % full_path msg += 'The following build artifacts were used to create the image(s):\n' - for p in parts: - if p.get_rootfs() is None: + for part in parts: + if part.get_rootfs() is None: continue - if p.mountpoint == '/': + if part.mountpoint == '/': suffix = ':' else: - suffix = '["%s"]:' % (p.mountpoint or p.label) - msg += ' ROOTFS_DIR%s%s\n' % (suffix.ljust(20), p.get_rootfs()) + suffix = '["%s"]:' % (part.mountpoint or part.label) + msg += ' ROOTFS_DIR%s%s\n' % (suffix.ljust(20), part.get_rootfs()) msg += ' BOOTIMG_DIR: %s\n' % self.bootimg_dir msg += ' KERNEL_DIR: %s\n' % self.kernel_dir diff --git a/scripts/lib/wic/kickstart/__init__.py b/scripts/lib/wic/kickstart/__init__.py index 111723b133..c9b0e51f3c 100644 --- a/scripts/lib/wic/kickstart/__init__.py +++ b/scripts/lib/wic/kickstart/__init__.py @@ -58,65 +58,65 @@ def read_kickstart(path): def __init__(self): superclass.__init__(self, mapping=commandMap[using_version]) - ks = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=True) + kickstart = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=True) try: - ks.readKickstart(path) + kickstart.readKickstart(path) except (kserrors.KickstartParseError, kserrors.KickstartError), err: msger.warning("Errors occurred when parsing kickstart file: %s\n" % path) msger.error("%s" % err) - return ks + return kickstart -def get_image_size(ks, default=None): +def get_image_size(kickstart, default=None): __size = 0 - for p in ks.handler.partition.partitions: - if p.mountpoint == "/" and p.size: - __size = p.size + for part in kickstart.handler.partition.partitions: + if part.mountpoint == "/" and part.size: + __size = part.size if __size > 0: return int(__size) * 1024L else: return default -def get_image_fstype(ks, default=None): - for p in ks.handler.partition.partitions: - if p.mountpoint == "/" and p.fstype: - return p.fstype +def get_image_fstype(kickstart, default=None): + for part in kickstart.handler.partition.partitions: + if part.mountpoint == "/" and part.fstype: + return part.fstype return default -def get_image_fsopts(ks, default=None): - for p in ks.handler.partition.partitions: - if p.mountpoint == "/" and p.fsopts: - return p.fsopts +def get_image_fsopts(kickstart, default=None): + for part in kickstart.handler.partition.partitions: + if part.mountpoint == "/" and part.fsopts: + return part.fsopts return default -def get_timeout(ks, default=None): - if not hasattr(ks.handler.bootloader, "timeout"): +def get_timeout(kickstart, default=None): + if not hasattr(kickstart.handler.bootloader, "timeout"): return default - if ks.handler.bootloader.timeout is None: + if kickstart.handler.bootloader.timeout is None: return default - return int(ks.handler.bootloader.timeout) + return int(kickstart.handler.bootloader.timeout) -def get_kernel_args(ks, default="ro rd.live.image"): - if not hasattr(ks.handler.bootloader, "appendLine"): +def get_kernel_args(kickstart, default="ro rd.live.image"): + if not hasattr(kickstart.handler.bootloader, "appendLine"): return default - if ks.handler.bootloader.appendLine is None: + if kickstart.handler.bootloader.appendLine is None: return default - return "%s %s" %(default, ks.handler.bootloader.appendLine) + return "%s %s" %(default, kickstart.handler.bootloader.appendLine) -def get_menu_args(ks, default=""): - if not hasattr(ks.handler.bootloader, "menus"): +def get_menu_args(kickstart, default=""): + if not hasattr(kickstart.handler.bootloader, "menus"): return default - if ks.handler.bootloader.menus in (None, ""): + if kickstart.handler.bootloader.menus in (None, ""): return default - return "%s" % ks.handler.bootloader.menus + return "%s" % kickstart.handler.bootloader.menus -def get_default_kernel(ks, default=None): - if not hasattr(ks.handler.bootloader, "default"): +def get_default_kernel(kickstart, default=None): + if not hasattr(kickstart.handler.bootloader, "default"): return default - if not ks.handler.bootloader.default: + if not kickstart.handler.bootloader.default: return default - return ks.handler.bootloader.default + return kickstart.handler.bootloader.default -def get_partitions(ks): - return ks.handler.partition.partitions +def get_partitions(kickstart): + return kickstart.handler.partition.partitions diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py index bac2067a5a..eee25a493d 100644 --- a/scripts/lib/wic/kickstart/custom_commands/partition.py +++ b/scripts/lib/wic/kickstart/custom_commands/partition.py @@ -154,7 +154,7 @@ class Wic_PartData(FC4_PartData): else: return 0 - def prepare(self, cr, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir, + def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir, kernel_dir, native_sysroot): """ Prepare content for individual partitions, depending on @@ -199,18 +199,18 @@ class Wic_PartData(FC4_PartData): self._source_methods = pluginmgr.get_source_plugin_methods(\ self.source, partition_methods) self._source_methods["do_configure_partition"](self, self.sourceparams_dict, - cr, cr_workdir, + creator, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot) self._source_methods["do_stage_partition"](self, self.sourceparams_dict, - cr, cr_workdir, + creator, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot) self._source_methods["do_prepare_partition"](self, self.sourceparams_dict, - cr, cr_workdir, + creator, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, rootfs_dir, native_sysroot) @@ -441,21 +441,21 @@ class Wic_PartData(FC4_PartData): msger.warning("Creating of an empty squashfs %s partition was attempted. " \ "Proceeding as requested." % self.mountpoint) - fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) - os.path.isfile(fs) and os.remove(fs) + path = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) + os.path.isfile(path) and os.remove(path) # it is not possible to create a squashfs without source data, # thus prepare an empty temp dir that is used as source tmpdir = tempfile.mkdtemp() squashfs_cmd = "mksquashfs %s %s -noappend" % \ - (tmpdir, fs) + (tmpdir, path) exec_native_cmd(squashfs_cmd, native_sysroot) os.rmdir(tmpdir) # get the rootfs size in the right units for kickstart (kB) - du_cmd = "du -Lbks %s" % fs + du_cmd = "du -Lbks %s" % path out = exec_cmd(du_cmd) fs_size = out.split()[0] @@ -465,17 +465,17 @@ class Wic_PartData(FC4_PartData): """ Prepare a swap partition. """ - fs = "%s/fs.%s" % (cr_workdir, self.fstype) + path = "%s/fs.%s" % (cr_workdir, self.fstype) dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ - (fs, self.size) + (path, self.size) exec_cmd(dd_cmd) import uuid label_str = "" if self.label: label_str = "-L %s" % self.label - mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), fs) + mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), path) exec_native_cmd(mkswap_cmd, native_sysroot) @@ -490,37 +490,37 @@ class Wic_Partition(FC4_Partition): (option, value)) setattr(parser.values, option.dest, value) - op = FC4_Partition._getParser(self) + parser = FC4_Partition._getParser(self) # The alignment value is given in kBytes. e.g., value 8 means that # the partition is aligned to start from 8096 byte boundary. - op.add_option("--align", type="int", action="store", dest="align", - default=None) - op.add_option("--extoptions", type="string", action="store", dest="extopts", - default=None) - op.add_option("--part-type", type="string", action="store", dest="part_type", - default=None) + parser.add_option("--align", type="int", action="store", dest="align", + default=None) + parser.add_option("--extoptions", type="string", action="store", dest="extopts", + default=None) + parser.add_option("--part-type", type="string", action="store", dest="part_type", + default=None) # use specified source file to fill the partition # and calculate partition size - op.add_option("--source", type="string", action="store", - dest="source", default=None) + parser.add_option("--source", type="string", action="store", + dest="source", default=None) # comma-separated list of param=value pairs - op.add_option("--sourceparams", type="string", action="store", - dest="sourceparams", default=None) + parser.add_option("--sourceparams", type="string", action="store", + dest="sourceparams", default=None) # use specified rootfs path to fill the partition - op.add_option("--rootfs-dir", type="string", action="store", - dest="rootfs", default=None) + parser.add_option("--rootfs-dir", type="string", action="store", + dest="rootfs", default=None) # wether to add the partition in the partition table - op.add_option("--no-table", dest="no_table", action="store_true", - default=False) + parser.add_option("--no-table", dest="no_table", action="store_true", + default=False) # extra space beyond the partition size - op.add_option("--extra-space", dest="extra_space", action="store", - type="size", nargs=1, default="10M") - op.add_option("--overhead-factor", dest="overhead_factor", - action="callback", callback=overhead_cb, type="float", - nargs=1, default=1.3) - op.add_option("--use-uuid", dest="use_uuid", action="store_true", - default=False) - op.add_option("--uuid") - - return op + parser.add_option("--extra-space", dest="extra_space", action="store", + type="size", nargs=1, default="10M") + parser.add_option("--overhead-factor", dest="overhead_factor", + action="callback", callback=overhead_cb, type="float", + nargs=1, default=1.3) + parser.add_option("--use-uuid", dest="use_uuid", action="store_true", + default=False) + parser.add_option("--uuid") + + return parser diff --git a/scripts/lib/wic/kickstart/custom_commands/wicboot.py b/scripts/lib/wic/kickstart/custom_commands/wicboot.py index 0230df2f4b..a3e1852be2 100644 --- a/scripts/lib/wic/kickstart/custom_commands/wicboot.py +++ b/scripts/lib/wic/kickstart/custom_commands/wicboot.py @@ -49,12 +49,12 @@ class Wic_Bootloader(F8_Bootloader): return retval def _getParser(self): - op = F8_Bootloader._getParser(self) - op.add_option("--menus", dest="menus") - op.add_option("--ptable", dest="ptable", choices=("msdos", "gpt"), - default="msdos") + parser = F8_Bootloader._getParser(self) + parser.add_option("--menus", dest="menus") + parser.add_option("--ptable", dest="ptable", choices=("msdos", "gpt"), + default="msdos") # use specified source plugin to implement bootloader-specific methods - op.add_option("--source", type="string", action="store", + parser.add_option("--source", type="string", action="store", dest="source", default=None) - return op + return parser diff --git a/scripts/lib/wic/msger.py b/scripts/lib/wic/msger.py index 1b60980296..b737554228 100644 --- a/scripts/lib/wic/msger.py +++ b/scripts/lib/wic/msger.py @@ -151,10 +151,10 @@ def _split_msg(head, msg): msg = msg.lstrip() head = '\r' + head - m = PREFIX_RE.match(msg) - if m: - head += ' <%s>' % m.group(1) - msg = m.group(2) + match = PREFIX_RE.match(msg) + if match: + head += ' <%s>' % match.group(1) + msg = match.group(2) return head, msg @@ -271,9 +271,8 @@ def set_logfile(fpath): def _savelogf(): if LOG_FILE_FP: - fp = open(LOG_FILE_FP, 'w') - fp.write(LOG_CONTENT) - fp.close() + with open(LOG_FILE_FP, 'w') as log: + log.write(LOG_CONTENT) if LOG_FILE_FP is not None: warning('duplicate log file configuration') diff --git a/scripts/lib/wic/plugin.py b/scripts/lib/wic/plugin.py index 7244989d86..ccfdfcb934 100644 --- a/scripts/lib/wic/plugin.py +++ b/scripts/lib/wic/plugin.py @@ -48,7 +48,7 @@ class PluginMgr(object): self.plugin_dir = scripts_path + PLUGIN_DIR self.layers_path = None - def _build_plugin_dir_list(self, dl, ptype): + def _build_plugin_dir_list(self, plugin_dir, ptype): if self.layers_path is None: self.layers_path = get_bitbake_var("BBLAYERS") layer_dirs = [] @@ -58,7 +58,7 @@ class PluginMgr(object): path = os.path.join(layer_path, SCRIPTS_PLUGIN_DIR, ptype) layer_dirs.append(path) - path = os.path.join(dl, ptype) + path = os.path.join(plugin_dir, ptype) layer_dirs.append(path) return layer_dirs diff --git a/scripts/lib/wic/pluginbase.py b/scripts/lib/wic/pluginbase.py index 6d96de2be5..ee8fe95c6f 100644 --- a/scripts/lib/wic/pluginbase.py +++ b/scripts/lib/wic/pluginbase.py @@ -51,7 +51,7 @@ class SourcePlugin(_Plugin): """ @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 @@ -61,7 +61,7 @@ class SourcePlugin(_Plugin): msger.debug("SourcePlugin: do_install_disk: disk: %s" % disk_name) @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): """ @@ -78,7 +78,7 @@ class SourcePlugin(_Plugin): msger.debug("SourcePlugin: do_stage_partition: part: %s" % part) @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,7 +89,7 @@ class SourcePlugin(_Plugin): msger.debug("SourcePlugin: do_configure_partition: part: %s" % part) @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): """ @@ -99,9 +99,9 @@ class SourcePlugin(_Plugin): msger.debug("SourcePlugin: do_prepare_partition: part: %s" % part) def get_plugins(typen): - ps = ImagerPlugin.get_plugins() - if typen in ps: - return ps[typen] + plugins = ImagerPlugin.get_plugins() + if typen in plugins: + return plugins[typen] else: return None diff --git a/scripts/lib/wic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py index e9672fe274..6d3f46cc61 100644 --- a/scripts/lib/wic/plugins/imager/direct_plugin.py +++ b/scripts/lib/wic/plugins/imager/direct_plugin.py @@ -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 diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index b48cc835d6..fa63c6abda 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -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 diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index 3c2dbc9d1c..96ed54dbad 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/ |
