Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [wic][PATCH v2] wic: remove partition images
Date: Fri, 23 Sep 2016 15:10:26 +0300	[thread overview]
Message-ID: <1474632626-507-1-git-send-email-ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <1474537680-13224-1-git-send-email-ed.bartosh@linux.intel.com>

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>
---
 scripts/lib/wic/utils/partitionedfs.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index 46b5d34..cafb933 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:
-- 
2.1.4



      reply	other threads:[~2016-09-23 12:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22  9:48 [wic][PATCH] wic: remove partition images Ed Bartosh
2016-09-23 12:10 ` Ed Bartosh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474632626-507-1-git-send-email-ed.bartosh@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox