mirror of
https://git.yoctoproject.org/poky
synced 2026-04-30 21:32:13 +02:00
lib/oe/patch.py: Don't return command stderr from runcmd function
If a function returns any stderr it will be passed to extractPatches and
used as path to patch.
For example subprocess command output can be:
| sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
| /tmp/oepatchhuqle8fj/0001-foo.patch
| /tmp/oepatchhuqle8fj/0002-bar.patch
that will result in:
| FileNotFoundError: [Errno 2] No such file or directory: 'sh:'
To fix this I separated output, made the function return stdout and
print stderr only in case of command error.
(From OE-Core rev: 482589e2cc7c3ddeefb0a0fb98d97a9cbb18c9ec)
(From OE-Core rev: 1dadeb58e88c4d953be612654fe4a76b51ff0553)
Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 5e2450731c)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
aaf7efefba
commit
70143264ec
@@ -38,15 +38,19 @@ def runcmd(args, dir = None):
|
||||
args = [ pipes.quote(str(arg)) for arg in args ]
|
||||
cmd = " ".join(args)
|
||||
# print("cmd: %s" % cmd)
|
||||
(exitstatus, output) = subprocess.getstatusoutput(cmd)
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
stdout, stderr = proc.communicate()
|
||||
stdout = stdout.decode('utf-8')
|
||||
stderr = stderr.decode('utf-8')
|
||||
exitstatus = proc.returncode
|
||||
if exitstatus != 0:
|
||||
raise CmdError(cmd, exitstatus >> 8, output)
|
||||
if " fuzz " in output and "Hunk " in output:
|
||||
raise CmdError(cmd, exitstatus >> 8, "stdout: %s\nstderr: %s" % (stdout, stderr))
|
||||
if " fuzz " in stdout and "Hunk " in stdout:
|
||||
# Drop patch fuzz info with header and footer to log file so
|
||||
# insane.bbclass can handle to throw error/warning
|
||||
bb.note("--- Patch fuzz start ---\n%s\n--- Patch fuzz end ---" % format(output))
|
||||
bb.note("--- Patch fuzz start ---\n%s\n--- Patch fuzz end ---" % format(stdout))
|
||||
|
||||
return output
|
||||
return stdout
|
||||
|
||||
finally:
|
||||
if dir:
|
||||
|
||||
Reference in New Issue
Block a user