diff options
Diffstat (limited to 'scripts/lib/mic/plugins/imager/direct_plugin.py')
-rw-r--r-- | scripts/lib/mic/plugins/imager/direct_plugin.py | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/scripts/lib/mic/plugins/imager/direct_plugin.py b/scripts/lib/mic/plugins/imager/direct_plugin.py deleted file mode 100644 index c05a400768..0000000000 --- a/scripts/lib/mic/plugins/imager/direct_plugin.py +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | # ex:ts=4:sw=4:sts=4:et | ||
2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
3 | # | ||
4 | # Copyright (c) 2013, Intel Corporation. | ||
5 | # All rights reserved. | ||
6 | # | ||
7 | # This program is free software; you can redistribute it and/or modify | ||
8 | # it under the terms of the GNU General Public License version 2 as | ||
9 | # published by the Free Software Foundation. | ||
10 | # | ||
11 | # This program is distributed in the hope that it will be useful, | ||
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | # GNU General Public License for more details. | ||
15 | # | ||
16 | # You should have received a copy of the GNU General Public License along | ||
17 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | # | ||
20 | # DESCRIPTION | ||
21 | # This implements the 'direct' imager plugin class for 'wic', based | ||
22 | # loosely on the raw imager plugin from 'mic' | ||
23 | # | ||
24 | # AUTHORS | ||
25 | # Tom Zanussi <tom.zanussi (at] linux.intel.com> | ||
26 | # | ||
27 | |||
28 | import os | ||
29 | import shutil | ||
30 | import re | ||
31 | import tempfile | ||
32 | |||
33 | from mic import msger | ||
34 | from mic.utils import misc, fs_related, errors, runner, cmdln | ||
35 | from mic.conf import configmgr | ||
36 | from mic.plugin import pluginmgr | ||
37 | |||
38 | import mic.imager.direct as direct | ||
39 | from mic.pluginbase import ImagerPlugin | ||
40 | |||
41 | class DirectPlugin(ImagerPlugin): | ||
42 | name = 'direct' | ||
43 | |||
44 | @classmethod | ||
45 | def __rootfs_dir_to_dict(self, rootfs_dirs): | ||
46 | """ | ||
47 | Gets a string that contain 'connection=dir' splitted by | ||
48 | space and return a dict | ||
49 | """ | ||
50 | krootfs_dir = {} | ||
51 | for rootfs_dir in rootfs_dirs.split(' '): | ||
52 | k, v = rootfs_dir.split('=') | ||
53 | krootfs_dir[k] = v | ||
54 | |||
55 | return krootfs_dir | ||
56 | |||
57 | @classmethod | ||
58 | def do_create(self, subcmd, opts, *args): | ||
59 | """ | ||
60 | Create direct image, called from creator as 'direct' cmd | ||
61 | """ | ||
62 | if len(args) != 9: | ||
63 | raise errors.Usage("Extra arguments given") | ||
64 | |||
65 | staging_data_dir = args[0] | ||
66 | hdddir = args[1] | ||
67 | native_sysroot = args[2] | ||
68 | kernel_dir = args[3] | ||
69 | bootimg_dir = args[4] | ||
70 | rootfs_dir = args[5] | ||
71 | |||
72 | creatoropts = configmgr.create | ||
73 | ksconf = args[6] | ||
74 | |||
75 | image_output_dir = args[7] | ||
76 | oe_builddir = args[8] | ||
77 | |||
78 | krootfs_dir = self.__rootfs_dir_to_dict(rootfs_dir) | ||
79 | |||
80 | configmgr._ksconf = ksconf | ||
81 | |||
82 | creator = direct.DirectImageCreator(oe_builddir, | ||
83 | image_output_dir, | ||
84 | krootfs_dir, | ||
85 | bootimg_dir, | ||
86 | kernel_dir, | ||
87 | native_sysroot, | ||
88 | hdddir, | ||
89 | staging_data_dir, | ||
90 | creatoropts) | ||
91 | |||
92 | try: | ||
93 | creator.create() | ||
94 | creator.assemble() | ||
95 | creator.finalize() | ||
96 | creator.print_outimage_info() | ||
97 | |||
98 | except errors.CreatorError: | ||
99 | raise | ||
100 | finally: | ||
101 | creator.cleanup() | ||
102 | |||
103 | return 0 | ||