util: Make TZ environment variable POSIX compatible

`TZ='UTC'` is not a portable setting for the TZ environment variable.
POSIX says you’re supposed to use something like `TZ='UTC0'` instead.
Although `TZ='UTC'` works when GLIBC is used, this is not necessarily
true on other POSIX platforms. [1][2]

[1] http://lists.alioth.debian.org/pipermail/reproducible-builds/Week-of-Mon-20170918/009289.html
[2] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03

Change-Id: I1dca0b84de0ec0af3a103e2cbbf731512eb59497
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-on: https://review.coreboot.org/21721
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Paul Menzel 2017-09-27 15:06:57 +02:00 committed by Nico Huber
parent fe5030eceb
commit 38a906b0e1
4 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,7 @@ while read line; do
commit=`echo $i | cut -d/ -f3` commit=`echo $i | cut -d/ -f3`
datetime_path=`echo $i | cut -d/ -f4` datetime_path=`echo $i | cut -d/ -f4`
datetime=`echo $datetime_path | tr _ :` datetime=`echo $datetime_path | tr _ :`
datetime_human=`LC_ALL=C TZ=UTC date --date="$datetime"` datetime_human=`LC_ALL=C TZ=UTC0 date --date="$datetime"`
upstream=`grep "^Upstream revision:" $vendor_board/$commit/$datetime_path/revision.txt |cut -d: -f2-` upstream=`grep "^Upstream revision:" $vendor_board/$commit/$datetime_path/revision.txt |cut -d: -f2-`
upstream=`git log -1 --format=%H $upstream` upstream=`git log -1 --format=%H $upstream`
if ! echo "$have"| grep "^$vendor_board:" > /dev/null; then if ! echo "$have"| grep "^$vendor_board:" > /dev/null; then

View File

@ -20,7 +20,7 @@ TIMESOURCE=""
export LANG=C export LANG=C
export LC_ALL=C export LC_ALL=C
export TZ=UTC export TZ=UTC0
top=`dirname $0`/../.. top=`dirname $0`/../..
@ -35,7 +35,7 @@ elif [ -e "${top}/.git" -a -x "$(command -v git)" ]; then
else else
GITREV=Unknown GITREV=Unknown
TIMESOURCE="date" TIMESOURCE="date"
DATE=$(LANG= LC_ALL=C TZ=UTC date +%s) DATE=$(LANG= LC_ALL=C TZ=UTC0 date +%s)
fi fi
our_date() { our_date() {

View File

@ -13,7 +13,7 @@ set -e
# set local + tz to be reproducible # set local + tz to be reproducible
LC_ALL=C LC_ALL=C
LANG=C LANG=C
TZ=UTC TZ=UTC0
export LC_ALL LANG TZ export LC_ALL LANG TZ
if [ -z "$VERSION_NAME" ] || [ "$VERSION_NAME" = "--help" ] || [ -z "$COMMIT_ID" ]; then if [ -z "$VERSION_NAME" ] || [ "$VERSION_NAME" = "--help" ] || [ -z "$COMMIT_ID" ]; then

View File

@ -21,7 +21,7 @@
export LANG=C export LANG=C
export LC_ALL=C export LC_ALL=C
export TZ=UTC export TZ=UTC0
min_commits=10 min_commits=10