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-03 12:43:31 +0100 |
| commit | 791a3912d98014105bdb2a8585e4a1b7ae8120b1 (patch) | |
| tree | bcfb06b795482f6113cfa6b5c967a0bbb9b4bc1c /scripts/lib/wic/kickstart | |
| parent | 14b47e22f9b2566320ab6ef103da1501bca129de (diff) | |
| download | poky-791a3912d98014105bdb2a8585e4a1b7ae8120b1.tar.gz | |
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>
Diffstat (limited to 'scripts/lib/wic/kickstart')
| -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 |
3 files changed, 75 insertions, 75 deletions
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): | |||
| 58 | def __init__(self): | 58 | def __init__(self): |
| 59 | superclass.__init__(self, mapping=commandMap[using_version]) | 59 | superclass.__init__(self, mapping=commandMap[using_version]) |
| 60 | 60 | ||
| 61 | ks = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=True) | 61 | kickstart = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=True) |
| 62 | 62 | ||
| 63 | try: | 63 | try: |
| 64 | ks.readKickstart(path) | 64 | kickstart.readKickstart(path) |
| 65 | except (kserrors.KickstartParseError, kserrors.KickstartError), err: | 65 | except (kserrors.KickstartParseError, kserrors.KickstartError), err: |
| 66 | msger.warning("Errors occurred when parsing kickstart file: %s\n" % path) | 66 | msger.warning("Errors occurred when parsing kickstart file: %s\n" % path) |
| 67 | msger.error("%s" % err) | 67 | msger.error("%s" % err) |
| 68 | 68 | ||
| 69 | return ks | 69 | return kickstart |
| 70 | 70 | ||
| 71 | def get_image_size(ks, default=None): | 71 | def get_image_size(kickstart, default=None): |
| 72 | __size = 0 | 72 | __size = 0 |
| 73 | for p in ks.handler.partition.partitions: | 73 | for part in kickstart.handler.partition.partitions: |
| 74 | if p.mountpoint == "/" and p.size: | 74 | if part.mountpoint == "/" and part.size: |
| 75 | __size = p.size | 75 | __size = part.size |
| 76 | if __size > 0: | 76 | if __size > 0: |
| 77 | return int(__size) * 1024L | 77 | return int(__size) * 1024L |
| 78 | else: | 78 | else: |
| 79 | return default | 79 | return default |
| 80 | 80 | ||
| 81 | def get_image_fstype(ks, default=None): | 81 | def get_image_fstype(kickstart, default=None): |
| 82 | for p in ks.handler.partition.partitions: | 82 | for part in kickstart.handler.partition.partitions: |
| 83 | if p.mountpoint == "/" and p.fstype: | 83 | if part.mountpoint == "/" and part.fstype: |
| 84 | return p.fstype | 84 | return part.fstype |
| 85 | return default | 85 | return default |
| 86 | 86 | ||
| 87 | def get_image_fsopts(ks, default=None): | 87 | def get_image_fsopts(kickstart, default=None): |
| 88 | for p in ks.handler.partition.partitions: | 88 | for part in kickstart.handler.partition.partitions: |
| 89 | if p.mountpoint == "/" and p.fsopts: | 89 | if part.mountpoint == "/" and part.fsopts: |
| 90 | return p.fsopts | 90 | return part.fsopts |
| 91 | return default | 91 | return default |
| 92 | 92 | ||
| 93 | def get_timeout(ks, default=None): | 93 | def get_timeout(kickstart, default=None): |
| 94 | if not hasattr(ks.handler.bootloader, "timeout"): | 94 | if not hasattr(kickstart.handler.bootloader, "timeout"): |
| 95 | return default | 95 | return default |
| 96 | if ks.handler.bootloader.timeout is None: | 96 | if kickstart.handler.bootloader.timeout is None: |
| 97 | return default | 97 | return default |
| 98 | return int(ks.handler.bootloader.timeout) | 98 | return int(kickstart.handler.bootloader.timeout) |
| 99 | 99 | ||
| 100 | def get_kernel_args(ks, default="ro rd.live.image"): | 100 | def get_kernel_args(kickstart, default="ro rd.live.image"): |
| 101 | if not hasattr(ks.handler.bootloader, "appendLine"): | 101 | if not hasattr(kickstart.handler.bootloader, "appendLine"): |
| 102 | return default | 102 | return default |
| 103 | if ks.handler.bootloader.appendLine is None: | 103 | if kickstart.handler.bootloader.appendLine is None: |
| 104 | return default | 104 | return default |
| 105 | return "%s %s" %(default, ks.handler.bootloader.appendLine) | 105 | return "%s %s" %(default, kickstart.handler.bootloader.appendLine) |
| 106 | 106 | ||
| 107 | def get_menu_args(ks, default=""): | 107 | def get_menu_args(kickstart, default=""): |
| 108 | if not hasattr(ks.handler.bootloader, "menus"): | 108 | if not hasattr(kickstart.handler.bootloader, "menus"): |
| 109 | return default | 109 | return default |
| 110 | if ks.handler.bootloader.menus in (None, ""): | 110 | if kickstart.handler.bootloader.menus in (None, ""): |
| 111 | return default | 111 | return default |
| 112 | return "%s" % ks.handler.bootloader.menus | 112 | return "%s" % kickstart.handler.bootloader.menus |
| 113 | 113 | ||
| 114 | def get_default_kernel(ks, default=None): | 114 | def get_default_kernel(kickstart, default=None): |
| 115 | if not hasattr(ks.handler.bootloader, "default"): | 115 | if not hasattr(kickstart.handler.bootloader, "default"): |
| 116 | return default | 116 | return default |
| 117 | if not ks.handler.bootloader.default: | 117 | if not kickstart.handler.bootloader.default: |
| 118 | return default | 118 | return default |
| 119 | return ks.handler.bootloader.default | 119 | return kickstart.handler.bootloader.default |
| 120 | 120 | ||
| 121 | def get_partitions(ks): | 121 | def get_partitions(kickstart): |
| 122 | return ks.handler.partition.partitions | 122 | 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): | |||
| 154 | else: | 154 | else: |
| 155 | return 0 | 155 | return 0 |
| 156 | 156 | ||
| 157 | def prepare(self, cr, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir, | 157 | def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir, |
| 158 | kernel_dir, native_sysroot): | 158 | kernel_dir, native_sysroot): |
| 159 | """ | 159 | """ |
| 160 | Prepare content for individual partitions, depending on | 160 | Prepare content for individual partitions, depending on |
| @@ -199,18 +199,18 @@ class Wic_PartData(FC4_PartData): | |||
| 199 | self._source_methods = pluginmgr.get_source_plugin_methods(\ | 199 | self._source_methods = pluginmgr.get_source_plugin_methods(\ |
| 200 | self.source, partition_methods) | 200 | self.source, partition_methods) |
| 201 | self._source_methods["do_configure_partition"](self, self.sourceparams_dict, | 201 | self._source_methods["do_configure_partition"](self, self.sourceparams_dict, |
| 202 | cr, cr_workdir, | 202 | creator, cr_workdir, |
| 203 | oe_builddir, | 203 | oe_builddir, |
| 204 | bootimg_dir, | 204 | bootimg_dir, |
| 205 | kernel_dir, | 205 | kernel_dir, |
| 206 | native_sysroot) | 206 | native_sysroot) |
| 207 | self._source_methods["do_stage_partition"](self, self.sourceparams_dict, | 207 | self._source_methods["do_stage_partition"](self, self.sourceparams_dict, |
| 208 | cr, cr_workdir, | 208 | creator, cr_workdir, |
| 209 | oe_builddir, | 209 | oe_builddir, |
| 210 | bootimg_dir, kernel_dir, | 210 | bootimg_dir, kernel_dir, |
| 211 | native_sysroot) | 211 | native_sysroot) |
| 212 | self._source_methods["do_prepare_partition"](self, self.sourceparams_dict, | 212 | self._source_methods["do_prepare_partition"](self, self.sourceparams_dict, |
| 213 | cr, cr_workdir, | 213 | creator, cr_workdir, |
| 214 | oe_builddir, | 214 | oe_builddir, |
| 215 | bootimg_dir, kernel_dir, rootfs_dir, | 215 | bootimg_dir, kernel_dir, rootfs_dir, |
| 216 | native_sysroot) | 216 | native_sysroot) |
| @@ -441,21 +441,21 @@ class Wic_PartData(FC4_PartData): | |||
| 441 | msger.warning("Creating of an empty squashfs %s partition was attempted. " \ | 441 | msger.warning("Creating of an empty squashfs %s partition was attempted. " \ |
| 442 | "Proceeding as requested." % self.mountpoint) | 442 | "Proceeding as requested." % self.mountpoint) |
| 443 | 443 | ||
| 444 | fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) | 444 | path = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) |
| 445 | os.path.isfile(fs) and os.remove(fs) | 445 | os.path.isfile(path) and os.remove(path) |
| 446 | 446 | ||
| 447 | # it is not possible to create a squashfs without source data, | 447 | # it is not possible to create a squashfs without source data, |
| 448 | # thus prepare an empty temp dir that is used as source | 448 | # thus prepare an empty temp dir that is used as source |
| 449 | tmpdir = tempfile.mkdtemp() | 449 | tmpdir = tempfile.mkdtemp() |
| 450 | 450 | ||
| 451 | squashfs_cmd = "mksquashfs %s %s -noappend" % \ | 451 | squashfs_cmd = "mksquashfs %s %s -noappend" % \ |
| 452 | (tmpdir, fs) | 452 | (tmpdir, path) |
| 453 | exec_native_cmd(squashfs_cmd, native_sysroot) | 453 | exec_native_cmd(squashfs_cmd, native_sysroot) |
| 454 | 454 | ||
| 455 | os.rmdir(tmpdir) | 455 | os.rmdir(tmpdir) |
| 456 | 456 | ||
| 457 | # get the rootfs size in the right units for kickstart (kB) | 457 | # get the rootfs size in the right units for kickstart (kB) |
| 458 | du_cmd = "du -Lbks %s" % fs | 458 | du_cmd = "du -Lbks %s" % path |
| 459 | out = exec_cmd(du_cmd) | 459 | out = exec_cmd(du_cmd) |
| 460 | fs_size = out.split()[0] | 460 | fs_size = out.split()[0] |
| 461 | 461 | ||
| @@ -465,17 +465,17 @@ class Wic_PartData(FC4_PartData): | |||
| 465 | """ | 465 | """ |
| 466 | Prepare a swap partition. | 466 | Prepare a swap partition. |
| 467 | """ | 467 | """ |
| 468 | fs = "%s/fs.%s" % (cr_workdir, self.fstype) | 468 | path = "%s/fs.%s" % (cr_workdir, self.fstype) |
| 469 | 469 | ||
| 470 | dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ | 470 | dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ |
| 471 | (fs, self.size) | 471 | (path, self.size) |
| 472 | exec_cmd(dd_cmd) | 472 | exec_cmd(dd_cmd) |
| 473 | 473 | ||
| 474 | import uuid | 474 | import uuid |
| 475 | label_str = "" | 475 | label_str = "" |
| 476 | if self.label: | 476 | if self.label: |
| 477 | label_str = "-L %s" % self.label | 477 | label_str = "-L %s" % self.label |
| 478 | mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), fs) | 478 | mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), path) |
| 479 | exec_native_cmd(mkswap_cmd, native_sysroot) | 479 | exec_native_cmd(mkswap_cmd, native_sysroot) |
| 480 | 480 | ||
| 481 | 481 | ||
| @@ -490,37 +490,37 @@ class Wic_Partition(FC4_Partition): | |||
| 490 | (option, value)) | 490 | (option, value)) |
| 491 | setattr(parser.values, option.dest, value) | 491 | setattr(parser.values, option.dest, value) |
| 492 | 492 | ||
| 493 | op = FC4_Partition._getParser(self) | 493 | parser = FC4_Partition._getParser(self) |
| 494 | 494 | ||
| 495 | # The alignment value is given in kBytes. e.g., value 8 means that | 495 | # The alignment value is given in kBytes. e.g., value 8 means that |
| 496 | # the partition is aligned to start from 8096 byte boundary. | 496 | # the partition is aligned to start from 8096 byte boundary. |
| 497 | op.add_option("--align", type="int", action="store", dest="align", | 497 | parser.add_option("--align", type="int", action="store", dest="align", |
| 498 | default=None) | 498 | default=None) |
| 499 | op.add_option("--extoptions", type="string", action="store", dest="extopts", | 499 | parser.add_option("--extoptions", type="string", action="store", dest="extopts", |
| 500 | default=None) | 500 | default=None) |
| 501 | op.add_option("--part-type", type="string", action="store", dest="part_type", | 501 | parser.add_option("--part-type", type="string", action="store", dest="part_type", |
| 502 | default=None) | 502 | default=None) |
| 503 | # use specified source file to fill the partition | 503 | # use specified source file to fill the partition |
| 504 | # and calculate partition size | 504 | # and calculate partition size |
| 505 | op.add_option("--source", type="string", action="store", | 505 | parser.add_option("--source", type="string", action="store", |
| 506 | dest="source", default=None) | 506 | dest="source", default=None) |
| 507 | # comma-separated list of param=value pairs | 507 | # comma-separated list of param=value pairs |
| 508 | op.add_option("--sourceparams", type="string", action="store", | 508 | parser.add_option("--sourceparams", type="string", action="store", |
| 509 | dest="sourceparams", default=None) | 509 | dest="sourceparams", default=None) |
| 510 | # use specified rootfs path to fill the partition | 510 | # use specified rootfs path to fill the partition |
| 511 | op.add_option("--rootfs-dir", type="string", action="store", | 511 | parser.add_option("--rootfs-dir", type="string", action="store", |
| 512 | dest="rootfs", default=None) | 512 | dest="rootfs", default=None) |
| 513 | # wether to add the partition in the partition table | 513 | # wether to add the partition in the partition table |
| 514 | op.add_option("--no-table", dest="no_table", action="store_true", | 514 | parser.add_option("--no-table", dest="no_table", action="store_true", |
| 515 | default=False) | 515 | default=False) |
| 516 | # extra space beyond the partition size | 516 | # extra space beyond the partition size |
| 517 | op.add_option("--extra-space", dest="extra_space", action="store", | 517 | parser.add_option("--extra-space", dest="extra_space", action="store", |
| 518 | type="size", nargs=1, default="10M") | 518 | type="size", nargs=1, default="10M") |
| 519 | op.add_option("--overhead-factor", dest="overhead_factor", | 519 | parser.add_option("--overhead-factor", dest="overhead_factor", |
| 520 | action="callback", callback=overhead_cb, type="float", | 520 | action="callback", callback=overhead_cb, type="float", |
| 521 | nargs=1, default=1.3) | 521 | nargs=1, default=1.3) |
| 522 | op.add_option("--use-uuid", dest="use_uuid", action="store_true", | 522 | parser.add_option("--use-uuid", dest="use_uuid", action="store_true", |
| 523 | default=False) | 523 | default=False) |
| 524 | op.add_option("--uuid") | 524 | parser.add_option("--uuid") |
| 525 | 525 | ||
| 526 | return op | 526 | 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): | |||
| 49 | return retval | 49 | return retval |
| 50 | 50 | ||
| 51 | def _getParser(self): | 51 | def _getParser(self): |
| 52 | op = F8_Bootloader._getParser(self) | 52 | parser = F8_Bootloader._getParser(self) |
| 53 | op.add_option("--menus", dest="menus") | 53 | parser.add_option("--menus", dest="menus") |
| 54 | op.add_option("--ptable", dest="ptable", choices=("msdos", "gpt"), | 54 | parser.add_option("--ptable", dest="ptable", choices=("msdos", "gpt"), |
| 55 | default="msdos") | 55 | default="msdos") |
| 56 | # use specified source plugin to implement bootloader-specific methods | 56 | # use specified source plugin to implement bootloader-specific methods |
| 57 | op.add_option("--source", type="string", action="store", | 57 | parser.add_option("--source", type="string", action="store", |
| 58 | dest="source", default=None) | 58 | dest="source", default=None) |
| 59 | return op | 59 | return parser |
| 60 | 60 | ||
