[PATCH 2/3] build: Support command line specified options
Update #4548. --- wscript | 38 -- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/wscript b/wscript index 8903f1f97a..7a459a15ea 100755 --- a/wscript +++ b/wscript @@ -958,6 +958,15 @@ class OptionItem(Item): value = self.default_value(conf.env.ARCH_BSP, conf.env.ARCH_FAMILY) return value +def _get_string_command_line(self, conf, cic, value, arg): +name = self.data["name"] +try: +value = conf.rtems_options[name] +del conf.rtems_options[name] +except KeyError: +value = arg[0] +return value + def _script(self, conf, cic, value, arg): exec(arg) return value @@ -1040,6 +1049,7 @@ class OptionItem(Item): "get-env": self._get_env, "get-integer": self._get_integer, "get-string": self._get_string, +"get-string-command-line": self._get_string_command_line, "script": self._script, "set-test-state": self._set_test_state, "set-value": self._set_value, @@ -1250,6 +1260,13 @@ def options(ctx): metavar="UID", help="the UID of the top-level group [default: '/grp']; it may be used in the bsp_defaults and configure commands", ) +rg.add_option( +"--rtems-option", +metavar="KEY=VALUE", +action="append", +dest="rtems_options", +help="set the option identified by KEY to the VALUE in the build specification; this option is intended for RTEMS maintainers and may be used in the bsp_defaults and configure commands", +) def check_environment(conf): @@ -1445,8 +1462,21 @@ def get_top_group(ctx): return top_group +def prepare_rtems_options(conf): +conf.rtems_options = {} +for x in conf.options.rtems_options: +try: +k, v = x.split("=", 1) +conf.rtems_options[k] = v +except: +conf.fatal( +"The RTEMS option '{}' is not in KEY=VALUE format".format(x) +) + + def configure(conf): check_forbidden_options(conf, ["compiler"]) +prepare_rtems_options(conf) check_environment(conf) conf.env["SPECS"] = load_items_from_options(conf) top_group = get_top_group(conf) @@ -1460,6 +1490,8 @@ def configure(conf): configure_variant(conf, cp, bsp_map, path_list, top_group, variant) conf.setenv("") conf.env["VARIANTS"] = variant_list +for key in conf.rtems_options: +conf.msg("Unknown command line RTEMS option", key, color="RED") def append_variant_builds(bld): @@ -1490,7 +1522,7 @@ def long_command_line_workaround(bld): def build(bld): if not bld.variant: check_forbidden_options( -bld, ["compiler", "config", "specs", "tools", "top_group"] +bld, ["compiler", "config", "option", "specs", "tools", "top_group"] ) load_items(bld, bld.env.SPECS) append_variant_builds(bld) @@ -1583,7 +1615,9 @@ COMPILER = {}""".format( def bsp_list(ctx): """lists base BSP variants""" -check_forbidden_options(ctx, ["compiler", "config", "tools", "top_group"]) +check_forbidden_options( +ctx, ["compiler", "config", "option", "tools", "top_group"] +) add_log_filter(ctx.cmd) load_items_from_options(ctx) white_list = get_white_list(ctx) -- 2.31.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 0/3] Support command line specified build options
Sebastian Huber (3): Revert "optvermaj.yml: Allow __RTEMS_MAJOR__ to be overridden so RTEMS 7 tools can be tested" build: Support command line specified options build: Optional __RTEMS_MAJOR__ via command line spec/build/cpukit/optvermaj.yml | 8 +++ wscript | 38 +++-- 2 files changed, 39 insertions(+), 7 deletions(-) -- 2.31.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 1/3] Revert "optvermaj.yml: Allow __RTEMS_MAJOR__ to be overridden so RTEMS 7 tools can be tested"
This reverts commit d1bbfbea5f60f552b2b3138bb1df35c3372f2461. --- spec/build/cpukit/optvermaj.yml | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/spec/build/cpukit/optvermaj.yml b/spec/build/cpukit/optvermaj.yml index e1a5eae5b3..2596e6ef6a 100644 --- a/spec/build/cpukit/optvermaj.yml +++ b/spec/build/cpukit/optvermaj.yml @@ -1,16 +1,14 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause actions: -- get-string: null +- set-value: '6' - env-assign: null build-type: option copyrights: - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) -default: 6 +default: null default-by-variant: [] -description: | - Major Component of the RTEMS Version Number +description: '' enabled-by: true -format: '{}' links: [] name: __RTEMS_MAJOR__ type: build -- 2.31.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 3/3] build: Optional __RTEMS_MAJOR__ via command line
Close #4548. --- spec/build/cpukit/optvermaj.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/build/cpukit/optvermaj.yml b/spec/build/cpukit/optvermaj.yml index 2596e6ef6a..9dbded9e64 100644 --- a/spec/build/cpukit/optvermaj.yml +++ b/spec/build/cpukit/optvermaj.yml @@ -1,6 +1,6 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause actions: -- set-value: '6' +- get-string-command-line: '6' - env-assign: null build-type: option copyrights: -- 2.31.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] waf: Add --rtems-version as a configure option
> On 14 Nov 2021, at 11:15 pm, Sebastian Huber > wrote: > > On 14/11/2021 04:07, chr...@rtems.org wrote: >> From: Chris Johns >> - Provide the option `--rtems-version` to set the major version >> number >> - Add a method to handle setting action values >> - Return the spec YAML file back to it's original values >> as it does not allow a user to change the version. >> Closes #4548 > > I would simply revert the optvermaj.yml patch with "git revert". Ok. > I don't like the special case approach which violates one design principle of > the build system that the wcript should know the absolute minimum of the > layout of the build specification. This alternative moves that knowledge out into all sorts of support tools. Is that what you want? I think the same command line interface (--rtems-version) used else where for this option would be good. > My preferred solution would be that the build item defines that it can be > modified by a command line option, for example: > > ./waf configure --rtems-set-value=__RTEMS_MAJOR__=7 Does this option as stated here contradict the idea of the build system being specified? I see strength in the spec files and I am not sure about a generic approach. I think the less that can change the better. And if you need change the spec files to use the value what does it offer? We need to change the version and a specific option exposes as narrow an interface as possible. > In spec/build/cpukit/optvermaj.yml: > > actions: > - get-string-option: '6' > - env-assign > > With this approach you don't give the user the ability to change everything. > However, what can be change is defined by the build specification and not the > wscript. I understand the reason however you would need to implement it to show how it is done? Can we internally do: set_value("__RTEMS_MAJOR__", ctx.options.rtems_version) ? I do not understand the how to make the change and then manage the sequence via the actions. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] waf: Add --rtems-version as a configure option
On 14/11/2021 04:07, chr...@rtems.org wrote: From: Chris Johns - Provide the option `--rtems-version` to set the major version number - Add a method to handle setting action values - Return the spec YAML file back to it's original values as it does not allow a user to change the version. Closes #4548 I would simply revert the optvermaj.yml patch with "git revert". I don't like the special case approach which violates one design principle of the build system that the wcript should know the absolute minimum of the layout of the build specification. My preferred solution would be that the build item defines that it can be modified by a command line option, for example: ./waf configure --rtems-set-value=__RTEMS_MAJOR__=7 In spec/build/cpukit/optvermaj.yml: actions: - get-string-option: '6' - env-assign With this approach you don't give the user the ability to change everything. However, what can be change is defined by the build specification and not the wscript. -- embedded brains GmbH Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.hu...@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht München Registernummer: HRB 157899 Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler Unsere Datenschutzerklärung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/ ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel