diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-09-02 13:58:06 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-03 12:43:26 +0100 |
commit | 282fb044d47521ba130c6767a8f6b0001c2043a3 (patch) | |
tree | b726b73899bf78dee817bc5ffa37cef260f68853 /scripts/lib/wic | |
parent | 2e2ac0cb7a456eb2e8395ef658ac397dcdb236e2 (diff) | |
download | poky-282fb044d47521ba130c6767a8f6b0001c2043a3.tar.gz |
wic: remove micpartition.py
Moved functionality of Mic_Partition and Mic_PartData classes
from micpartition.py to Wic_Partition and Wic_PartData classes
of partition.py module.
Reduced level of inheritance.
Removed confusing mic legacy names.
(From OE-Core rev: eae139af81262b457cfb8ddf45a99523cc8a41cc)
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')
3 files changed, 30 insertions, 72 deletions
diff --git a/scripts/lib/wic/kickstart/custom_commands/__init__.py b/scripts/lib/wic/kickstart/custom_commands/__init__.py index b4e613de4c..e4ae40622c 100644 --- a/scripts/lib/wic/kickstart/custom_commands/__init__.py +++ b/scripts/lib/wic/kickstart/custom_commands/__init__.py | |||
@@ -1,11 +1,7 @@ | |||
1 | from micpartition import Mic_Partition | ||
2 | from micpartition import Mic_PartData | ||
3 | from partition import Wic_Partition | 1 | from partition import Wic_Partition |
4 | from partition import Wic_PartData | 2 | from partition import Wic_PartData |
5 | 3 | ||
6 | __all__ = ( | 4 | __all__ = ( |
7 | "Mic_Partition", | ||
8 | "Mic_PartData", | ||
9 | "Wic_Partition", | 5 | "Wic_Partition", |
10 | "Wic_PartData", | 6 | "Wic_PartData", |
11 | ) | 7 | ) |
diff --git a/scripts/lib/wic/kickstart/custom_commands/micpartition.py b/scripts/lib/wic/kickstart/custom_commands/micpartition.py deleted file mode 100644 index d6be008ceb..0000000000 --- a/scripts/lib/wic/kickstart/custom_commands/micpartition.py +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | #!/usr/bin/env python -tt | ||
2 | # | ||
3 | # Marko Saukko <marko.saukko@cybercom.com> | ||
4 | # | ||
5 | # Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). | ||
6 | # | ||
7 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
8 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
9 | # General Public License v.2. This program is distributed in the hope that it | ||
10 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
11 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | # See the GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License along with | ||
15 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | |||
18 | from pykickstart.commands.partition import * | ||
19 | |||
20 | class Mic_PartData(FC4_PartData): | ||
21 | removedKeywords = FC4_PartData.removedKeywords | ||
22 | removedAttrs = FC4_PartData.removedAttrs | ||
23 | |||
24 | def __init__(self, *args, **kwargs): | ||
25 | FC4_PartData.__init__(self, *args, **kwargs) | ||
26 | self.deleteRemovedAttrs() | ||
27 | self.align = kwargs.get("align", None) | ||
28 | self.extopts = kwargs.get("extopts", None) | ||
29 | self.part_type = kwargs.get("part_type", None) | ||
30 | |||
31 | def _getArgsAsStr(self): | ||
32 | retval = FC4_PartData._getArgsAsStr(self) | ||
33 | |||
34 | if self.align: | ||
35 | retval += " --align=%d" % self.align | ||
36 | if self.extopts: | ||
37 | retval += " --extoptions=%s" % self.extopts | ||
38 | if self.part_type: | ||
39 | retval += " --part-type=%s" % self.part_type | ||
40 | |||
41 | return retval | ||
42 | |||
43 | class Mic_Partition(FC4_Partition): | ||
44 | removedKeywords = FC4_Partition.removedKeywords | ||
45 | removedAttrs = FC4_Partition.removedAttrs | ||
46 | |||
47 | def _getParser(self): | ||
48 | op = FC4_Partition._getParser(self) | ||
49 | # The alignment value is given in kBytes. e.g., value 8 means that | ||
50 | # the partition is aligned to start from 8096 byte boundary. | ||
51 | op.add_option("--align", type="int", action="store", dest="align", | ||
52 | default=None) | ||
53 | op.add_option("--extoptions", type="string", action="store", dest="extopts", | ||
54 | default=None) | ||
55 | op.add_option("--part-type", type="string", action="store", dest="part_type", | ||
56 | default=None) | ||
57 | return op | ||
diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py index 045b290ed3..dd6edd2f10 100644 --- a/scripts/lib/wic/kickstart/custom_commands/partition.py +++ b/scripts/lib/wic/kickstart/custom_commands/partition.py | |||
@@ -28,7 +28,7 @@ import os | |||
28 | import tempfile | 28 | import tempfile |
29 | import uuid | 29 | import uuid |
30 | 30 | ||
31 | from pykickstart.commands.partition import * | 31 | from pykickstart.commands.partition import FC4_PartData, FC4_Partition |
32 | from wic.utils.oe.misc import * | 32 | from wic.utils.oe.misc import * |
33 | from wic.kickstart.custom_commands import * | 33 | from wic.kickstart.custom_commands import * |
34 | from wic.plugin import pluginmgr | 34 | from wic.plugin import pluginmgr |
@@ -39,13 +39,16 @@ partition_methods = { | |||
39 | "do_configure_partition":None, | 39 | "do_configure_partition":None, |
40 | } | 40 | } |
41 | 41 | ||
42 | class Wic_PartData(Mic_PartData): | 42 | class Wic_PartData(FC4_PartData): |
43 | removedKeywords = Mic_PartData.removedKeywords | 43 | removedKeywords = FC4_PartData.removedKeywords |
44 | removedAttrs = Mic_PartData.removedAttrs | 44 | removedAttrs = FC4_PartData.removedAttrs |
45 | 45 | ||
46 | def __init__(self, *args, **kwargs): | 46 | def __init__(self, *args, **kwargs): |
47 | Mic_PartData.__init__(self, *args, **kwargs) | 47 | FC4_PartData.__init__(self, *args, **kwargs) |
48 | self.deleteRemovedAttrs() | 48 | self.deleteRemovedAttrs() |
49 | self.align = kwargs.get("align", None) | ||
50 | self.extopts = kwargs.get("extopts", None) | ||
51 | self.part_type = kwargs.get("part_type", None) | ||
49 | self.source = kwargs.get("source", None) | 52 | self.source = kwargs.get("source", None) |
50 | self.sourceparams = kwargs.get("sourceparams", None) | 53 | self.sourceparams = kwargs.get("sourceparams", None) |
51 | self.rootfs = kwargs.get("rootfs-dir", None) | 54 | self.rootfs = kwargs.get("rootfs-dir", None) |
@@ -59,8 +62,14 @@ class Wic_PartData(Mic_PartData): | |||
59 | self.size = 0 | 62 | self.size = 0 |
60 | 63 | ||
61 | def _getArgsAsStr(self): | 64 | def _getArgsAsStr(self): |
62 | retval = Mic_PartData._getArgsAsStr(self) | 65 | retval = FC4_PartData._getArgsAsStr(self) |
63 | 66 | ||
67 | if self.align: | ||
68 | retval += " --align=%d" % self.align | ||
69 | if self.extopts: | ||
70 | retval += " --extoptions=%s" % self.extopts | ||
71 | if self.part_type: | ||
72 | retval += " --part-type=%s" % self.part_type | ||
64 | if self.source: | 73 | if self.source: |
65 | retval += " --source=%s" % self.source | 74 | retval += " --source=%s" % self.source |
66 | if self.sourceparams: | 75 | if self.sourceparams: |
@@ -468,9 +477,10 @@ class Wic_PartData(Mic_PartData): | |||
468 | mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), fs) | 477 | mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), fs) |
469 | exec_native_cmd(mkswap_cmd, native_sysroot) | 478 | exec_native_cmd(mkswap_cmd, native_sysroot) |
470 | 479 | ||
471 | class Wic_Partition(Mic_Partition): | 480 | |
472 | removedKeywords = Mic_Partition.removedKeywords | 481 | class Wic_Partition(FC4_Partition): |
473 | removedAttrs = Mic_Partition.removedAttrs | 482 | removedKeywords = FC4_Partition.removedKeywords |
483 | removedAttrs = FC4_Partition.removedAttrs | ||
474 | 484 | ||
475 | def _getParser(self): | 485 | def _getParser(self): |
476 | def overhead_cb(option, opt_str, value, parser): | 486 | def overhead_cb(option, opt_str, value, parser): |
@@ -479,7 +489,16 @@ class Wic_Partition(Mic_Partition): | |||
479 | (option, value)) | 489 | (option, value)) |
480 | setattr(parser.values, option.dest, value) | 490 | setattr(parser.values, option.dest, value) |
481 | 491 | ||
482 | op = Mic_Partition._getParser(self) | 492 | op = FC4_Partition._getParser(self) |
493 | |||
494 | # The alignment value is given in kBytes. e.g., value 8 means that | ||
495 | # the partition is aligned to start from 8096 byte boundary. | ||
496 | op.add_option("--align", type="int", action="store", dest="align", | ||
497 | default=None) | ||
498 | op.add_option("--extoptions", type="string", action="store", dest="extopts", | ||
499 | default=None) | ||
500 | op.add_option("--part-type", type="string", action="store", dest="part_type", | ||
501 | default=None) | ||
483 | # use specified source file to fill the partition | 502 | # use specified source file to fill the partition |
484 | # and calculate partition size | 503 | # and calculate partition size |
485 | op.add_option("--source", type="string", action="store", | 504 | op.add_option("--source", type="string", action="store", |