From 8922c8bbb0e14a14f480b136d76f18818d870da9 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Mon, 8 Jul 2019 22:44:02 +1000 Subject: sb/config: Fix GDB probes when using python-config. - Fix the config file handling of shell calls where the shell command has nesting braces. - Fix the bool check to support a '!' next to the check value. --- source-builder/config/gdb-common-1.cfg | 5 ++-- source-builder/sb/config.py | 47 ++++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/source-builder/config/gdb-common-1.cfg b/source-builder/config/gdb-common-1.cfg index 9018448..159b8a5 100644 --- a/source-builder/config/gdb-common-1.cfg +++ b/source-builder/config/gdb-common-1.cfg @@ -108,8 +108,9 @@ %define gdb-host-libs -L '%{host_ldflags}' %endif %if %{gdb-python-config} != %{nil} - %define gdb-python-config-libs -l '%(%{gdb-python-config} --ldflags)' - %define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} %{gdb-python-config-libs}) + %define gdb-python-lib-filter awk 'BEGIN{FS=" "}/python/{for(i=1;i 3: + e = execute.capture_execution() if options.host_windows: - cmd = '%s -c "%s"' % (self.macros.expand('%{__sh}'), s[2:-1]) + cmd = '%s -c "%s"' % (self.macros.expand('%{__sh}'), shell_macro[2:-1]) else: - cmd = s[2:-1] + cmd = shell_macro[2:-1] exit_code, proc, output = e.shell(cmd) log.trace('shell-output: %d %s' % (exit_code, output)) - if exit_code == 0: - line = line.replace(s, output) - else: - raise error.general('shell macro failed: %s:%d: %s' % (s, exit_code, output)) + if exit_code != 0: + raise error.general('shell macro failed: %s: %d: %s' % (cmd, + exit_code, + output)) + return output + + updating = True + while updating: + updating = False + pos = line.find('%(') + if pos >= 0: + braces = 0 + for p in range(pos + 2, len(line)): + if line[p] == '(': + braces += 1 + elif line[p] == ')': + if braces > 0: + braces -= 1 + else: + line = line[:pos] + _exec(line[pos:p + 1]) + line[p + 1:] + updating = True + break return line def _pkgconfig_check(self, test): -- cgit v1.2.3