diff options
author | Devendra Tewari <devendra.tewari@gmail.com> | 2021-04-19 11:23:58 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-05-06 11:04:59 +0100 |
commit | 581233a798434f178898f12fa35bbcccb92e7768 (patch) | |
tree | 85b7608515935ce107304532ea64cda8a0e80dd9 /bitbake/lib/bb/tests | |
parent | 7fbd7744ea68c17f396e87e15f9c7c9f6a371f23 (diff) | |
download | poky-581233a798434f178898f12fa35bbcccb92e7768.tar.gz |
bitbake: lib/bb: Add bb.utils.rename() helper function and use for renaming
os.rename can fail for example an incremental build in Docker fails with:
OSError: [Errno 18] Invalid cross-device link
when source and destination are on different overlay filesystems.
Rather than trying to fix every call site, add a wrapper in bb.utils
for renames. We can then handle cross device failures and
fall back to shutil.move. The reason os.rename is still used is
because shutil.move is too slow for speed sensitive sections of code.
[YOCTO #14301]
(Bitbake rev: c5c4e49574ab2a65e06298a0a77bb98b041cf56b)
Signed-off-by: Devendra Tewari <devendra.tewari@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 0f7585e119..9291ce4a06 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -1798,7 +1798,7 @@ class GitShallowTest(FetcherTest): | |||
1798 | 1798 | ||
1799 | # Set up the mirror | 1799 | # Set up the mirror |
1800 | mirrordir = os.path.join(self.tempdir, 'mirror') | 1800 | mirrordir = os.path.join(self.tempdir, 'mirror') |
1801 | os.rename(self.dldir, mirrordir) | 1801 | bb.utils.rename(self.dldir, mirrordir) |
1802 | self.d.setVar('PREMIRRORS', 'gitsm://.*/.* file://%s/\n' % mirrordir) | 1802 | self.d.setVar('PREMIRRORS', 'gitsm://.*/.* file://%s/\n' % mirrordir) |
1803 | 1803 | ||
1804 | # Fetch from the mirror | 1804 | # Fetch from the mirror |
@@ -1916,7 +1916,7 @@ class GitShallowTest(FetcherTest): | |||
1916 | bb.utils.mkdirhier(mirrordir) | 1916 | bb.utils.mkdirhier(mirrordir) |
1917 | self.d.setVar('PREMIRRORS', 'git://.*/.* file://%s/\n' % mirrordir) | 1917 | self.d.setVar('PREMIRRORS', 'git://.*/.* file://%s/\n' % mirrordir) |
1918 | 1918 | ||
1919 | os.rename(os.path.join(self.dldir, mirrortarball), | 1919 | bb.utils.rename(os.path.join(self.dldir, mirrortarball), |
1920 | os.path.join(mirrordir, mirrortarball)) | 1920 | os.path.join(mirrordir, mirrortarball)) |
1921 | 1921 | ||
1922 | # Fetch from the mirror | 1922 | # Fetch from the mirror |