diff options
| author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-04-06 20:43:35 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-14 12:38:49 +0100 |
| commit | ea07f0325cdbeb40884aa55707b8787b63554e3e (patch) | |
| tree | 5d52b9ae29684e6d54c5340486a996216d1ecdc7 /scripts/lib | |
| parent | df9069d958fc9348f0afe63a7d0e0a0454ebe9b4 (diff) | |
| download | poky-ea07f0325cdbeb40884aa55707b8787b63554e3e.tar.gz | |
wic: use native parted
Used exec_native_cmd instead of find_binary_path to run parted.
Got rid of find_binary_path as it's not used anywhere else.
There are several tools wic is trying to find not only in sysroot,
but also in host root. Parted is a special as on some distros it's
installed in /usr/sbin, which is not in the user's PATH. This makes
wic to fail with error "External command 'parted' not found, exiting."
[YOCTO #7122]
(From OE-Core rev: 76adf38c0d8e0faf04a5ecb3fcfbe831c85bb81f)
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/imager/direct.py | 2 | ||||
| -rw-r--r-- | scripts/lib/wic/utils/fs_related.py | 18 | ||||
| -rw-r--r-- | scripts/lib/wic/utils/partitionedfs.py | 11 |
3 files changed, 7 insertions, 24 deletions
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index c1e5f09eee..0e687bd70e 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py | |||
| @@ -241,7 +241,7 @@ class DirectImageCreator(BaseImageCreator): | |||
| 241 | """ | 241 | """ |
| 242 | parts = self._get_parts() | 242 | parts = self._get_parts() |
| 243 | 243 | ||
| 244 | self.__image = Image() | 244 | self.__image = Image(self.native_sysroot) |
| 245 | 245 | ||
| 246 | for p in parts: | 246 | for p in parts: |
| 247 | # as a convenience, set source to the boot partition source | 247 | # as a convenience, set source to the boot partition source |
diff --git a/scripts/lib/wic/utils/fs_related.py b/scripts/lib/wic/utils/fs_related.py index d0bc8ee6d3..fb9054d568 100644 --- a/scripts/lib/wic/utils/fs_related.py +++ b/scripts/lib/wic/utils/fs_related.py | |||
| @@ -25,24 +25,6 @@ from wic.utils import runner | |||
| 25 | from wic.utils.errors import * | 25 | from wic.utils.errors import * |
| 26 | from wic.utils.oe.misc import * | 26 | from wic.utils.oe.misc import * |
| 27 | 27 | ||
| 28 | def find_binary_path(binary): | ||
| 29 | if os.environ.has_key("PATH"): | ||
| 30 | paths = os.environ["PATH"].split(":") | ||
| 31 | else: | ||
| 32 | paths = [] | ||
| 33 | if os.environ.has_key("HOME"): | ||
| 34 | paths += [os.environ["HOME"] + "/bin"] | ||
| 35 | paths += ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"] | ||
| 36 | |||
| 37 | for path in paths: | ||
| 38 | bin_path = "%s/%s" % (path, binary) | ||
| 39 | if os.path.exists(bin_path): | ||
| 40 | return bin_path | ||
| 41 | |||
| 42 | print "External command '%s' not found, exiting." % binary | ||
| 43 | print " (Please install '%s' on your host system)" % binary | ||
| 44 | sys.exit(1) | ||
| 45 | |||
| 46 | def makedirs(dirname): | 28 | def makedirs(dirname): |
| 47 | """A version of os.makedirs() that doesn't throw an | 29 | """A version of os.makedirs() that doesn't throw an |
| 48 | exception if the leaf directory already exists. | 30 | exception if the leaf directory already exists. |
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index b9fbc16e12..40d6e889b0 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py | |||
| @@ -40,13 +40,13 @@ class Image: | |||
| 40 | An Image is a container for a set of DiskImages and associated | 40 | An Image is a container for a set of DiskImages and associated |
| 41 | partitions. | 41 | partitions. |
| 42 | """ | 42 | """ |
| 43 | def __init__(self): | 43 | def __init__(self, native_sysroot=None): |
| 44 | self.disks = {} | 44 | self.disks = {} |
| 45 | self.partitions = [] | 45 | self.partitions = [] |
| 46 | self.parted = find_binary_path("parted") | ||
| 47 | # Size of a sector used in calculations | 46 | # Size of a sector used in calculations |
| 48 | self.sector_size = SECTOR_SIZE | 47 | self.sector_size = SECTOR_SIZE |
| 49 | self._partitions_layed_out = False | 48 | self._partitions_layed_out = False |
| 49 | self.native_sysroot = native_sysroot | ||
| 50 | 50 | ||
| 51 | def __add_disk(self, disk_name): | 51 | def __add_disk(self, disk_name): |
| 52 | """ Add a disk 'disk_name' to the internal list of disks. Note, | 52 | """ Add a disk 'disk_name' to the internal list of disks. Note, |
| @@ -225,11 +225,12 @@ class Image: | |||
| 225 | def __run_parted(self, args): | 225 | def __run_parted(self, args): |
| 226 | """ Run parted with arguments specified in the 'args' list. """ | 226 | """ Run parted with arguments specified in the 'args' list. """ |
| 227 | 227 | ||
| 228 | args.insert(0, self.parted) | 228 | args.insert(0, "parted") |
| 229 | args = ' '.join(args) | ||
| 229 | msger.debug(args) | 230 | msger.debug(args) |
| 230 | 231 | ||
| 231 | rc, out = runner.runtool(args, catch = 3) | 232 | rc, out = exec_native_cmd(args, self.native_sysroot) |
| 232 | out = out.strip() | 233 | |
| 233 | if out: | 234 | if out: |
| 234 | msger.debug('"parted" output: %s' % out) | 235 | msger.debug('"parted" output: %s' % out) |
| 235 | 236 | ||
