summaryrefslogtreecommitdiffstats
path: root/scripts/lib
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:16:23 +0100
commitb71375304f393db62e0894af66e9a60bb9a5c8cc (patch)
treeac14a351c1c6cd0ba2679c18a4de92c71dee0e7f /scripts/lib
parent974441aeda1a2e601865743e945e0332c115ef76 (diff)
downloadpoky-b71375304f393db62e0894af66e9a60bb9a5c8cc.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] (From OE-Core rev: 656a65b2b84e7d529b89cf5de7eb838f902d84a2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-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
3 files changed, 7 insertions, 6 deletions
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):
746 os.remove(removefile) 746 os.remove(removefile)
747 else: 747 else:
748 tf.write(line) 748 tf.write(line)
749 os.rename(newfile, origfile) 749 bb.utils.rename(newfile, origfile)
750 750
751def get_staging_kver(srcdir): 751def get_staging_kver(srcdir):
752 # Kernel version from work-shared 752 # Kernel version from work-shared
@@ -1094,10 +1094,10 @@ def rename(args, config, basepath, workspace):
1094 1094
1095 # Rename bbappend 1095 # Rename bbappend
1096 logger.info('Renaming %s to %s' % (append, newappend)) 1096 logger.info('Renaming %s to %s' % (append, newappend))
1097 os.rename(append, newappend) 1097 bb.utils.rename(append, newappend)
1098 # Rename recipe file 1098 # Rename recipe file
1099 logger.info('Renaming %s to %s' % (recipefile, newfile)) 1099 logger.info('Renaming %s to %s' % (recipefile, newfile))
1100 os.rename(recipefile, newfile) 1100 bb.utils.rename(recipefile, newfile)
1101 1101
1102 # Rename source tree if it's the default path 1102 # Rename source tree if it's the default path
1103 appendmd5 = None 1103 appendmd5 = None
@@ -1333,7 +1333,7 @@ def _export_patches(srctree, rd, start_rev, destdir, changed_revs=None):
1333 if match_name: 1333 if match_name:
1334 # Rename patch files 1334 # Rename patch files
1335 if new_patch != match_name: 1335 if new_patch != match_name:
1336 os.rename(os.path.join(destdir, new_patch), 1336 bb.utils.rename(os.path.join(destdir, new_patch),
1337 os.path.join(destdir, match_name)) 1337 os.path.join(destdir, match_name))
1338 # Need to pop it off the list now before checking changed_revs 1338 # Need to pop it off the list now before checking changed_revs
1339 oldpath = existing_patches.pop(old_patch) 1339 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):
71 if oldfile.find(oldpv) != -1: 71 if oldfile.find(oldpv) != -1:
72 newfile = oldfile.replace(oldpv, newpv) 72 newfile = oldfile.replace(oldpv, newpv)
73 if oldfile != newfile: 73 if oldfile != newfile:
74 os.rename(os.path.join(path, oldfile), os.path.join(path, newfile)) 74 bb.utils.rename(os.path.join(path, oldfile),
75 os.path.join(path, newfile))
75 76
76def _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path): 77def _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path):
77 oldrecipe = os.path.basename(oldrecipe) 78 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():
616 part.start + part.size_sec - 1, part.size_sec) 616 part.start + part.size_sec - 1, part.size_sec)
617 617
618 partimage = self.path + '.p%d' % part.num 618 partimage = self.path + '.p%d' % part.num
619 os.rename(source, partimage) 619 bb.utils.rename(source, partimage)
620 self.partimages.append(partimage) 620 self.partimages.append(partimage)