summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2022-06-07 22:52:42 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-08 21:55:56 +0100
commit1025118484c1f0359a1909d4e9246c68615d0f98 (patch)
tree2b58dbee65f6da23d30f49a3c68cb748dc3439af /meta/lib
parenteadc2ba4cd999cd303d842d14d7597245955e6c7 (diff)
downloadpoky-1025118484c1f0359a1909d4e9246c68615d0f98.tar.gz
rootfs.py: close kernel_abi_ver_file
* fixes: oe-core/meta/lib/oe/rootfs.py:331: ResourceWarning: unclosed file <_io.TextIOWrapper name='pkgdata/mach/kernel-depmod/kernel-abiversion' mode='r' encoding='UTF-8'> kernel_ver = open(kernel_abi_ver_file).read().strip(' \n') (From OE-Core rev: f9dd8ee063c1132265248457fcd628e1e93727be) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/rootfs.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 61ccf369f1..9e6b411fb6 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -328,7 +328,9 @@ class Rootfs(object, metaclass=ABCMeta):
328 if not os.path.exists(kernel_abi_ver_file): 328 if not os.path.exists(kernel_abi_ver_file):
329 bb.fatal("No kernel-abiversion file found (%s), cannot run depmod, aborting" % kernel_abi_ver_file) 329 bb.fatal("No kernel-abiversion file found (%s), cannot run depmod, aborting" % kernel_abi_ver_file)
330 330
331 kernel_ver = open(kernel_abi_ver_file).read().strip(' \n') 331 with open(kernel_abi_ver_file) as f:
332 kernel_ver = f.read().strip(' \n')
333
332 versioned_modules_dir = os.path.join(self.image_rootfs, modules_dir, kernel_ver) 334 versioned_modules_dir = os.path.join(self.image_rootfs, modules_dir, kernel_ver)
333 335
334 bb.utils.mkdirhier(versioned_modules_dir) 336 bb.utils.mkdirhier(versioned_modules_dir)