From decd6a545fc5e7a0ec9ad4f920e9999aa6fc2079 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Tue, 12 May 2015 17:55:58 -0700 Subject: [PATCH] add hash for locally emerged builds When the EC is built using "emerge- chromeos-ec" on a developer workstation with the chromeos-ec package "cros-worked'on", put "1.1.9999-" rather than "no_version" in the version string. Emerge is exporting the current git SHA-1 hash in the VCSID id but the .git repository is not available during the build. Signed-off-by: Vincent Palatin BRANCH=none BUG=none TEST=try the following build setups: - local emerge $ emerge-smaug chromeos-ec $ strings /build/smaug/firmware/ec.bin | grep ryu ryu_p4p5_1.1.9999-ebe18ef - local build $ make BOARD=ryu_p4p5 $ strings build/ryu_p4p5/ec.bin | grep ryu ryu_p4p5_v1.1.3127-ebe18ef-dirt - trybot build $ cbuildbot --remote -g 270554 smaug-firmware $ tar xvjf firmware_from_sources.tar.bz2 $ strings ec.bin | grep ryu ryu_p4p5_v1.1.3137-9b52578 Change-Id: I386f80d82d95b5e99a1660a1eb242c47c54d17ef Reviewed-on: https://chromium-review.googlesource.com/270554 Trybot-Ready: Vincent Palatin Tested-by: Vincent Palatin Reviewed-by: Randall Spangler Commit-Queue: Vincent Palatin --- util/getversion.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/getversion.sh b/util/getversion.sh index 798bb51448..da31eb9428 100755 --- a/util/getversion.sh +++ b/util/getversion.sh @@ -26,7 +26,13 @@ if ghash=`git rev-parse --short --verify HEAD 2>/dev/null`; then dirty=`sh -c "[ '$(git diff-index --name-only HEAD)' ] && echo '-dirty'"` vbase="${ver_major}.${ver_branch}.${numcommits}-${ghash}${dirty}" else - vbase="no_version" + # Fall back to the VCSID provided by the packaging system if available. + if ghash=${VCSID##*-}; then + vbase="1.1.9999-${ghash:0:7}" + else + # then ultimately fails to "no_version" + vbase="no_version" + fi fi ver="${BOARD}_${vbase}"