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:10 +0100 |
commit | 76adf38c0d8e0faf04a5ecb3fcfbe831c85bb81f (patch) | |
tree | e49cde7f0a58ed4b58420d4ab16724f24c05da7a /scripts | |
parent | 8d207e55031c0b93387e728f4312b8cb34ad5b12 (diff) | |
download | openembedded-core-76adf38c0d8e0faf04a5ecb3fcfbe831c85bb81f.tar.gz openembedded-core-76adf38c0d8e0faf04a5ecb3fcfbe831c85bb81f.tar.bz2 openembedded-core-76adf38c0d8e0faf04a5ecb3fcfbe831c85bb81f.zip |
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]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-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): """ parts = self._get_parts() - self.__image = Image() + self.__image = Image(self.native_sysroot) for p in parts: # 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 from wic.utils.errors import * from wic.utils.oe.misc import * -def find_binary_path(binary): - if os.environ.has_key("PATH"): - paths = os.environ["PATH"].split(":") - else: - paths = [] - if os.environ.has_key("HOME"): - paths += [os.environ["HOME"] + "/bin"] - paths += ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"] - - for path in paths: - bin_path = "%s/%s" % (path, binary) - if os.path.exists(bin_path): - return bin_path - - print "External command '%s' not found, exiting." % binary - print " (Please install '%s' on your host system)" % binary - sys.exit(1) - def makedirs(dirname): """A version of os.makedirs() that doesn't throw an 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: An Image is a container for a set of DiskImages and associated partitions. """ - def __init__(self): + def __init__(self, native_sysroot=None): self.disks = {} self.partitions = [] - self.parted = find_binary_path("parted") # Size of a sector used in calculations self.sector_size = SECTOR_SIZE self._partitions_layed_out = False + self.native_sysroot = native_sysroot def __add_disk(self, disk_name): """ Add a disk 'disk_name' to the internal list of disks. Note, @@ -225,11 +225,12 @@ class Image: def __run_parted(self, args): """ Run parted with arguments specified in the 'args' list. """ - args.insert(0, self.parted) + args.insert(0, "parted") + args = ' '.join(args) msger.debug(args) - rc, out = runner.runtool(args, catch = 3) - out = out.strip() + rc, out = exec_native_cmd(args, self.native_sysroot) + if out: msger.debug('"parted" output: %s' % out) |