1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright (c) 2014 Joyent, Inc.  All rights reserved.
14# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
15#
16
17How to update the TZ database information.
18
19Welcome! You've probably heard that some aspect of time has changed and
20you're wondering what to do. The first thing to do is to grab the latest
21version of the time database which can currently be found at:
22
23http://www.iana.org/time-zones
24
25You'll need the data tarball. Most data files are used in the gate
26directly; however, a few have slightly different names. The following
27commands assume that you're inside of the directory you extracted the
28time zone files.
29
30$ cp africa antarctica asia australasia backward etcetera europe \
31  northamerica southamerica $CODEMGR_WS/usr/src/data/zoneinfo
32
33Next you need to copy the country tab and the zone tab files. These have
34different names in our source tree.
35
36$ cp iso3166.tab $CODEMGR_WS/usr/src/data/zoneinfo/country.tab
37$ cp zone.tab $CODEMGR_WS/usr/src/data/zoneinfo/zone.tab.txt
38
39Now, you need to manually fix up the zone_sun.tab. zone_sun.tab has
40additional different zone names that the original does not. As things
41are changed and removed, or coordinates updated, the same should be done
42in zone_sun.tab. The simplest way known to deal with it today is
43something like the following:
44
45$ cd $CODEMGR_WS/usr/src/data/zoneinfo
46$ vimdiff zone.tab.txt zone_sun.tab
47
48And as you see things that show up as egregiously different, do a 'git
49diff zone.tab.txt' and see what changed and fix zone_sun.tab
50appropriately. Usually this means deleting removed entries and adding
51new ones.
52
53********** IMPORTANT **********
54*** zone_sun.tab must remain sorted.
55*** The upstream zone.tab.txt is not always completely in alphabetical order.
56
57To check the final zone_sun.tab file, the `zonelint` script in the current
58directory can be used within a bldenv environment. First run `dmake install`
59to stage the zone files to proto, then run `./zonelint`. If it produces no
60output then you're okay.
61
62After that's done, you'll need to go through the more agonizing process of
63packaging. To do this, you'll want to look through the differences in "Link"
64lines in all files under $CODEMGR_WS/usr/src/data/zoneinfo/
65These "Link" lines describe hardlinks that need to exist in packaging.
66Specifically, if you have a line in the form of:
67
68LINK	Arda/Beleriand	Arda/Gondolin
69
70That instructs that Gondolin should be hardlinked to Beleriand. In IPS parlance
71that'd be:
72
73hardlink path=usr/share/lib/zoneinfo/Arda/Gondolin target=Beleriand
74
75The 'update' make target can help with this by automatically re-generating all
76of the hardlinks in the package manifest based on the Link lines found in the
77data files. Run 'make update' and then check the manifest file at
78$CODEMGR_WS/usr/src/pkg/manifests/system-data-zoneinfo.p5m to ensure it has
79done the right thing.
80
81Other differences in files describe the addition and removal of various
82file entries. The update_manifest script will take care of files which have
83changed to links but others may need manual adjustment. If you're not friends
84with protocmp yet, this should help you out.
85
86Once both of those are done, you'll need to update the version of the package
87itself in the manifest. IANA releases these as <year><letter>, eg. 2013i.
88Instead, you need to encode that letter to its spot in the alphabet. So 2013i
89would become 2013.9.
90
91Once packaging is all done, then you should be all set.
92