Compare commits
12 Commits
f77edc6191
...
75d5cbc170
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75d5cbc170 | ||
|
|
d4d4d668b1 | ||
|
|
f36ea132ea | ||
|
|
a69833b806 | ||
|
|
f107e71368 | ||
|
|
1a0eaf7a77 | ||
|
|
d850d805b4 | ||
|
|
c97c3c4208 | ||
|
|
9f83887267 | ||
|
|
cf314f8cea | ||
|
|
7aaa72011b | ||
|
|
06317aa842 |
70
backport-Fixed-cleanup-of-temporary-directory.patch
Normal file
70
backport-Fixed-cleanup-of-temporary-directory.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From 8794d4a7cbf7bb43382e283c9c6f6c77c712d0b8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= <ms@suse.de>
|
||||
Date: Thu, 10 Jun 2021 11:10:56 +0200
|
||||
Subject: [PATCH] Fixed cleanup of temporary directory
|
||||
|
||||
In the custom kiwi initrd build process a temporary directory
|
||||
holding a copy of the initrd root tree is created. That data
|
||||
got never cleaned up. This commit uses a TemporaryDirectory
|
||||
object from the tempfile module to make sure it gets deleted
|
||||
once the execution scope is done. This Fixes #1837
|
||||
---
|
||||
kiwi/boot/image/builtin_kiwi.py | 7 +++----
|
||||
test/unit/boot/image/builtin_kiwi_test.py | 7 ++++++-
|
||||
2 files changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/kiwi/boot/image/builtin_kiwi.py b/kiwi/boot/image/builtin_kiwi.py
|
||||
index 08c5644..5b1c297 100644
|
||||
--- a/kiwi/boot/image/builtin_kiwi.py
|
||||
+++ b/kiwi/boot/image/builtin_kiwi.py
|
||||
@@ -17,6 +17,7 @@
|
||||
#
|
||||
import os
|
||||
import logging
|
||||
+from tempfile import TemporaryDirectory
|
||||
from tempfile import mkdtemp
|
||||
|
||||
# project
|
||||
@@ -129,13 +130,11 @@ class BootImageKiwi(BootImageBase):
|
||||
kiwi_initrd_basename = basename
|
||||
else:
|
||||
kiwi_initrd_basename = self.initrd_base_name
|
||||
- temp_boot_root_directory = mkdtemp(
|
||||
+ temp_boot_root = TemporaryDirectory(
|
||||
prefix='kiwi_boot_root_copy.'
|
||||
)
|
||||
+ temp_boot_root_directory = temp_boot_root.name
|
||||
os.chmod(temp_boot_root_directory, 0o755)
|
||||
- self.temp_directories.append(
|
||||
- temp_boot_root_directory
|
||||
- )
|
||||
data = DataSync(
|
||||
self.boot_root_directory + '/',
|
||||
temp_boot_root_directory
|
||||
diff --git a/test/unit/boot/image/builtin_kiwi_test.py b/test/unit/boot/image/builtin_kiwi_test.py
|
||||
index 7a0ff1d..ed72843 100644
|
||||
--- a/test/unit/boot/image/builtin_kiwi_test.py
|
||||
+++ b/test/unit/boot/image/builtin_kiwi_test.py
|
||||
@@ -101,13 +101,18 @@ class TestBootImageKiwi:
|
||||
@patch('kiwi.boot.image.base.BootImageBase.is_prepared')
|
||||
@patch('kiwi.boot.image.builtin_kiwi.mkdtemp')
|
||||
@patch('kiwi.boot.image.builtin_kiwi.os.chmod')
|
||||
+ @patch('kiwi.boot.image.builtin_kiwi.TemporaryDirectory')
|
||||
def test_create_initrd(
|
||||
- self, mock_os_chmod, mock_mkdtemp, mock_prepared, mock_sync,
|
||||
+ self, mock_TemporaryDirectory, mock_os_chmod,
|
||||
+ mock_mkdtemp, mock_prepared, mock_sync,
|
||||
mock_wipe, mock_create, mock_compress, mock_cpio
|
||||
):
|
||||
data = mock.Mock()
|
||||
mock_sync.return_value = data
|
||||
mock_mkdtemp.return_value = 'temp-boot-directory'
|
||||
+ temporary_directory = Mock()
|
||||
+ temporary_directory.name = 'temp-boot-directory'
|
||||
+ mock_TemporaryDirectory.return_value = temporary_directory
|
||||
mock_prepared.return_value = True
|
||||
self.boot_image.boot_root_directory = 'boot-root-directory'
|
||||
mbrid = mock.Mock()
|
||||
--
|
||||
2.27.0
|
||||
|
||||
Binary file not shown.
BIN
kiwi-9.21.7.tar.gz
Normal file
BIN
kiwi-9.21.7.tar.gz
Normal file
Binary file not shown.
23
kiwi.spec
23
kiwi.spec
@ -1,7 +1,7 @@
|
||||
%{?python_enable_dependency_generator}
|
||||
|
||||
Name: kiwi
|
||||
Version: 9.19.15
|
||||
Version: 9.21.7
|
||||
Release: 2
|
||||
License: GPLv3+
|
||||
Summary: Flexible operating system image builder
|
||||
@ -9,6 +9,8 @@ Summary: Flexible operating system image builder
|
||||
URL: http://osinside.github.io/kiwi/
|
||||
Source0: https://files.pythonhosted.org/packages/source/k/%{name}/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch0: backport-Fixed-cleanup-of-temporary-directory.patch
|
||||
|
||||
BuildRequires: bash-completion dracut fdupes gcc make
|
||||
BuildRequires: python3-devel python3-setuptools shadow-utils
|
||||
|
||||
@ -128,14 +130,13 @@ sed -e "s|#!/usr/bin/env python||" -i kiwi/xml_parse.py
|
||||
%set_build_flags
|
||||
|
||||
%py3_build
|
||||
make CFLAGS="%{build_cflags}" tools
|
||||
|
||||
%install
|
||||
%py3_install
|
||||
make buildroot=%{buildroot}/ install
|
||||
make buildroot=%{buildroot}/ install_dracut
|
||||
|
||||
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions
|
||||
mv %{buildroot}%{_sysconfdir}/bash_completion.d/kiwi-ng.sh %{buildroot}%{_datadir}/bash-completion/completions/kiwi-ng
|
||||
|
||||
rm -rf %{buildroot}%{_sysconfdir}/bash_completion.d
|
||||
|
||||
rm -rf %{buildroot}%{_docdir}/packages
|
||||
@ -170,7 +171,7 @@ done
|
||||
%files cli
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/%{name}*
|
||||
%{_datadir}/bash-completion/completions/%{name}-ng
|
||||
%{_datadir}/bash-completion/completions/%{name}-ng.sh
|
||||
%config(noreplace) %{_sysconfdir}/kiwi.yml
|
||||
|
||||
%ifarch %{ix86} x86_64
|
||||
@ -190,6 +191,18 @@ done
|
||||
%{_mandir}/man8/%{name}*
|
||||
|
||||
%changelog
|
||||
* Wed Aug 4 2021 liudabo <liudabo1@huawei.com> - 9.21.7-2
|
||||
- Fixed cleanup of temporary directory
|
||||
|
||||
* Wed Aug 19 2020 dingyue <dingyue5@huawei.com> - 9.21.7-1
|
||||
- Bump version to 9.21.7
|
||||
|
||||
* Sat Jun 20 2020 jixinjie <jixinjie@huawei.com> - 9.20.12-1
|
||||
- upgrade kiwi
|
||||
|
||||
* Mon May 25 2020 openEuler Buildteam <buildteam@openeuler.org> - 9.19.15-3
|
||||
- Rebuild for kiwi
|
||||
|
||||
* Sat Mar 21 2020 openEuler Buildteam <buildteam@openeuler.org> - 9.19.15-2
|
||||
- Delete redundant info in spec
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user