2 # Copyright 2012 The Go Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file.
6 # This script rebuilds the time zone files using files
7 # downloaded from the ICANN/IANA distribution.
9 # To prepare an update for a new Go release,
10 # consult https://www.iana.org/time-zones for the latest versions,
11 # update CODE and DATA below, and then run
13 # ./update.bash -commit
15 # That will prepare the files and create the commit.
17 # To review such a commit (as the reviewer), use:
19 # git codereview change NNNNNN # CL number
23 # If it prints "No updates needed.", then the generated files
24 # in the CL match the update.bash in the CL.
35 go build -o work/mkzip mkzip.go # build now for correct paths in build errors
38 curl -sS -L -O https://www.iana.org/time-zones/repository/releases/tzcode$CODE.tar.gz
39 curl -sS -L -O https://www.iana.org/time-zones/repository/releases/tzdata$DATA.tar.gz
40 tar xzf tzcode$CODE.tar.gz
41 tar xzf tzdata$DATA.tar.gz
43 if ! make CFLAGS=-DSTD_INSPIRED AWK=awk TZDIR=zoneinfo posix_only >make.out 2>&1; then
49 ../mkzip ../../zoneinfo.zip
52 files="update.bash zoneinfo.zip"
54 if git diff --quiet $files; then
58 if [ "$1" = "-work" ]; then
59 echo Left workspace behind in work/.
66 echo No updates needed.
70 echo Updated for $CODE/$DATA: $files
72 commitmsg="lib/time: update to $CODE/$DATA
74 Commit generated by update.bash.
79 if [ "$1" = "-commit" ]; then
80 echo "Creating commit. Run 'git reset HEAD^' to undo commit."
82 git commit -m "$commitmsg" $files