All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix wic images build in parallel
@ 2020-01-13 12:37 Maxim Uvarov
  2020-01-13 13:02 ` ✗ patchtest: failure for " Patchwork
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Uvarov @ 2020-01-13 12:37 UTC (permalink / raw)
  To: openembedded-core

OE wic plugins create temporary file with the index of the line
tmp file name. This causes race in case several builds run in time.
Add more entropy as timestamp to remove this race.

Suggested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 scripts/lib/wic/plugins/source/bootimg-partition.py | 5 +++--
 scripts/lib/wic/plugins/source/bootimg-pcbios.py    | 3 ++-
 scripts/lib/wic/plugins/source/rawcopy.py           | 3 ++-
 scripts/lib/wic/plugins/source/rootfs.py            | 3 ++-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index 138986a71e..b6cea1096a 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -13,6 +13,7 @@
 import logging
 import os
 import re
+import time
 
 from glob import glob
 
@@ -38,7 +39,7 @@ class BootimgPartitionPlugin(SourcePlugin):
         """
         Called before do_prepare_partition(), create u-boot specific boot config
         """
-        hdddir = "%s/boot.%d" % (cr_workdir, part.lineno)
+        hdddir = "%s/boot.%d" % (cr_workdir, part.lineno, time.time())
         install_cmd = "install -d %s" % hdddir
         exec_cmd(install_cmd)
 
@@ -171,7 +172,7 @@ class BootimgPartitionPlugin(SourcePlugin):
         - sets up a vfat partition
         - copies all files listed in IMAGE_BOOT_FILES variable
         """
-        hdddir = "%s/boot.%d" % (cr_workdir, part.lineno)
+        hdddir = "%s/boot.%d_%s" % (cr_workdir, part.lineno, time.time())
 
         if not kernel_dir:
             kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index f2639e7004..8ac73c2067 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -13,6 +13,7 @@
 import logging
 import os
 import re
+import time
 
 from wic import WicError
 from wic.engine import get_custom_config
@@ -184,7 +185,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
                      extra_blocks, part.mountpoint, blocks)
 
         # dosfs image, created by mkdosfs
-        bootimg = "%s/boot%s.img" % (cr_workdir, part.lineno)
+        bootimg = "%s/boot%s_%s.img" % (cr_workdir, part.lineno, time.time())
 
         dosfs_cmd = "mkdosfs -n boot -i %s -S 512 -C %s %d" % \
                     (part.fsuuid, bootimg, blocks)
diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
index 82970ce51b..9ada3d39c9 100644
--- a/scripts/lib/wic/plugins/source/rawcopy.py
+++ b/scripts/lib/wic/plugins/source/rawcopy.py
@@ -4,6 +4,7 @@
 
 import logging
 import os
+import time
 
 from wic import WicError
 from wic.pluginbase import SourcePlugin
@@ -57,7 +58,7 @@ class RawCopyPlugin(SourcePlugin):
             raise WicError("No file specified")
 
         src = os.path.join(kernel_dir, source_params['file'])
-        dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'], part.lineno))
+        dst = os.path.join(cr_workdir, "%s.%s_%s" % (source_params['file'], part.lineno, time.time()))
 
         if not os.path.exists(os.path.dirname(dst)):
             os.makedirs(os.path.dirname(dst))
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index 705aeb5563..37ebee89ea 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -15,6 +15,7 @@ import logging
 import os
 import shutil
 import sys
+import time
 
 from oe.path import copyhardlinktree
 
@@ -74,7 +75,7 @@ class RootfsPlugin(SourcePlugin):
         if part.exclude_path or part.include_path:
             # We need a new rootfs directory we can delete files from. Copy to
             # workdir.
-            new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno))
+            new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d_%s" % (part.lineno, time.time())))
 
             if os.path.lexists(new_rootfs):
                 shutil.rmtree(os.path.join(new_rootfs))
-- 
2.17.1



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

end of thread, other threads:[~2020-01-13 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13 12:37 [PATCH] fix wic images build in parallel Maxim Uvarov
2020-01-13 13:02 ` ✗ patchtest: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.