mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
wic: Update cleanup/unmount-related code
The wic code inherited a basic image-creation flow based on mounting loop devices, but wic doesn't actually mount or unmount anything, so get rid of unmount() and consolidate whatever it did do with cleanup(). (From OE-Core rev: 1b103bf4a7c7527d4fc57bad1bbd1d5a5bbddb4a) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
4d1f5ee6d1
commit
467bf7e68f
@@ -109,12 +109,11 @@ class BaseImageCreator(object):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _unmount_instroot(self):
|
def _cleanup(self):
|
||||||
"""Undo anything performed in _mount_instroot().
|
"""Undo anything performed in _create().
|
||||||
|
|
||||||
This is the hook where subclasses must undo anything which was done
|
This is the hook where subclasses must undo anything which was
|
||||||
in _mount_instroot(). For example, if a filesystem image was mounted
|
done in _create().
|
||||||
onto _instroot, it should be unmounted here.
|
|
||||||
|
|
||||||
There is no default implementation.
|
There is no default implementation.
|
||||||
|
|
||||||
@@ -161,23 +160,8 @@ class BaseImageCreator(object):
|
|||||||
|
|
||||||
self._create()
|
self._create()
|
||||||
|
|
||||||
def unmount(self):
|
|
||||||
"""Unmounts the target filesystem.
|
|
||||||
|
|
||||||
The ImageCreator class detaches the system from the install root, but
|
|
||||||
other subclasses may also detach the loopback mounted filesystem image
|
|
||||||
from the install root.
|
|
||||||
|
|
||||||
"""
|
|
||||||
self._unmount_instroot()
|
|
||||||
|
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
"""Unmounts the target filesystem and deletes temporary files.
|
"""Undo anything performed in create().
|
||||||
|
|
||||||
This method calls unmount() and then deletes any temporary files and
|
|
||||||
directories that were created on the host system while building the
|
|
||||||
image.
|
|
||||||
|
|
||||||
Note, make sure to call this method once finished with the creator
|
Note, make sure to call this method once finished with the creator
|
||||||
instance in order to ensure no stale files are left on the host e.g.:
|
instance in order to ensure no stale files are left on the host e.g.:
|
||||||
@@ -192,7 +176,7 @@ class BaseImageCreator(object):
|
|||||||
if not self.__builddir:
|
if not self.__builddir:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.unmount()
|
self._cleanup()
|
||||||
|
|
||||||
shutil.rmtree(self.__builddir, ignore_errors = True)
|
shutil.rmtree(self.__builddir, ignore_errors = True)
|
||||||
self.__builddir = None
|
self.__builddir = None
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ class DirectImageCreator(BaseImageCreator):
|
|||||||
|
|
||||||
return (rootdev, root_part_uuid)
|
return (rootdev, root_part_uuid)
|
||||||
|
|
||||||
def _unmount_instroot(self):
|
def _cleanup(self):
|
||||||
if not self.__instimage is None:
|
if not self.__instimage is None:
|
||||||
try:
|
try:
|
||||||
self.__instimage.cleanup()
|
self.__instimage.cleanup()
|
||||||
|
|||||||
Reference in New Issue
Block a user