summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-09-23 15:10:26 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-23 18:06:10 +0100
commit51171b4aa10f2218c5e27d785ca7bf4f3949a4b4 (patch)
treebecd3c78f304c7d23c566cca19b1f1b48f3c2720 /scripts
parent101e2a5e0b7822ca3de3d3a73369405c05ab3c5b (diff)
downloadopenembedded-core-51171b4aa10f2218c5e27d785ca7bf4f3949a4b4.tar.gz
openembedded-core-51171b4aa10f2218c5e27d785ca7bf4f3949a4b4.tar.bz2
openembedded-core-51171b4aa10f2218c5e27d785ca7bf4f3949a4b4.zip
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. 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/utils/partitionedfs.py9
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():
def __init__(self, native_sysroot=None):
self.disks = {}
self.partitions = []
+ self.partimages = []
# Size of a sector used in calculations
self.sector_size = SECTOR_SIZE
self._partitions_layed_out = False
@@ -336,6 +337,10 @@ class Image():
disk['disk'].cleanup()
except:
pass
+ # remove partition images
+ for image in self.partimages:
+ if os.path.isfile(image):
+ os.remove(image)
def assemble(self, image_file):
msger.debug("Installing partitions")
@@ -351,7 +356,9 @@ class Image():
(source, part['num'], part['start'],
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):
for dev in self.disks: