Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] wic: remove intermediate partitions
@ 2015-04-27 23:29 Alexandre Belloni
  2015-04-27 23:36 ` Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2015-04-27 23:29 UTC (permalink / raw)
  To: openembedded-core

Remove intermediate partitions that may have been created by a previous
wic invocation. Those partitions are causing issues on some systems. In
particular vfat partition creation is hanging on mcopy execution on
Fedora.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 scripts/lib/wic/kickstart/custom_commands/partition.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index ff906010b8bf..b228b0d73902 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -230,6 +230,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
 
+        exec_cmd("rm -f %s" % rootfs)
         du_cmd = "du -ks %s" % image_rootfs
         out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
@@ -281,6 +282,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
+        exec_cmd("rm -f %s" % rootfs)
         du_cmd = "du -ks %s" % image_rootfs
         out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
@@ -325,6 +327,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
+        exec_cmd("rm -f %s" % rootfs)
         du_cmd = "du -bks %s" % image_rootfs
         out = exec_cmd(du_cmd)
         blocks = int(out.split()[0])
@@ -377,6 +380,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
 
+        exec_cmd("rm -f %s" % rootfs)
         squashfs_cmd = "mksquashfs %s %s -noappend" % \
                        (image_rootfs, rootfs)
         exec_native_cmd(pseudo + squashfs_cmd, native_sysroot)
@@ -415,6 +419,7 @@ class Wic_PartData(Mic_PartData):
         """
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
+        exec_cmd("rm -f %s" % fs)
         dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
             (fs, self.size)
         exec_cmd(dd_cmd)
@@ -442,6 +447,7 @@ class Wic_PartData(Mic_PartData):
         """
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
+        exec_cmd("rm -f %s" % fs)
         dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
             (fs, self.size)
         exec_cmd(dd_cmd)
@@ -466,6 +472,7 @@ class Wic_PartData(Mic_PartData):
         Prepare an empty vfat partition.
         """
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
+        exec_cmd("rm -f %s" % fs)
 
         blocks = self.size
 
@@ -492,6 +499,7 @@ class Wic_PartData(Mic_PartData):
                       "Proceeding as requested." % self.mountpoint)
 
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
+        exec_cmd("rm -f %s" % fs)
 
         # it is not possible to create a squashfs without source data,
         # thus prepare an empty temp dir that is used as source
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wic: remove intermediate partitions
  2015-04-27 23:29 [PATCH] wic: remove intermediate partitions Alexandre Belloni
@ 2015-04-27 23:36 ` Alexandre Belloni
  2015-04-28  7:16   ` Adrian Freihofer
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2015-04-27 23:36 UTC (permalink / raw)
  To: openembedded-core

Hi,

On 28/04/2015 at 01:29:07 +0200, Alexandre Belloni wrote :
> Remove intermediate partitions that may have been created by a previous
> wic invocation. Those partitions are causing issues on some systems. In
> particular vfat partition creation is hanging on mcopy execution on
> Fedora.
> 

I forgot to add that this fixes #7573.

> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>  scripts/lib/wic/kickstart/custom_commands/partition.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
> index ff906010b8bf..b228b0d73902 100644
> --- a/scripts/lib/wic/kickstart/custom_commands/partition.py
> +++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
> @@ -230,6 +230,7 @@ class Wic_PartData(Mic_PartData):
>          image_rootfs = rootfs_dir
>          rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
>  
> +        exec_cmd("rm -f %s" % rootfs)
>          du_cmd = "du -ks %s" % image_rootfs
>          out = exec_cmd(du_cmd)
>          actual_rootfs_size = int(out.split()[0])
> @@ -281,6 +282,7 @@ class Wic_PartData(Mic_PartData):
>          image_rootfs = rootfs_dir
>          rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
>  
> +        exec_cmd("rm -f %s" % rootfs)
>          du_cmd = "du -ks %s" % image_rootfs
>          out = exec_cmd(du_cmd)
>          actual_rootfs_size = int(out.split()[0])
> @@ -325,6 +327,7 @@ class Wic_PartData(Mic_PartData):
>          image_rootfs = rootfs_dir
>          rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
>  
> +        exec_cmd("rm -f %s" % rootfs)
>          du_cmd = "du -bks %s" % image_rootfs
>          out = exec_cmd(du_cmd)
>          blocks = int(out.split()[0])
> @@ -377,6 +380,7 @@ class Wic_PartData(Mic_PartData):
>          image_rootfs = rootfs_dir
>          rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
>  
> +        exec_cmd("rm -f %s" % rootfs)
>          squashfs_cmd = "mksquashfs %s %s -noappend" % \
>                         (image_rootfs, rootfs)
>          exec_native_cmd(pseudo + squashfs_cmd, native_sysroot)
> @@ -415,6 +419,7 @@ class Wic_PartData(Mic_PartData):
>          """
>          fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
>  
> +        exec_cmd("rm -f %s" % fs)
>          dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
>              (fs, self.size)
>          exec_cmd(dd_cmd)
> @@ -442,6 +447,7 @@ class Wic_PartData(Mic_PartData):
>          """
>          fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
>  
> +        exec_cmd("rm -f %s" % fs)
>          dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
>              (fs, self.size)
>          exec_cmd(dd_cmd)
> @@ -466,6 +472,7 @@ class Wic_PartData(Mic_PartData):
>          Prepare an empty vfat partition.
>          """
>          fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
> +        exec_cmd("rm -f %s" % fs)
>  
>          blocks = self.size
>  
> @@ -492,6 +499,7 @@ class Wic_PartData(Mic_PartData):
>                        "Proceeding as requested." % self.mountpoint)
>  
>          fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
> +        exec_cmd("rm -f %s" % fs)
>  
>          # it is not possible to create a squashfs without source data,
>          # thus prepare an empty temp dir that is used as source
> -- 
> 2.1.4
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wic: remove intermediate partitions
  2015-04-27 23:36 ` Alexandre Belloni
@ 2015-04-28  7:16   ` Adrian Freihofer
  0 siblings, 0 replies; 3+ messages in thread
From: Adrian Freihofer @ 2015-04-28  7:16 UTC (permalink / raw)
  To: openembedded-core

Is there a reason to write "exec_cmd("rm -f %s" % rootfs)" instead of using python functions such as os.remove(), os.rmdir() or shutil.rmtree()?
I know, there are a lot of similar lines in the existing code...

On Tuesday 28 April 2015 01.36:42 Alexandre Belloni wrote:
> Hi,
> 
> On 28/04/2015 at 01:29:07 +0200, Alexandre Belloni wrote :
> > Remove intermediate partitions that may have been created by a previous
> > wic invocation. Those partitions are causing issues on some systems. In
> > particular vfat partition creation is hanging on mcopy execution on
> > Fedora.
> > 
> 
> I forgot to add that this fixes #7573.
> 
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > ---
> >  scripts/lib/wic/kickstart/custom_commands/partition.py | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
> > index ff906010b8bf..b228b0d73902 100644
> > --- a/scripts/lib/wic/kickstart/custom_commands/partition.py
> > +++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
> > @@ -230,6 +230,7 @@ class Wic_PartData(Mic_PartData):
> >          image_rootfs = rootfs_dir
> >          rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
> >  
> > +        exec_cmd("rm -f %s" % rootfs)
> >          du_cmd = "du -ks %s" % image_rootfs
> >          out = exec_cmd(du_cmd)
> >          actual_rootfs_size = int(out.split()[0])
> > @@ -281,6 +282,7 @@ class Wic_PartData(Mic_PartData):
> >          image_rootfs = rootfs_dir
> >          rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
> >  
> > +        exec_cmd("rm -f %s" % rootfs)
> >          du_cmd = "du -ks %s" % image_rootfs
> >          out = exec_cmd(du_cmd)
> >          actual_rootfs_size = int(out.split()[0])
> > @@ -325,6 +327,7 @@ class Wic_PartData(Mic_PartData):
> >          image_rootfs = rootfs_dir
> >          rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
> >  
> > +        exec_cmd("rm -f %s" % rootfs)
> >          du_cmd = "du -bks %s" % image_rootfs
> >          out = exec_cmd(du_cmd)
> >          blocks = int(out.split()[0])
> > @@ -377,6 +380,7 @@ class Wic_PartData(Mic_PartData):
> >          image_rootfs = rootfs_dir
> >          rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
> >  
> > +        exec_cmd("rm -f %s" % rootfs)
> >          squashfs_cmd = "mksquashfs %s %s -noappend" % \
> >                         (image_rootfs, rootfs)
> >          exec_native_cmd(pseudo + squashfs_cmd, native_sysroot)
> > @@ -415,6 +419,7 @@ class Wic_PartData(Mic_PartData):
> >          """
> >          fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
> >  
> > +        exec_cmd("rm -f %s" % fs)
> >          dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
> >              (fs, self.size)
> >          exec_cmd(dd_cmd)
> > @@ -442,6 +447,7 @@ class Wic_PartData(Mic_PartData):
> >          """
> >          fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
> >  
> > +        exec_cmd("rm -f %s" % fs)
> >          dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
> >              (fs, self.size)
> >          exec_cmd(dd_cmd)
> > @@ -466,6 +472,7 @@ class Wic_PartData(Mic_PartData):
> >          Prepare an empty vfat partition.
> >          """
> >          fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
> > +        exec_cmd("rm -f %s" % fs)
> >  
> >          blocks = self.size
> >  
> > @@ -492,6 +499,7 @@ class Wic_PartData(Mic_PartData):
> >                        "Proceeding as requested." % self.mountpoint)
> >  
> >          fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
> > +        exec_cmd("rm -f %s" % fs)
> >  
> >          # it is not possible to create a squashfs without source data,
> >          # thus prepare an empty temp dir that is used as source
> 
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-28  7:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-27 23:29 [PATCH] wic: remove intermediate partitions Alexandre Belloni
2015-04-27 23:36 ` Alexandre Belloni
2015-04-28  7:16   ` Adrian Freihofer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox