diff options
author | Rob Barnes <robbarnes@google.com> | 2021-08-20 14:36:21 +0000 |
---|---|---|
committer | Rob Barnes <robbarnes@google.com> | 2021-08-20 15:25:53 +0000 |
commit | 93adb802c1a626fbb73d762124e90be4fee08a8b (patch) | |
tree | 8ba2b19cf7a2ec4d24dde1424bfcd46d4865e231 /zephyr/zmake/zmake/version.py | |
parent | 8270698e589f14239b4942a42b27132af497410b (diff) | |
download | chrome-ec-93adb802c1a626fbb73d762124e90be4fee08a8b.tar.gz |
Revert "zephyr: pull in the version string from zmake"
This reverts commit 10809eb023d475681b45863e68d906fae4667eda.
Reason for revert: Causing build errors b/197287679
Original change's description:
> zephyr: pull in the version string from zmake
>
> Zmake computes a version string and stores it in FRID/FWID, but this
> was never plumbed all the way out into the version functionality in
> the OS, which was reporting the version generated by
> util/getversion.sh.
>
> Add a mechanism to generate the version header from zmake and replace
> the getversion.sh generation with that.
>
> BUG=b:184832251
> BRANCH=none
> TEST=provided unit tests
> TEST=get this version string on posix-ec:
> posix-ec_v2.6.73347-cmsis:c3bd20,ec:c814a9,hal_stm32:f8ff8d,os:efe095
> 2021-08-18 14:10:18 jrosenth@germania
>
> Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
> Change-Id: Idec1c5f8b5f014126706e4fdc1f3d158edf40a63
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104625
> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Bug: b:184832251
Change-Id: Ifcc4830e3097c8dc8126bb76adfeb3ce75a7a667
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110293
Auto-Submit: Rob Barnes <robbarnes@google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Diffstat (limited to 'zephyr/zmake/zmake/version.py')
-rw-r--r-- | zephyr/zmake/zmake/version.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/zephyr/zmake/zmake/version.py b/zephyr/zmake/zmake/version.py index 2d505769f2..404c05cb74 100644 --- a/zephyr/zmake/zmake/version.py +++ b/zephyr/zmake/zmake/version.py @@ -2,11 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import datetime -import getpass -import io import os -import platform import subprocess import zmake.util as util @@ -118,42 +114,3 @@ def get_version_string(project, zephyr_base, modules, static=False): return "{}_v{}.{}.{}-{}".format( project_id, major_version, minor_version, num_commits, vcs_hashes ) - - -def write_version_header(version_str, output_path, static=False): - """Generate a version header and write it to the specified path. - - Generate a version header in the format expected by the EC build - system, and write it out only if the version header does not exist - or changes. We don't write in the case that the version header - does exist and was unchanged, which allows "zmake build" commands - on an unchanged tree to be an effective no-op. - - Args: - version_str: The version string to be used in the header, such - as one generated by get_version_string. - output_path: The file path to write at (a pathlib.Path - object). - static: If true, generate a header which does not include - information like the username, hostname, or date, allowing - the build to be reproducible. - """ - output = io.StringIO() - output.write("/* This file is automatically generated by zmake */\n") - - def add_def(name, value): - output.write("#define {} {}\n".format(name, util.c_str(value))) - - add_def("VERSION", version_str) - add_def("CROS_EC_VERSION32", version_str[:31]) - - if static: - add_def("BUILDER", "reproducible@build") - add_def("DATE", "STATIC_VERSION_DATE") - else: - add_def("BUILDER", "{}@{}".format(getpass.getuser(), platform.node())) - add_def("DATE", datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) - - contents = output.getvalue() - if not output_path.exists() or output_path.read_text() != contents: - output_path.write_text(contents) |