[oe-commits] [openembedded-core] 49/50: wic: implement removing directories
git at git.openembedded.org
git at git.openembedded.org
Sun Jun 11 22:08:14 UTC 2017
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit dc8265efaf0434d0970a22966160976af9b01baa
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Thu Jun 8 19:13:06 2017 +0300
wic: implement removing directories
Added support for removing directories using mdeltree
utility to Disk.del method
[YOCTO #11283]
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
scripts/lib/wic/engine.py | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 6fc8bb7..2c899dd 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -239,6 +239,7 @@ class Disk:
self._mdir = None
self._mcopy = None
self._mdel = None
+ self._mdeltree = None
self._partimages = {}
# find parted
@@ -290,6 +291,10 @@ class Disk:
def mdel(self):
return self._prop("mdel")
+ @property
+ def mdeltree(self):
+ return self._prop("mdeltree")
+
def _get_part_image(self, pnum):
if pnum not in self.partitions:
raise WicError("Partition %s is not in the image")
@@ -325,10 +330,19 @@ class Disk:
def remove(self, pnum, path):
"""Remove files/dirs from the partition."""
- cmd = "{} -i {} ::{}".format(self.mdel,
- self._get_part_image(pnum),
- path)
- exec_cmd(cmd)
+ partimg = self._get_part_image(pnum)
+ cmd = "{} -i {} ::{}".format(self.mdel, partimg, path)
+ try:
+ exec_cmd(cmd)
+ except WicError as err:
+ if "not found" in str(err) or "non empty" in str(err):
+ # mdel outputs 'File ... not found' or 'directory .. non empty"
+ # try to use mdeltree as path could be a directory
+ cmd = "{} -i {} ::{}".format(self.mdeltree,
+ partimg, path)
+ exec_cmd(cmd)
+ else:
+ raise err
self._put_part_image(pnum)
def wic_ls(args, native_sysroot):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list