[PATCH] wscript: Add post-build processing support

Kinsey Moore kinsey.moore at oarcorp.com
Thu Mar 4 16:32:32 UTC 2021


Currently, I’m using it to perform automated u-boot packaging of all the test executables in my development branch and CI versus having to manually generate these images or managing external scripts to do the automated packaging. I'm on the fence as to whether I submit that portion for merging since it adds extra dependencies on the u-boot tools and doesn't/can't build images for non-test applications. I thought this might be useful to have in the public repo but if not that's fine, too.

Kinsey

-----Original Message-----
From: Gedare Bloom <gedare at rtems.org> 
Sent: Thursday, March 4, 2021 10:25
To: Kinsey Moore <kinsey.moore at oarcorp.com>
Cc: devel at rtems.org
Subject: Re: [PATCH] wscript: Add post-build processing support

Can you explain this a bit more? What is the need this solves, and how
will it be used?

On Thu, Mar 4, 2021 at 9:18 AM Kinsey Moore <kinsey.moore at oarcorp.com> wrote:
>
> This allows packaging of the compiled binaries to occur automatically
> and be bundled with other scripts and build items as convenient.
> ---
>  wscript | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/wscript b/wscript
> index 6626fafb74..e263681716 100755
> --- a/wscript
> +++ b/wscript
> @@ -223,6 +223,12 @@ class Item(object):
>                  p.build(bld, bic)
>              self.do_build(bld, bic)
>
> +    def post_build(self, bld, bic):
> +        if _is_enabled(bld.env.ENABLE, self.get_enabled_by()):
> +            for p in self.links():
> +                p.post_build(bld, bic)
> +            self.do_post_build(bld, bic)
> +
>      def do_defaults(self, variant):
>          return
>
> @@ -238,6 +244,9 @@ class Item(object):
>      def do_build(self, bld, bic):
>          return
>
> +    def do_post_build(self, bld, bic):
> +        return
> +
>      def substitute(self, ctx, value):
>          if isinstance(value, str):
>              try:
> @@ -1074,6 +1083,15 @@ class ScriptItem(Item):
>          if script:
>              exec(script)
>
> +    def do_post_build(self, bld, bic):
> +        script = False
> +        try:
> +            script = self.data["do-post-build"]
> +        except KeyError:
> +            pass
> +        if script:
> +            exec(script)
> +
>
>  class ConfigItemContext(object):
>      def __init__(self, cp, path_list):
> @@ -1485,6 +1503,10 @@ def build(bld):
>      bsps[bld.env.ARCH][bld.env.BSP_BASE].build(bld, bic)
>      items[bld.env.TOPGROUP].build(bld, bic)
>
> +    def post_build(bld):
> +        bsps[bld.env.ARCH][bld.env.BSP_BASE].post_build(bld, bic)
> +    bld.add_post_fun(post_build)
> +
>
>  def add_log_filter(name):
>      msg = "'" + name + "' finished successfully"
> --
> 2.20.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list