1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 13:29:49 +00:00

wic: remove partition images

Preserving images for every partition doubles disk space
consumed by an image build. As those images are not used,
so it's better to remove them after assembling final image.

(From OE-Core rev: 51171b4aa10f2218c5e27d785ca7bf4f3949a4b4)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh
2016-09-23 15:10:26 +03:00
committed by Richard Purdie
parent 6b8d16c6eb
commit 347316dc15
+8 -1
View File
@@ -43,6 +43,7 @@ class Image():
def __init__(self, native_sysroot=None): def __init__(self, native_sysroot=None):
self.disks = {} self.disks = {}
self.partitions = [] self.partitions = []
self.partimages = []
# Size of a sector used in calculations # Size of a sector used in calculations
self.sector_size = SECTOR_SIZE self.sector_size = SECTOR_SIZE
self._partitions_layed_out = False self._partitions_layed_out = False
@@ -336,6 +337,10 @@ class Image():
disk['disk'].cleanup() disk['disk'].cleanup()
except: except:
pass pass
# remove partition images
for image in self.partimages:
if os.path.isfile(image):
os.remove(image)
def assemble(self, image_file): def assemble(self, image_file):
msger.debug("Installing partitions") msger.debug("Installing partitions")
@@ -351,7 +356,9 @@ class Image():
(source, part['num'], part['start'], (source, part['num'], part['start'],
part['start'] + part['size'] - 1, part['size'])) part['start'] + part['size'] - 1, part['size']))
os.rename(source, image_file + '.p%d' % part['num']) partimage = image_file + '.p%d' % part['num']
os.rename(source, partimage)
self.partimages.append(partimage)
def create(self): def create(self):
for dev in self.disks: for dev in self.disks: