diff options
author | ToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp> | 2020-03-30 09:24:26 +0900 |
---|---|---|
committer | ToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp> | 2020-03-30 09:24:26 +0900 |
commit | 5b80bfd7bffd4c20d80b7c70a7130529e9a755dd (patch) | |
tree | b4bb18dcd1487dbf1ea8127e5671b7bb2eded033 /external/meta-openembedded/meta-python/recipes-extended/python-blivet/python3-blivet/0003-support-infinit-timeout.patch | |
parent | 706ad73eb02caf8532deaf5d38995bd258725cb8 (diff) |
agl-basesystem
Diffstat (limited to 'external/meta-openembedded/meta-python/recipes-extended/python-blivet/python3-blivet/0003-support-infinit-timeout.patch')
-rw-r--r-- | external/meta-openembedded/meta-python/recipes-extended/python-blivet/python3-blivet/0003-support-infinit-timeout.patch | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/external/meta-openembedded/meta-python/recipes-extended/python-blivet/python3-blivet/0003-support-infinit-timeout.patch b/external/meta-openembedded/meta-python/recipes-extended/python-blivet/python3-blivet/0003-support-infinit-timeout.patch new file mode 100644 index 00000000..38f061ed --- /dev/null +++ b/external/meta-openembedded/meta-python/recipes-extended/python-blivet/python3-blivet/0003-support-infinit-timeout.patch @@ -0,0 +1,66 @@ +From 325898f3f2951bbde07da47888175c427b11ddc3 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 05a253c..d6804be 100644 +--- a/blivet/util.py ++++ b/blivet/util.py +@@ -157,6 +157,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""" +@@ -168,7 +169,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) +@@ -182,7 +183,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 = [] + +@@ -191,7 +192,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", +@@ -204,7 +208,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, +-- +2.7.4 + |