[PATCH v2] sb: Fix the RTEMS options after strict option checking was added.

Chris Johns chrisj at rtems.org
Tue Jan 22 06:18:21 UTC 2019


---
 rtems/config/rtems-version.bset |  4 +++-
 source-builder/sb/options.py    | 16 ++++++++++------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/rtems/config/rtems-version.bset b/rtems/config/rtems-version.bset
index b2db1ba..977f268 100644
--- a/rtems/config/rtems-version.bset
+++ b/rtems/config/rtems-version.bset
@@ -2,4 +2,6 @@
 # Current version is RTEMS 5
 #
 
-%define rtems_version 5
+%if %{!defined rtems_version}
+ %error RTEMS version is not defined
+%endif
diff --git a/source-builder/sb/options.py b/source-builder/sb/options.py
index c5fcabe..f6963ac 100644
--- a/source-builder/sb/options.py
+++ b/source-builder/sb/options.py
@@ -53,7 +53,7 @@ class command_line:
 
     def __init__(self, argv, optargs, _defaults, command_path):
         self._long_opts = {
-            # key                 macro                handler            param  defs   init
+            # key                       macro                handler            param  defs   init
             '--prefix'               : ('_prefix',           self._lo_path,     True,  None,  False),
             '--topdir'               : ('_topdir',           self._lo_path,     True,  None,  False),
             '--configdir'            : ('_configdir',        self._lo_path,     True,  None,  False),
@@ -83,6 +83,9 @@ class command_line:
             '--host'                 : ('_host',             self._lo_triplets, True,  None,  False),
             '--build'                : ('_build',            self._lo_triplets, True,  None,  False),
             '--target'               : ('_target',           self._lo_triplets, True,  None,  False),
+            '--rtems-tools'          : ('_rtems_tools',      self._lo_string,   True,  None,  False),
+            '--rtems-bsp'            : ('_rtems_bsp',        self._lo_string,   True,  None,  False),
+            '--rtems-version'        : ('_rtems_version',    self._lo_string,   True,  None,  False),
             '--help'                 : (None,                self._lo_help,     False, None,  False)
             }
 
@@ -575,6 +578,12 @@ class command_line:
             if self.get_arg('--with-tools') is not None:
                 raise error.general('--rtems-tools and --with-tools cannot be used together')
             self.args.append('--with-tools=%s' % (rtems_tools[1]))
+        rtems_version = self.parse_args('--rtems-version')
+        if rtems_version is None:
+            rtems_version = version.version()
+        else:
+            rtems_version = rtems_version[1]
+        self.defaults['rtems_version'] = rtems_version
         rtems_arch_bsp = self.parse_args('--rtems-bsp')
         if rtems_arch_bsp is not None:
             if self.get_arg('--target') is not None:
@@ -582,11 +591,6 @@ class command_line:
             ab = rtems_arch_bsp[1].split('/')
             if len(ab) != 2:
                 raise error.general('invalid --rtems-bsp option')
-            rtems_version = self.parse_args('--rtems-version')
-            if rtems_version is None:
-                rtems_version = version.version()
-            else:
-                rtems_version = rtems_version[1]
             self.args.append('--target=%s-rtems%s' % (ab[0], rtems_version))
             self.args.append('--with-rtems-bsp=%s' % (ab[1]))
 
-- 
2.19.1



More information about the devel mailing list