[coreboot-gerrit] New patch to review for coreboot: 33e97a4 genbuild_h.sh: use the last git commit as timesource if available

Alexander Couzens (lynxis@fe80.eu) gerrit at coreboot.org
Sat Mar 7 02:04:42 CET 2015


Alexander Couzens (lynxis at fe80.eu) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8619

-gerrit

commit 33e97a45a18b953094e61c2bde6ed181a0552997
Author: Alexander Couzens <lynxis at fe80.eu>
Date:   Sat Mar 7 01:50:22 2015 +0100

    genbuild_h.sh: use the last git commit as timesource if available
    
    Change-Id: I1472265adac9406a86da22839199ec6bbdaa0c69
    Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 util/genbuild_h/genbuild_h.sh | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/util/genbuild_h/genbuild_h.sh b/util/genbuild_h/genbuild_h.sh
index ffc696e..b161dff 100755
--- a/util/genbuild_h/genbuild_h.sh
+++ b/util/genbuild_h/genbuild_h.sh
@@ -18,7 +18,18 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 #
 
-DATE=$(date +%s)
+DATE=""
+GITREV=""
+TIMESOURCE=""
+if [ -d "${top}/.git" ] && [ -f "$(command -v git)" ]; then
+	GITREV=$(LANG= git log remotes/origin/master -1 --format=format:%h)
+	TIMESOURCE=git
+	DATE=$(git log --pretty=format:%ct -1)
+else
+	GITREV=Unknown
+	TIMESOURCE="LANG= TZ=UTC date"
+	DATE=$(date +%s)
+fi
 
 #Print out the information that goes into build.h
 printf "/* build system definitions (autogenerated) */\n"
@@ -27,15 +38,9 @@ printf "#define __BUILD_H\n\n"
 printf "#define COREBOOT_VERSION %s\n" "\"$KERNELVERSION\""
 
 #See if the build is running in a git repo and the git command is available
-if [ -d "${top}/.git" ] && [ -f "$(command -v git)" ]; then
-	printf "/* %s UTC */\n" "$(LANG= TZ=UTC git log --date=local --pretty=format:%cd -1)"
-	printf "#define COREBOOT_VERSION_TIMESTAMP %s\n" "$(git log --pretty=format:%ct -1)"
-	printf "#define COREBOOT_ORIGIN_GIT_REVISION \"%s\"\n" "$(LANG= git log remotes/origin/master -1 --format=format:%h)"
-else
-	printf "/* `LANG= TZ=UTC date` */\n"
-	printf "#define COREBOOT_VERSION_TIMESTAMP %s\n" "$(LANG= date -d @$DATE +%s)"
-	printf "#define COREBOOT_ORIGIN_GIT_REVISION \"Unknown\"\n"
-fi
+printf "/* timesource: $TIMESOURCE */\n"
+printf "#define COREBOOT_VERSION_TIMESTAMP $DATE\n"
+printf "#define COREBOOT_ORIGIN_GIT_REVISION \"$GITREV\"\n"
 
 printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "$COREBOOT_EXTRA_VERSION"
 printf "#define COREBOOT_BUILD \"%s\"\n" "$(LANG= TZ=UTC date -d @$DATE)"



More information about the coreboot-gerrit mailing list