mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2025-07-19 15:29:08 +02:00

0002-run_program-support-timeout.patch 0003-support-infinit-timeout.patch 0005-fix-incorrect-timeout-while-system-time-changed.patch 0006-tweak-btrfs-packages.patch 0007-invoking-mount-with-infinite-timeout.patch 0008-use-oe-variable-to-replace-hardcoded-dir.patch 0010-invoking-mkfs-with-infinite-timeout.patch 0011-invoking-dd-with-infinite-timeout.patch refreshed for 3.9.1 Signed-off-by: Wang Mingyu <wangmy@fujitsu.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
64 lines
2.6 KiB
Diff
64 lines
2.6 KiB
Diff
From 112b825541f498762f373cfc9918e444dda74095 Mon Sep 17 00:00:00 2001
|
|
From: Hongxu Jia <hongxu.jia@windriver.com>
|
|
Date: Mon, 8 May 2017 16:18:02 +0800
|
|
Subject: [PATCH 03/11] support infinit timeout
|
|
|
|
Upstream-Status: Pending
|
|
|
|
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
|
---
|
|
blivet/util.py | 12 ++++++++----
|
|
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/blivet/util.py b/blivet/util.py
|
|
index a5da7b6..58117ae 100644
|
|
--- a/blivet/util.py
|
|
+++ b/blivet/util.py
|
|
@@ -171,6 +171,7 @@ class Path(str):
|
|
def __hash__(self):
|
|
return self._path.__hash__()
|
|
|
|
+# timeout = -1 means infinite timeout, always wait.
|
|
def timeout_command(argv, timeout, *args, **kwargs):
|
|
"""call shell-command and either return its output or kill it
|
|
if it doesn't normally exit within timeout seconds and return None"""
|
|
@@ -182,7 +183,7 @@ def timeout_command(argv, timeout, *args, **kwargs):
|
|
while proc.poll() is None:
|
|
time.sleep(0.1)
|
|
now = datetime.datetime.now()
|
|
- if (now - start).seconds> timeout:
|
|
+ if timeout != -1 and (now - start).seconds> timeout:
|
|
os.kill(proc.pid, signal.SIGKILL)
|
|
os.waitpid(-1, os.WNOHANG)
|
|
program_log.debug("%d seconds timeout" % timeout)
|
|
@@ -196,7 +197,7 @@ def timeout_command(argv, timeout, *args, **kwargs):
|
|
program_log.debug("Return code: %d", proc.returncode)
|
|
return (proc.returncode, proc.stdout.read())
|
|
|
|
-def _run_program(argv, root='/', stdin=None, env_prune=None, stderr_to_stdout=False, binary_output=False):
|
|
+def _run_program(argv, root='/', stdin=None, env_prune=None, stderr_to_stdout=False, binary_output=False, timeout=10):
|
|
if env_prune is None:
|
|
env_prune = []
|
|
|
|
@@ -205,7 +206,10 @@ def _run_program(argv, root='/', stdin=None, env_prune=None, stderr_to_stdout=Fa
|
|
os.chroot(root)
|
|
|
|
with program_log_lock: # pylint: disable=not-context-manager
|
|
- program_log.info("Running... %s", " ".join(argv))
|
|
+ if timeout != -1:
|
|
+ program_log.info("Running... %s", " ".join(argv))
|
|
+ else:
|
|
+ program_log.info("Running... %s ...infinite timeout", " ".join(argv))
|
|
|
|
env = os.environ.copy()
|
|
env.update({"LC_ALL": "C",
|
|
@@ -218,7 +222,7 @@ def _run_program(argv, root='/', stdin=None, env_prune=None, stderr_to_stdout=Fa
|
|
else:
|
|
stderr_dir = subprocess.PIPE
|
|
|
|
- res, out = timeout_command(argv, 10,
|
|
+ res, out = timeout_command(argv, timeout,
|
|
stdin=stdin,
|
|
stdout=subprocess.PIPE,
|
|
stderr=stderr_dir,
|