blob: 48606b9de4e5d6589b64c61eab45418a67061bdb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#!/bin/bash
# Copyright 2012 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# This script rebuilds the time zone files using files
# downloaded from the ICANN/IANA distribution.
#
# To prepare an update for a new Go release,
# consult https://www.iana.org/time-zones for the latest versions,
# update CODE and DATA below, and then run
#
# ./update.bash -commit
#
# That will prepare the files and create the commit.
#
# To review such a commit (as the reviewer), use:
#
# git codereview change NNNNNN # CL number
# cd lib/time
# ./update.bash
#
# If it prints "No updates needed.", then the generated files
# in the CL match the update.bash in the CL.
# Versions to use.
CODE=2022g
DATA=2022g
set -e
cd $(dirname $0)
rm -rf work
mkdir work
go build -o work/mkzip mkzip.go # build now for correct paths in build errors
cd work
mkdir zoneinfo
curl -sS -L -O https://www.iana.org/time-zones/repository/releases/tzcode$CODE.tar.gz
curl -sS -L -O https://www.iana.org/time-zones/repository/releases/tzdata$DATA.tar.gz
tar xzf tzcode$CODE.tar.gz
tar xzf tzdata$DATA.tar.gz
if ! make CFLAGS=-DSTD_INSPIRED AWK=awk TZDIR=zoneinfo posix_only >make.out 2>&1; then
cat make.out
exit 2
fi
cd zoneinfo
../mkzip ../../zoneinfo.zip
cd ../..
go generate time/tzdata
files="update.bash zoneinfo.zip ../../src/time/tzdata/zipdata.go"
modified=true
if git diff --quiet $files; then
modified=false
fi
if [ "$1" = "-work" ]; then
echo Left workspace behind in work/.
shift
else
rm -rf work
fi
if ! $modified; then
echo No updates needed.
exit 0
fi
echo Updated for $CODE/$DATA: $files
commitmsg="lib/time: update to $CODE/$DATA
Commit generated by update.bash.
For #22487.
"
if [ "$1" = "-commit" ]; then
echo "Creating commit. Run 'git reset HEAD^' to undo commit."
echo
git commit -m "$commitmsg" $files
echo
git log -n1 --stat
echo
fi
|