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:16:23 +0100 |
| commit | b71375304f393db62e0894af66e9a60bb9a5c8cc (patch) | |
| tree | ac14a351c1c6cd0ba2679c18a4de92c71dee0e7f /meta/lib | |
| parent | 974441aeda1a2e601865743e945e0332c115ef76 (diff) | |
| download | poky-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 'meta/lib')
| -rw-r--r-- | meta/lib/oe/package_manager/deb/__init__.py | 6 | ||||
| -rw-r--r-- | meta/lib/oe/package_manager/ipk/__init__.py | 2 | ||||
| -rw-r--r-- | meta/lib/oe/rootfs.py | 6 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/wic.py | 6 |
4 files changed, 10 insertions, 10 deletions
diff --git a/meta/lib/oe/package_manager/deb/__init__.py b/meta/lib/oe/package_manager/deb/__init__.py index 2ee68fefb1..a4b6b6f647 100644 --- a/meta/lib/oe/package_manager/deb/__init__.py +++ b/meta/lib/oe/package_manager/deb/__init__.py | |||
| @@ -214,7 +214,7 @@ class DpkgPM(OpkgDpkgPM): | |||
| 214 | 214 | ||
| 215 | tmp_sf.write(status) | 215 | tmp_sf.write(status) |
| 216 | 216 | ||
| 217 | os.rename(status_file + ".tmp", status_file) | 217 | bb.utils.rename(status_file + ".tmp", status_file) |
| 218 | 218 | ||
| 219 | def run_pre_post_installs(self, package_name=None): | 219 | def run_pre_post_installs(self, package_name=None): |
| 220 | """ | 220 | """ |
| @@ -299,13 +299,13 @@ class DpkgPM(OpkgDpkgPM): | |||
| 299 | for dir in dirs: | 299 | for dir in dirs: |
| 300 | new_dir = re.sub(r"\.dpkg-new", "", dir) | 300 | new_dir = re.sub(r"\.dpkg-new", "", dir) |
| 301 | if dir != new_dir: | 301 | if dir != new_dir: |
| 302 | os.rename(os.path.join(root, dir), | 302 | bb.utils.rename(os.path.join(root, dir), |
| 303 | os.path.join(root, new_dir)) | 303 | os.path.join(root, new_dir)) |
| 304 | 304 | ||
| 305 | for file in files: | 305 | for file in files: |
| 306 | new_file = re.sub(r"\.dpkg-new", "", file) | 306 | new_file = re.sub(r"\.dpkg-new", "", file) |
| 307 | if file != new_file: | 307 | if file != new_file: |
| 308 | os.rename(os.path.join(root, file), | 308 | bb.utils.rename(os.path.join(root, file), |
| 309 | os.path.join(root, new_file)) | 309 | os.path.join(root, new_file)) |
| 310 | 310 | ||
| 311 | 311 | ||
diff --git a/meta/lib/oe/package_manager/ipk/__init__.py b/meta/lib/oe/package_manager/ipk/__init__.py index da488c1c7f..4cd3963111 100644 --- a/meta/lib/oe/package_manager/ipk/__init__.py +++ b/meta/lib/oe/package_manager/ipk/__init__.py | |||
| @@ -213,7 +213,7 @@ class OpkgPM(OpkgDpkgPM): | |||
| 213 | 213 | ||
| 214 | tmp_sf.write(status) | 214 | tmp_sf.write(status) |
| 215 | 215 | ||
| 216 | os.rename(status_file + ".tmp", status_file) | 216 | bb.utils.rename(status_file + ".tmp", status_file) |
| 217 | 217 | ||
| 218 | def _create_custom_config(self): | 218 | def _create_custom_config(self): |
| 219 | bb.note("Building from feeds activated!") | 219 | bb.note("Building from feeds activated!") |
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index d634adda4e..4b48cdbb65 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
| @@ -114,7 +114,7 @@ class Rootfs(object, metaclass=ABCMeta): | |||
| 114 | shutil.rmtree(self.image_rootfs + '-orig') | 114 | shutil.rmtree(self.image_rootfs + '-orig') |
| 115 | except: | 115 | except: |
| 116 | pass | 116 | pass |
| 117 | os.rename(self.image_rootfs, self.image_rootfs + '-orig') | 117 | bb.utils.rename(self.image_rootfs, self.image_rootfs + '-orig') |
| 118 | 118 | ||
| 119 | bb.note(" Creating debug rootfs...") | 119 | bb.note(" Creating debug rootfs...") |
| 120 | bb.utils.mkdirhier(self.image_rootfs) | 120 | bb.utils.mkdirhier(self.image_rootfs) |
| @@ -165,10 +165,10 @@ class Rootfs(object, metaclass=ABCMeta): | |||
| 165 | shutil.rmtree(self.image_rootfs + '-dbg') | 165 | shutil.rmtree(self.image_rootfs + '-dbg') |
| 166 | except: | 166 | except: |
| 167 | pass | 167 | pass |
| 168 | os.rename(self.image_rootfs, self.image_rootfs + '-dbg') | 168 | bb.utils.rename(self.image_rootfs, self.image_rootfs + '-dbg') |
| 169 | 169 | ||
| 170 | bb.note(" Restoreing original rootfs...") | 170 | bb.note(" Restoreing original rootfs...") |
| 171 | os.rename(self.image_rootfs + '-orig', self.image_rootfs) | 171 | bb.utils.rename(self.image_rootfs + '-orig', self.image_rootfs) |
| 172 | 172 | ||
| 173 | def _exec_shell_cmd(self, cmd): | 173 | def _exec_shell_cmd(self, cmd): |
| 174 | fakerootcmd = self.d.getVar('FAKEROOT') | 174 | fakerootcmd = self.d.getVar('FAKEROOT') |
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index fa81584a8c..a11e2d0781 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py | |||
| @@ -1306,8 +1306,8 @@ class Wic2(WicTestCase): | |||
| 1306 | result = runCmd("%s/usr/sbin/sfdisk -F %s" % (sysroot, new_image_path)) | 1306 | result = runCmd("%s/usr/sbin/sfdisk -F %s" % (sysroot, new_image_path)) |
| 1307 | self.assertTrue("0 B, 0 bytes, 0 sectors" in result.output) | 1307 | self.assertTrue("0 B, 0 bytes, 0 sectors" in result.output) |
| 1308 | 1308 | ||
| 1309 | os.rename(image_path, image_path + '.bak') | 1309 | bb.utils.rename(image_path, image_path + '.bak') |
| 1310 | os.rename(new_image_path, image_path) | 1310 | bb.utils.rename(new_image_path, image_path) |
| 1311 | 1311 | ||
| 1312 | # Check if it boots in qemu | 1312 | # Check if it boots in qemu |
| 1313 | with runqemu('core-image-minimal', ssh=False) as qemu: | 1313 | with runqemu('core-image-minimal', ssh=False) as qemu: |
| @@ -1318,7 +1318,7 @@ class Wic2(WicTestCase): | |||
| 1318 | if os.path.exists(new_image_path): | 1318 | if os.path.exists(new_image_path): |
| 1319 | os.unlink(new_image_path) | 1319 | os.unlink(new_image_path) |
| 1320 | if os.path.exists(image_path + '.bak'): | 1320 | if os.path.exists(image_path + '.bak'): |
| 1321 | os.rename(image_path + '.bak', image_path) | 1321 | bb.utils.rename(image_path + '.bak', image_path) |
| 1322 | 1322 | ||
| 1323 | def test_wic_ls_ext(self): | 1323 | def test_wic_ls_ext(self): |
| 1324 | """Test listing content of the ext partition using 'wic ls'""" | 1324 | """Test listing content of the ext partition using 'wic ls'""" |
