[honister][PATCH 11/11] license_image.bbclass: close package.manifest file

Anuj Mittal
2022-04-21T16:46:06Z

From: Martin Jansa <Martin.Jansa@gmail.com>

* fixes:
NOTE: Executing write_package_manifest ...
DEBUG: Executing python function write_package_manifest
/OE/build/oe-core/openembedded-core/meta/classes/license_image.bbclass:23: ResourceWarning: unclosed file <_io.TextIOWrapper name='/OE/build/oe-core/tmp-glibc/deploy/licenses/core-image-minimal-qemux86-64/package.manifest' mode='w+' encoding='UTF-8'>
'w+').write(output)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
DEBUG: Python function write_package_manifest finished

[YOCTO #14772]

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit b3114d5d438b7a63a276b4e825b62f3b1ebceed6)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
meta/classes/license_image.bbclass | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass
index 5490d121f1..150e8174f1 100644
--- a/meta/classes/license_image.bbclass
+++ b/meta/classes/license_image.bbclass
@@ -19,8 +19,8 @@ python write_package_manifest() {

pkgs = image_list_installed_packages(d)
output = format_pkg_list(pkgs)
- open(os.path.join(license_image_dir, 'package.manifest'),
- 'w+').write(output)
+ with open(os.path.join(license_image_dir, 'package.manifest'), "w+") as package_manifest:
+ package_manifest.write(output)
}

python license_create_manifest() {
--
2.35.1