Openembedded Core Discussions
 help / color / mirror / Atom feed
* [fido][PATCH 0/2] Backports for WIC
@ 2015-07-23 21:44 Ash Charles
  2015-07-23 21:44 ` [fido][PATCH 1/2] wic: remove intermediate partitions Ash Charles
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ash Charles @ 2015-07-23 21:44 UTC (permalink / raw)
  To: openembedded-core

In order to use the wic tool multiple times (Ubuntu 15.04 host), I need
to cherry-pick these two patches onto the fido branch.  Otherwise, wic
just hangs on the second invocation.  Can these two patches be applied
as backports to Fido?

Alexandre Belloni (1):
  wic: remove intermediate partitions

Ed Bartosh (1):
  wic: Make sure file exists before removing it

 scripts/lib/wic/kickstart/custom_commands/partition.py | 8 ++++++++
 1 file changed, 8 insertions(+)

-- 
2.1.4



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

* [fido][PATCH 1/2] wic: remove intermediate partitions
  2015-07-23 21:44 [fido][PATCH 0/2] Backports for WIC Ash Charles
@ 2015-07-23 21:44 ` Ash Charles
  2015-07-23 21:44 ` [fido][PATCH 2/2] wic: Make sure file exists before removing it Ash Charles
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Ash Charles @ 2015-07-23 21:44 UTC (permalink / raw)
  To: openembedded-core

From: Alexandre Belloni <alexandre.belloni@free-electrons.com>

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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 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 f3d553b..654c380 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -231,6 +231,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
 
+        os.remove(rootfs)
         du_cmd = "du -ks %s" % image_rootfs
         out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
@@ -282,6 +283,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
+        os.remove(rootfs)
         du_cmd = "du -ks %s" % image_rootfs
         out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
@@ -326,6 +328,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
+        os.remove(rootfs)
         du_cmd = "du -bks %s" % image_rootfs
         out = exec_cmd(du_cmd)
         blocks = int(out.split()[0])
@@ -378,6 +381,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
 
+        os.remove(rootfs)
         squashfs_cmd = "mksquashfs %s %s -noappend" % \
                        (image_rootfs, rootfs)
         exec_native_cmd(pseudo + squashfs_cmd, native_sysroot)
@@ -416,6 +420,7 @@ class Wic_PartData(Mic_PartData):
         """
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
+        os.remove(fs)
         dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
             (fs, self.size)
         exec_cmd(dd_cmd)
@@ -443,6 +448,7 @@ class Wic_PartData(Mic_PartData):
         """
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
+        os.remove(fs)
         dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
             (fs, self.size)
         exec_cmd(dd_cmd)
@@ -467,6 +473,7 @@ class Wic_PartData(Mic_PartData):
         Prepare an empty vfat partition.
         """
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
+        os.remove(fs)
 
         blocks = self.size
 
@@ -493,6 +500,7 @@ class Wic_PartData(Mic_PartData):
                       "Proceeding as requested." % self.mountpoint)
 
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
+        os.remove(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] 6+ messages in thread

* [fido][PATCH 2/2] wic: Make sure file exists before removing it
  2015-07-23 21:44 [fido][PATCH 0/2] Backports for WIC Ash Charles
  2015-07-23 21:44 ` [fido][PATCH 1/2] wic: remove intermediate partitions Ash Charles
@ 2015-07-23 21:44 ` Ash Charles
  2015-07-23 21:57 ` [fido][PATCH 0/2] Backports for WIC Philip Balister
  2015-07-30 16:22 ` Joshua Lock
  3 siblings, 0 replies; 6+ messages in thread
From: Ash Charles @ 2015-07-23 21:44 UTC (permalink / raw)
  To: openembedded-core

From: Ed Bartosh <ed.bartosh@linux.intel.com>

Bunch of os.remove calls were added to the partition.py lately.
They're causing wic to fail with OSError: [Errno 2] No such file or directory
if file doesn't exist.

Added check for file existence to all recently added calls of
os.remove. That should fix this regression.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 scripts/lib/wic/kickstart/custom_commands/partition.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index 654c380..7cfeec4 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -231,7 +231,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
 
-        os.remove(rootfs)
+        os.path.isfile(rootfs) and os.remove(rootfs)
         du_cmd = "du -ks %s" % image_rootfs
         out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
@@ -283,7 +283,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
-        os.remove(rootfs)
+        os.path.isfile(rootfs) and os.remove(rootfs)
         du_cmd = "du -ks %s" % image_rootfs
         out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
@@ -328,7 +328,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
-        os.remove(rootfs)
+        os.path.isfile(rootfs) and os.remove(rootfs)
         du_cmd = "du -bks %s" % image_rootfs
         out = exec_cmd(du_cmd)
         blocks = int(out.split()[0])
@@ -381,7 +381,7 @@ class Wic_PartData(Mic_PartData):
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
 
-        os.remove(rootfs)
+        os.path.isfile(rootfs) and os.remove(rootfs)
         squashfs_cmd = "mksquashfs %s %s -noappend" % \
                        (image_rootfs, rootfs)
         exec_native_cmd(pseudo + squashfs_cmd, native_sysroot)
@@ -420,7 +420,7 @@ class Wic_PartData(Mic_PartData):
         """
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
-        os.remove(fs)
+        os.path.isfile(fs) and os.remove(fs)
         dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
             (fs, self.size)
         exec_cmd(dd_cmd)
@@ -448,7 +448,7 @@ class Wic_PartData(Mic_PartData):
         """
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
-        os.remove(fs)
+        os.path.isfile(fs) and os.remove(fs)
         dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
             (fs, self.size)
         exec_cmd(dd_cmd)
@@ -473,7 +473,7 @@ class Wic_PartData(Mic_PartData):
         Prepare an empty vfat partition.
         """
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
-        os.remove(fs)
+        os.path.isfile(fs) and os.remove(fs)
 
         blocks = self.size
 
@@ -500,7 +500,7 @@ class Wic_PartData(Mic_PartData):
                       "Proceeding as requested." % self.mountpoint)
 
         fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
-        os.remove(fs)
+        os.path.isfile(fs) and os.remove(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] 6+ messages in thread

* Re: [fido][PATCH 0/2] Backports for WIC
  2015-07-23 21:44 [fido][PATCH 0/2] Backports for WIC Ash Charles
  2015-07-23 21:44 ` [fido][PATCH 1/2] wic: remove intermediate partitions Ash Charles
  2015-07-23 21:44 ` [fido][PATCH 2/2] wic: Make sure file exists before removing it Ash Charles
@ 2015-07-23 21:57 ` Philip Balister
  2015-07-30 16:22 ` Joshua Lock
  3 siblings, 0 replies; 6+ messages in thread
From: Philip Balister @ 2015-07-23 21:57 UTC (permalink / raw)
  To: Ash Charles, openembedded-core

I'd like to see this also. I've added a rm to my script to work around
this, but this change would help a lot of people.

Philip

On 07/23/2015 05:44 PM, Ash Charles wrote:
> In order to use the wic tool multiple times (Ubuntu 15.04 host), I need
> to cherry-pick these two patches onto the fido branch.  Otherwise, wic
> just hangs on the second invocation.  Can these two patches be applied
> as backports to Fido?
> 
> Alexandre Belloni (1):
>   wic: remove intermediate partitions
> 
> Ed Bartosh (1):
>   wic: Make sure file exists before removing it
> 
>  scripts/lib/wic/kickstart/custom_commands/partition.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 


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

* Re: [fido][PATCH 0/2] Backports for WIC
  2015-07-23 21:44 [fido][PATCH 0/2] Backports for WIC Ash Charles
                   ` (2 preceding siblings ...)
  2015-07-23 21:57 ` [fido][PATCH 0/2] Backports for WIC Philip Balister
@ 2015-07-30 16:22 ` Joshua Lock
  2015-07-30 17:11   ` Ash Charles
  3 siblings, 1 reply; 6+ messages in thread
From: Joshua Lock @ 2015-07-30 16:22 UTC (permalink / raw)
  To: openembedded-core

Hi Ash,

On Thu, 2015-07-23 at 14:44 -0700, Ash Charles wrote:
> In order to use the wic tool multiple times (Ubuntu 15.04 host), I 
> need
> to cherry-pick these two patches onto the fido branch.  Otherwise, 
> wic
> just hangs on the second invocation.  Can these two patches be 
> applied
> as backports to Fido?

Thanks for reporting the issue and finding the fix. Backporting those
changes seems reasonable to me, I've queued them in my joshuagl/fido
-next branch[1].

Regards,

Joshua

1. http://cgit.openembedded.org/openembedded-core-contrib/log/?h=joshua
gl/fido-next

> Alexandre Belloni (1):
>   wic: remove intermediate partitions
> 
> Ed Bartosh (1):
>   wic: Make sure file exists before removing it
> 
>  scripts/lib/wic/kickstart/custom_commands/partition.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> -- 
> 2.1.4
> 


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

* Re: [fido][PATCH 0/2] Backports for WIC
  2015-07-30 16:22 ` Joshua Lock
@ 2015-07-30 17:11   ` Ash Charles
  0 siblings, 0 replies; 6+ messages in thread
From: Ash Charles @ 2015-07-30 17:11 UTC (permalink / raw)
  To: Joshua Lock; +Cc: OE-core

On Thu, Jul 30, 2015 at 9:22 AM, Joshua Lock
<joshua.lock@collabora.co.uk> wrote:
> Backporting those
> changes seems reasonable to me, I've queued them in my joshuagl/fido
> -next branch[1].
Thanks Joshua.
--Ash


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

end of thread, other threads:[~2015-07-30 17:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-23 21:44 [fido][PATCH 0/2] Backports for WIC Ash Charles
2015-07-23 21:44 ` [fido][PATCH 1/2] wic: remove intermediate partitions Ash Charles
2015-07-23 21:44 ` [fido][PATCH 2/2] wic: Make sure file exists before removing it Ash Charles
2015-07-23 21:57 ` [fido][PATCH 0/2] Backports for WIC Philip Balister
2015-07-30 16:22 ` Joshua Lock
2015-07-30 17:11   ` Ash Charles

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