mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
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.
This commit is contained in:
parent
c799e04a8f
commit
8922c8bbb0
@ -108,8 +108,9 @@
|
|||||||
%define gdb-host-libs -L '%{host_ldflags}'
|
%define gdb-host-libs -L '%{host_ldflags}'
|
||||||
%endif
|
%endif
|
||||||
%if %{gdb-python-config} != %{nil}
|
%if %{gdb-python-config} != %{nil}
|
||||||
%define gdb-python-config-libs -l '%(%{gdb-python-config} --ldflags)'
|
%define gdb-python-lib-filter awk 'BEGIN{FS=" "}/python/{for(i=1;i<NF;++i)if(match($i,".*python.*")) print "lib"substr($i,3)"*";}'
|
||||||
%define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} %{gdb-python-config-libs})
|
%define gdb-python-config-libs %(%{gdb-python-config} --ldflags | %{gdb-python-lib-filter})
|
||||||
|
%define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} -l %{gdb-python-config-libs})
|
||||||
%else
|
%else
|
||||||
%define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} -l %{gdb-python-ver-lib})
|
%define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} -l %{gdb-python-ver-lib})
|
||||||
%endif
|
%endif
|
||||||
|
@ -49,13 +49,17 @@ except:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def _check_bool(value):
|
def _check_bool(value):
|
||||||
|
istrue = None
|
||||||
if value.isdigit():
|
if value.isdigit():
|
||||||
if int(value) == 0:
|
if int(value) == 0:
|
||||||
istrue = False
|
istrue = False
|
||||||
else:
|
else:
|
||||||
istrue = True
|
istrue = True
|
||||||
else:
|
else:
|
||||||
istrue = None
|
if type(value) is str and len(value) == 2 and value[0] == '!':
|
||||||
|
istrue = _check_bool(value[1])
|
||||||
|
if type(istrue) is bool:
|
||||||
|
istrue = not istrue
|
||||||
return istrue
|
return istrue
|
||||||
|
|
||||||
def _check_nil(value):
|
def _check_nil(value):
|
||||||
@ -416,20 +420,41 @@ class file:
|
|||||||
return macros
|
return macros
|
||||||
|
|
||||||
def _shell(self, line):
|
def _shell(self, line):
|
||||||
sl = self.sf.findall(line)
|
#
|
||||||
if len(sl):
|
# Parse the line and handle nesting '()' pairs.
|
||||||
|
#
|
||||||
|
def _exec(shell_macro):
|
||||||
|
output = ''
|
||||||
|
if len(shell_macro) > 3:
|
||||||
e = execute.capture_execution()
|
e = execute.capture_execution()
|
||||||
for s in sl:
|
|
||||||
if options.host_windows:
|
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:
|
else:
|
||||||
cmd = s[2:-1]
|
cmd = shell_macro[2:-1]
|
||||||
exit_code, proc, output = e.shell(cmd)
|
exit_code, proc, output = e.shell(cmd)
|
||||||
log.trace('shell-output: %d %s' % (exit_code, output))
|
log.trace('shell-output: %d %s' % (exit_code, output))
|
||||||
if exit_code == 0:
|
if exit_code != 0:
|
||||||
line = line.replace(s, output)
|
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:
|
else:
|
||||||
raise error.general('shell macro failed: %s:%d: %s' % (s, exit_code, output))
|
line = line[:pos] + _exec(line[pos:p + 1]) + line[p + 1:]
|
||||||
|
updating = True
|
||||||
|
break
|
||||||
return line
|
return line
|
||||||
|
|
||||||
def _pkgconfig_check(self, test):
|
def _pkgconfig_check(self, test):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user