summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDevendra Tewari <devendra.tewari@gmail.com>2021-04-19 11:23:58 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-05-06 11:14:06 +0100
commit656a65b2b84e7d529b89cf5de7eb838f902d84a2 (patch)
tree273aa600fe078b7c7b1f66859606010f1c016a82 /scripts
parented2b18ed6e76a3bc050a1c48526c114de5cb1a93 (diff)
downloadopenembedded-core-656a65b2b84e7d529b89cf5de7eb838f902d84a2.tar.gz
classes/lib/scripts: Use bb.utils.rename() instead of os.rename()
Incremental build in Docker fails with: OSError: [Errno 18] Invalid cross-device link when source and destination are on different overlay filesystems. Rather than adding fallback code to every call site, use a new wrapper in bitbake which detects this case and falls back to shutil.move which is slower but will handtle the overlay docker filesystems correctly. [YOCTO #14301] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/combo-layer2
-rw-r--r--scripts/lib/devtool/standard.py8
-rw-r--r--scripts/lib/devtool/upgrade.py3
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py2
4 files changed, 8 insertions, 7 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index a634dd69d2..045de65642 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -508,7 +508,7 @@ def check_patch(patchfile):
f.close()
if of:
of.close()
- os.rename(patchfile + '.tmp', patchfile)
+ bb.utils.rename(patchfile + '.tmp', patchfile)
def drop_to_shell(workdir=None):
if not sys.stdin.isatty():
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index f364a45283..5eba2191d9 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -746,7 +746,7 @@ def _check_preserve(config, recipename):
os.remove(removefile)
else:
tf.write(line)
- os.rename(newfile, origfile)
+ bb.utils.rename(newfile, origfile)
def get_staging_kver(srcdir):
# Kernel version from work-shared
@@ -1094,10 +1094,10 @@ def rename(args, config, basepath, workspace):
# Rename bbappend
logger.info('Renaming %s to %s' % (append, newappend))
- os.rename(append, newappend)
+ bb.utils.rename(append, newappend)
# Rename recipe file
logger.info('Renaming %s to %s' % (recipefile, newfile))
- os.rename(recipefile, newfile)
+ bb.utils.rename(recipefile, newfile)
# Rename source tree if it's the default path
appendmd5 = None
@@ -1333,7 +1333,7 @@ def _export_patches(srctree, rd, start_rev, destdir, changed_revs=None):
if match_name:
# Rename patch files
if new_patch != match_name:
- os.rename(os.path.join(destdir, new_patch),
+ bb.utils.rename(os.path.join(destdir, new_patch),
os.path.join(destdir, match_name))
# Need to pop it off the list now before checking changed_revs
oldpath = existing_patches.pop(old_patch)
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 5a057e95f5..24e3700ece 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -71,7 +71,8 @@ def _rename_recipe_dirs(oldpv, newpv, path):
if oldfile.find(oldpv) != -1:
newfile = oldfile.replace(oldpv, newpv)
if oldfile != newfile:
- os.rename(os.path.join(path, oldfile), os.path.join(path, newfile))
+ bb.utils.rename(os.path.join(path, oldfile),
+ os.path.join(path, newfile))
def _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path):
oldrecipe = os.path.basename(oldrecipe)
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index ea709e8c54..96168aadb4 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -616,5 +616,5 @@ class PartitionedImage():
part.start + part.size_sec - 1, part.size_sec)
partimage = self.path + '.p%d' % part.num
- os.rename(source, partimage)
+ bb.utils.rename(source, partimage)
self.partimages.append(partimage)