sb/setbuilder: Control buildsets using the --with-* command line option

- Expand macros in buildset file names

- Add support to buildsets for `%defineifnot`

- Update 6 and 7 to support command line build overrides

Closes #4646
This commit is contained in:
Chris Johns 2022-05-05 12:32:16 +10:00
parent 22e32ecc27
commit 7d80719f74
4 changed files with 57 additions and 29 deletions

View File

@ -4,16 +4,17 @@
%include 6/rtems-base.bset
#
# Build gdb first to raise the Python install error as early as possible.
# GDB needs expat so it needs to be built before.
# Default RTEMS build. Override on the command line to the
# the RSB. For example to test the latest version of gcc use:
#
# --with-rtems-gcc=tools/rtems-gcc-head-newlib-head
#
%defineifnot with_rtems_dtc devel/dtc-1.6.1-1
%defineifnot with_rtems_expat devel/expat-2.4.8-1
%defineifnot with_rtems_gmp devel/gmp-6.2.1
%defineifnot with_rtems_gdb tools/rtems-gdb-11.2
%defineifnot with_rtems_binutils tools/rtems-binutils-2.38
%defineifnot with_rtems_gcc tools/rtems-gcc-10-newlib-head
%defineifnot with_rtems_tools tools/rtems-tools-6
devel/dtc-1.6.1-1
devel/expat-2.4.8-1
devel/gmp-6.2.1
tools/rtems-gdb-11.2
tools/rtems-binutils-2.38
tools/rtems-gcc-10-newlib-head
tools/rtems-tools-6
tools/rtems-default-tools.bset

View File

@ -1,16 +1,20 @@
#
# Default tools configuration.
#
%include 7/rtems-base.bset
#
# Build gdb first to raise the Python install error as early as possible.
# GDB needs expat so it needs to be built before.
# Default RTEMS build. Override on the command line to the
# the RSB. For example to test the latest version of gcc use:
#
# --with-rtems-gcc=tools/rtems-gcc-head-newlib-head
#
%defineifnot with_rtems_dtc devel/dtc-1.6.1-1
%defineifnot with_rtems_expat devel/expat-2.4.8-1
%defineifnot with_rtems_gmp devel/gmp-6.2.1
%defineifnot with_rtems_gdb tools/rtems-gdb-head
%defineifnot with_rtems_binutils tools/rtems-binutils-head
%defineifnot with_rtems_gcc tools/rtems-gcc-head-newlib-head
%defineifnot with_rtems_tools tools/rtems-tools-6
devel/dtc-1.6.1-1
devel/expat-2.4.8-1
devel/gmp-6.2.1
tools/rtems-gdb-head
tools/rtems-binutils-head
tools/rtems-gcc-head-newlib-head
tools/rtems-tools-6
tools/rtems-default-tools.bset

View File

@ -0,0 +1,15 @@
#
# Default tools build
#
#
# Build gdb first to raise the Python install error as early as
# possible. GDB needs expat so it needs to be built before gdb.
#
%{with_rtems_dtc}
%{with_rtems_expat}
%{with_rtems_gmp}
%{with_rtems_gdb}
%{with_rtems_binutils}
%{with_rtems_gcc}
%{with_rtems_tools}

View File

@ -284,6 +284,7 @@ class buildset:
line = line[1:b]
return line.strip()
bset = macro_expand(self.macros, bset)
bsetname = bset
if not path.exists(bsetname):
@ -315,15 +316,22 @@ class buildset:
if ls[0][-1] == ':' and ls[0][:-1] == 'package':
self.bset_pkg = ls[1].strip()
self.macros['package'] = self.bset_pkg
elif ls[0][0] == '%':
elif ls[0][0] == '%' and (len(ls[0]) > 1 and ls[0][1] != '{'):
def err(msg):
raise error.general('%s:%d: %s' % (self.bset, lc, msg))
if ls[0] == '%define':
if ls[0] == '%define' or ls[0] == '%defineifnot' :
name = ls[1].strip()
value = None
if len(ls) > 2:
self.macros.define(ls[1].strip(),
' '.join([f.strip() for f in ls[2:]]))
else:
self.macros.define(ls[1].strip())
value = ' '.join([f.strip() for f in ls[2:]])
if ls[0] == '%defineifnot':
if self.macros.defined(name):
name = None
if name is not None:
if value is not None:
self.macros.define(name, value)
else:
self.macros.define(name)
elif ls[0] == '%undefine':
if len(ls) > 2:
raise error.general('%s:%d: %undefine requires ' \
@ -336,7 +344,7 @@ class buildset:
elif ls[0] == '%hash':
sources.hash(ls[1:], self.macros, err)
else:
l = l.strip()
l = macro_expand(self.macros, l.strip())
c = build.find_config(l, self.configs)
if c is None:
raise error.general('%s:%d: cannot find file: %s' % (self.bset,