xref: /aosp_15_r20/external/cronet/third_party/icu/scripts/update_tz.sh (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1#!/bin/bash
2# Copyright (c) 2015 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6# Download the 4 files below from the ICU trunk and put them in
7# source/data/misc to update the IANA timezone database.
8#
9#   metaZones.txt timezoneTypes.txt windowsZones.txt zoneinfo64.txt
10#
11# For IANA Time zone database, see https://www.iana.org/time-zones
12
13# See
14# https://stackoverflow.com/questions/160608/do-a-git-export-like-svn-export/19689284#19689284
15# about 'svn export' and github.
16
17branch="trunk"
18
19# ICU tz file is sometimes updated in the maintenance branch long before
20# being updated in trunk.
21if [ $# -ge 1 ];
22then
23  branch="branches/maint/maint-$1"
24  echo "Downloading tz files from ${branch}"
25fi
26
27datapath="source/data/misc"
28sourcedirurl="https://github.com/unicode-org/icu/${branch}/icu4c/${datapath}"
29cd "$(dirname "$0")/../${datapath}"
30
31for f in metaZones.txt timezoneTypes.txt windowsZones.txt zoneinfo64.txt
32do
33  echo "${sourcedirurl}/${f}"
34  svn --force export "${sourcedirurl}/${f}"
35done
36