[PATCH 01/10] build: Generate build hash
Gedare Bloom
gedare at rtems.org
Wed Feb 24 18:01:18 UTC 2021
On Wed, Feb 24, 2021 at 10:55 AM Gedare Bloom <gedare at rtems.org> wrote:
>
> On Wed, Feb 24, 2021 at 6:57 AM Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
> >
> > Update #4265.
> > ---
> > wscript | 27 ++++++++++++++++++++++++++-
> > 1 file changed, 26 insertions(+), 1 deletion(-)
> >
> > diff --git a/wscript b/wscript
> > index 6626fafb74..83c7c446bb 100755
> > --- a/wscript
> > +++ b/wscript
> > @@ -1359,6 +1359,30 @@ def get_compiler(conf, cp, variant):
> > return value
> >
> >
> > +def _generate_build_hash(conf):
> > + import hashlib
> > + import base64
> > +
> > + build_hash = ""
> > + for key in sorted(conf.env):
> > + build_hash = build_hash + key + str(conf.env[key])
> > + for discard in [
> > + conf.env.PREFIX,
> > + conf.bldnode.make_node(conf.env.VARIANT).abspath(),
> > + conf.path.abspath(),
> > + ]:
> > + build_hash = build_hash.replace(discard, "")
> > + state = hashlib.sha256()
> > + state.update(build_hash.encode("utf-8"))
> > + conf.define(
> > + "RTEMS_BUILD_HASH",
> > + base64.urlsafe_b64encode(state.digest()).decode("utf-8"),
> > + )
> > + conf.write_config_header(
> > + conf.env.VARIANT + "/cpukit/include/rtems/build-hash.h"
>
> Is this injecting a file in the source tree?
>
Nevermind, it generates in the build tree.
> > + )
> > +
> > +
> > def configure_variant(conf, cp, bsp_map, path_list, top_group, variant):
> > conf.msg("Configure board support package (BSP)", variant, color="YELLOW")
> >
> > @@ -1391,9 +1415,10 @@ def configure_variant(conf, cp, bsp_map, path_list, top_group, variant):
> > conf.fatal("No such base BSP: '{}'".format(variant))
> > bsp_item.configure(conf, cic)
> >
> > - options = set([o[0].upper() for o in cp.items(variant)])
> > + options = set(o[0].upper() for o in cp.items(variant))
> > for o in options.difference(cic.options):
> > conf.msg("Unknown configuration option", o.upper(), color="RED")
> > + _generate_build_hash(conf)
> >
> >
> > def check_forbidden_options(ctx, opts):
> > --
> > 2.26.2
> >
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list