diff options
author | Tom Zanussi <tom.zanussi@linux.intel.com> | 2014-08-08 15:53:52 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-11 10:53:12 +0100 |
commit | d8f9d05baee3abd4feb0a5b2f2afe467e919c6b9 (patch) | |
tree | edc6ba90a220ad5bbba41998c3c5c82e1e97760d /scripts/lib/mic/utils/fs_related.py | |
parent | a43c1f94205d95c6eb77af2f0a494b4143f9eaf8 (diff) | |
download | poky-d8f9d05baee3abd4feb0a5b2f2afe467e919c6b9.tar.gz |
wic: Rename /mic to /wic
As well as any other stray instances of mic in the codebase that can
be removed.
We don't really need to carry around legacy naming, and the history is
in git.
(From OE-Core rev: 598b120406dc1d2b7e377bd1ab6f0acbef034b22)
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/mic/utils/fs_related.py')
-rw-r--r-- | scripts/lib/mic/utils/fs_related.py | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/scripts/lib/mic/utils/fs_related.py b/scripts/lib/mic/utils/fs_related.py deleted file mode 100644 index cf2a759a06..0000000000 --- a/scripts/lib/mic/utils/fs_related.py +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | #!/usr/bin/python -tt | ||
2 | # | ||
3 | # Copyright (c) 2007, Red Hat, Inc. | ||
4 | # Copyright (c) 2009, 2010, 2011 Intel, Inc. | ||
5 | # | ||
6 | # This program is free software; you can redistribute it and/or modify it | ||
7 | # under the terms of the GNU General Public License as published by the Free | ||
8 | # Software Foundation; version 2 of the License | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, but | ||
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
12 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
13 | # for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License along | ||
16 | # with this program; if not, write to the Free Software Foundation, Inc., 59 | ||
17 | # Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | from __future__ import with_statement | ||
20 | import os | ||
21 | import sys | ||
22 | import errno | ||
23 | import stat | ||
24 | import random | ||
25 | import string | ||
26 | import time | ||
27 | import uuid | ||
28 | |||
29 | from mic import msger | ||
30 | from mic.utils import runner | ||
31 | from mic.utils.errors import * | ||
32 | from mic.utils.oe.misc import * | ||
33 | |||
34 | def find_binary_path(binary): | ||
35 | if os.environ.has_key("PATH"): | ||
36 | paths = os.environ["PATH"].split(":") | ||
37 | else: | ||
38 | paths = [] | ||
39 | if os.environ.has_key("HOME"): | ||
40 | paths += [os.environ["HOME"] + "/bin"] | ||
41 | paths += ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"] | ||
42 | |||
43 | for path in paths: | ||
44 | bin_path = "%s/%s" % (path, binary) | ||
45 | if os.path.exists(bin_path): | ||
46 | return bin_path | ||
47 | |||
48 | print "External command '%s' not found, exiting." % binary | ||
49 | print " (Please install '%s' on your host system)" % binary | ||
50 | sys.exit(1) | ||
51 | |||
52 | def makedirs(dirname): | ||
53 | """A version of os.makedirs() that doesn't throw an | ||
54 | exception if the leaf directory already exists. | ||
55 | """ | ||
56 | try: | ||
57 | os.makedirs(dirname) | ||
58 | except OSError, err: | ||
59 | if err.errno != errno.EEXIST: | ||
60 | raise | ||
61 | |||
62 | class Disk: | ||
63 | """ | ||
64 | Generic base object for a disk. | ||
65 | """ | ||
66 | def __init__(self, size, device = None): | ||
67 | self._device = device | ||
68 | self._size = size | ||
69 | |||
70 | def create(self): | ||
71 | pass | ||
72 | |||
73 | def cleanup(self): | ||
74 | pass | ||
75 | |||
76 | def get_device(self): | ||
77 | return self._device | ||
78 | def set_device(self, path): | ||
79 | self._device = path | ||
80 | device = property(get_device, set_device) | ||
81 | |||
82 | def get_size(self): | ||
83 | return self._size | ||
84 | size = property(get_size) | ||
85 | |||
86 | |||
87 | class DiskImage(Disk): | ||
88 | """ | ||
89 | A Disk backed by a file. | ||
90 | """ | ||
91 | def __init__(self, image_file, size): | ||
92 | Disk.__init__(self, size) | ||
93 | self.image_file = image_file | ||
94 | |||
95 | def exists(self): | ||
96 | return os.path.exists(self.image_file) | ||
97 | |||
98 | def create(self): | ||
99 | if self.device is not None: | ||
100 | return | ||
101 | |||
102 | blocks = self.size / 1024 | ||
103 | if self.size - blocks * 1024: | ||
104 | blocks += 1 | ||
105 | |||
106 | # create disk image | ||
107 | dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=1" % \ | ||
108 | (self.image_file, blocks) | ||
109 | exec_cmd(dd_cmd) | ||
110 | |||
111 | self.device = self.image_file | ||