diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-09-23 15:10:26 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-24 07:30:09 +0100 |
commit | 347316dc150c769dfe892a96a13abf1cc01c14d5 (patch) | |
tree | db53a9980ed5504fbf364a2f78af8c42d138097e | |
parent | 6b8d16c6ebe90dae2c3595f18f3878c3d7a5a15c (diff) | |
download | poky-347316dc150c769dfe892a96a13abf1cc01c14d5.tar.gz |
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>
-rw-r--r-- | scripts/lib/wic/utils/partitionedfs.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index 46b5d345c7..cafb9338df 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py | |||
@@ -43,6 +43,7 @@ class Image(): | |||
43 | def __init__(self, native_sysroot=None): | 43 | def __init__(self, native_sysroot=None): |
44 | self.disks = {} | 44 | self.disks = {} |
45 | self.partitions = [] | 45 | self.partitions = [] |
46 | self.partimages = [] | ||
46 | # Size of a sector used in calculations | 47 | # Size of a sector used in calculations |
47 | self.sector_size = SECTOR_SIZE | 48 | self.sector_size = SECTOR_SIZE |
48 | self._partitions_layed_out = False | 49 | self._partitions_layed_out = False |
@@ -336,6 +337,10 @@ class Image(): | |||
336 | disk['disk'].cleanup() | 337 | disk['disk'].cleanup() |
337 | except: | 338 | except: |
338 | pass | 339 | pass |
340 | # remove partition images | ||
341 | for image in self.partimages: | ||
342 | if os.path.isfile(image): | ||
343 | os.remove(image) | ||
339 | 344 | ||
340 | def assemble(self, image_file): | 345 | def assemble(self, image_file): |
341 | msger.debug("Installing partitions") | 346 | msger.debug("Installing partitions") |
@@ -351,7 +356,9 @@ class Image(): | |||
351 | (source, part['num'], part['start'], | 356 | (source, part['num'], part['start'], |
352 | part['start'] + part['size'] - 1, part['size'])) | 357 | part['start'] + part['size'] - 1, part['size'])) |
353 | 358 | ||
354 | os.rename(source, image_file + '.p%d' % part['num']) | 359 | partimage = image_file + '.p%d' % part['num'] |
360 | os.rename(source, partimage) | ||
361 | self.partimages.append(partimage) | ||
355 | 362 | ||
356 | def create(self): | 363 | def create(self): |
357 | for dev in self.disks: | 364 | for dev in self.disks: |