!2 add dump-init.yaml

From: @running-tortoise 
Reviewed-by: @jianli-97 
Signed-off-by: @jianli-97
This commit is contained in:
openeuler-ci-bot 2024-04-16 07:53:37 +00:00 committed by Gitee
commit f450908f13
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 65 additions and 2 deletions

View File

@ -0,0 +1,55 @@
diff -U4 -r dumb-init-1.2.5--orig/testing/__init__.py dumb-init-1.2.5--patched/testing/__init__.py
--- dumb-init-1.2.5--orig/testing/__init__.py 2020-12-10 19:55:42.000000000 +0100
+++ dumb-init-1.2.5--patched/testing/__init__.py 2022-11-12 02:42:07.751248222 +0100
@@ -7,11 +7,8 @@
from contextlib import contextmanager
from subprocess import PIPE
from subprocess import Popen
-from py._path.local import LocalPath
-
-
# these signals cause dumb-init to suspend itself
SUSPEND_SIGNALS = frozenset([
signal.SIGTSTP,
signal.SIGTTOU,
@@ -48,16 +45,17 @@
def child_pids(pid):
"""Return a list of direct child PIDs for the given PID."""
children = set()
- for p in LocalPath('/proc').listdir():
+ for p in os.listdir('/proc'):
try:
- stat = open(p.join('stat').strpath).read()
+ with open(os.path.join('/proc', p, 'stat')) as f:
+ stat = f.read()
m = re.match(r'^\d+ \(.+?\) [a-zA-Z] (\d+) ', stat)
assert m, stat
ppid = int(m.group(1))
if ppid == pid:
- children.add(int(p.basename))
+ children.add(int(p))
except OSError:
# Happens when the process exits after listing it, or between
# opening stat and reading it.
pass
@@ -75,14 +73,15 @@
def is_alive(pid):
"""Return whether a process is running with the given PID."""
- return LocalPath('/proc').join(str(pid)).isdir()
+ return os.path.isdir(os.path.join('/proc', str(pid)))
def process_state(pid):
"""Return a process' state, such as "stopped" or "running"."""
- status = LocalPath('/proc').join(str(pid), 'status').read()
+ with open(os.path.join('/proc', str(pid), 'status')) as f:
+ status = f.read()
m = re.search(r'^State:\s+[A-Z] \(([a-z]+)\)$', status, re.MULTILINE)
return m.group(1)
Only in dumb-init-1.2.5--patched/testing: __init__.py.orig

View File

@ -1,10 +1,11 @@
Name: dumb-init
Version: 1.2.5
Release: 1
Release: 2
Summary: Entry-point for containers that proxies signals
License: MIT
URL: https://github.com/Yelp/dumb-init
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0: 0000-update-for-pytest-7.2.0.patch
BuildRequires: gcc help2man make
BuildRequires: python3 python3-pytest python3-mock
@ -17,7 +18,7 @@ PID 1 inside minimal container environments (such as Podman and Docker).
* It can pass signals properly for simple containers.
%prep
%setup -q
%autosetup -p1
%build
gcc -std=gnu99 %{optflags} -o %{name} dumb-init.c
@ -37,5 +38,8 @@ install -Dpm0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
%doc README.md
%changelog
* Tue Apr 16 2024 lvxiangcong <lvxiangcong@kylinos.cn> - 1.2.5-2
- fix the problem of check build failure
* Mon Jun 20 2022 fushanqing <fushanqing@kylinos.cn> - 1.2.5-1
- Initial package

4
dump-init.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: Yelp/dumb-init.git
tag_prefix: "^v"
seperator: "."