summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-02-15 10:26:16 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-19 12:46:06 -0800
commit385f222d217188de7dd002c7a749886cf7ee7929 (patch)
tree8c8d1b851feb52a1f87a430f44b70423417deae8
parentab40ba67c55799594ef8482b16a30373bf9da53c (diff)
downloadchrome-ec-385f222d217188de7dd002c7a749886cf7ee7929.tar.gz
gsctool: fix version string generation and processing
Function reporting the version of the gsctool expects the VERSION variable generated by ./util/getversion.sh utility to start with a single underscore without a prefix. But the utility could be adding various prefixes to the VERSION string depending on the environment variable settings. Those settings are irrelevant for gsctool, it should ignore the prefix up to the first underscore character found in the VERSION string. Also, modify the Makefile to make sure the build date reported by getversion.sh is accurate. BRANCH=none BUG=chromium:932361 TEST=built gsctool and checked version reporting: make BOARD=cr50 CR50_DEV=1 gsctool ./gsctool -v Version: v2.0.821+e890d0974 tpm2:v0.0.320-e987095 \ cryptoc:v0.0.10-b256f39, built on 2019-02-15 10:25:08 \ by vbendeb@eskimo.mtv.corp.google.com Change-Id: I5fb6c4aa1dea6e857fffc7ec5e5a599d61175044 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1474736 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--extra/usb_updater/Makefile2
-rw-r--r--extra/usb_updater/gsctool.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/extra/usb_updater/Makefile b/extra/usb_updater/Makefile
index fd616ec81f..7e9f11725b 100644
--- a/extra/usb_updater/Makefile
+++ b/extra/usb_updater/Makefile
@@ -63,7 +63,7 @@ usb_updater2: usb_updater2.c Makefile
.PHONY: clean
generated_version.h: $(GSCTOOL_SOURCES)
- @../../util/getversion.sh > $@
+ @(cd ../../; util/getversion.sh) > $@
clean:
rm -rf $(PROGRAMS) *~ *.o *.d dp generated_version.h
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index 53273f8be5..e24306cbc2 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -2075,9 +2075,10 @@ static void process_factory_mode(struct transfer_descriptor *td,
static void report_version(void)
{
/* Get version from the generated file, ignore the underscore prefix. */
- const char *v = VERSION + 1;
+ const char *v = strchr(VERSION, '_');
- printf("Version: %s, built on %s by %s\n", v, DATE, BUILDER);
+ printf("Version: %s, built on %s by %s\n", v ? v + 1 : "?",
+ DATE, BUILDER);
exit(0);
}