diff options
author | Elliott Hughes <enh@google.com> | 2014-11-11 14:10:51 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-11-11 16:30:18 -0800 |
commit | 2c2463bd3065f0a5fef34a47e3eb94aad64b0cea (patch) | |
tree | 417fb3c20b40fce19261596b278e7d5d75a6beee /libc | |
parent | 1e1ae4a74e42de07a5654f6a1774786fb4652094 (diff) | |
download | bionic-2c2463bd3065f0a5fef34a47e3eb94aad64b0cea.zip bionic-2c2463bd3065f0a5fef34a47e3eb94aad64b0cea.tar.gz bionic-2c2463bd3065f0a5fef34a47e3eb94aad64b0cea.tar.bz2 |
Fix tzdata update tools for 'backzone'.
To maintain the status quo, we need to pull in backzone file. This file
can't be built on its own, so the easiest fix is to give zic(1) all the
files at once.
We also now have a situation where we have links to links, so we need to
dereference them until we find actual data.
Bug: 18330681
Change-Id: I03f4aa8e6e23802dc35cbff2f74f325eb17d7b2b
Diffstat (limited to 'libc')
-rw-r--r-- | libc/tools/zoneinfo/ZoneCompactor.java | 10 | ||||
-rwxr-xr-x | libc/tools/zoneinfo/update-tzdata.py | 22 |
2 files changed, 21 insertions, 11 deletions
diff --git a/libc/tools/zoneinfo/ZoneCompactor.java b/libc/tools/zoneinfo/ZoneCompactor.java index bf3153e..2d598fe 100644 --- a/libc/tools/zoneinfo/ZoneCompactor.java +++ b/libc/tools/zoneinfo/ZoneCompactor.java @@ -132,9 +132,15 @@ public class ZoneCompactor { throw new RuntimeException("zone filename too long: " + zoneName.length()); } + // Follow the chain of links to work out where the real data for this zone lives. + String actualZoneName = zoneName; + while (links.get(actualZoneName) != null) { + actualZoneName = links.get(actualZoneName); + } + f.write(toAscii(new byte[MAXNAME], zoneName)); - f.writeInt(offsets.get(zoneName)); - f.writeInt(lengths.get(zoneName)); + f.writeInt(offsets.get(actualZoneName)); + f.writeInt(lengths.get(actualZoneName)); f.writeInt(0); // Used to be raw GMT offset. No longer used. } diff --git a/libc/tools/zoneinfo/update-tzdata.py b/libc/tools/zoneinfo/update-tzdata.py index f5681be..330f166 100755 --- a/libc/tools/zoneinfo/update-tzdata.py +++ b/libc/tools/zoneinfo/update-tzdata.py @@ -13,8 +13,11 @@ import sys import tarfile import tempfile -regions = ['africa', 'antarctica', 'asia', 'australasia', 'backward', - 'etcetera', 'europe', 'northamerica', 'southamerica'] +regions = ['africa', 'antarctica', 'asia', 'australasia', + 'etcetera', 'europe', 'northamerica', 'southamerica', + # These two deliberately come last so they override what came + # before (and each other). + 'backward', 'backzone' ] def CheckDirExists(dir, dirname): if not os.path.isdir(dir): @@ -49,16 +52,16 @@ def WriteSetupFile(): fields = line.split() if fields: if fields[0] == 'Link': - links.append('%s %s %s\n' % (fields[0], fields[1], fields[2])) + links.append('%s %s %s' % (fields[0], fields[1], fields[2])) zones.append(fields[2]) elif fields[0] == 'Zone': zones.append(fields[1]) zones.sort() setup = open('setup', 'w') - for link in links: - setup.write(link) - for zone in zones: + for link in sorted(set(links)): + setup.write('%s\n' % link) + for zone in sorted(set(zones)): setup.write('%s\n' % zone) setup.close() @@ -165,9 +168,10 @@ def BuildBionicToolsAndData(data_filename): print 'Calling zic(1)...' os.mkdir('data') - for region in regions: - if region != 'backward': - subprocess.check_call(['zic', '-d', 'data', 'extracted/%s' % region]) + zic_inputs = [ 'extracted/%s' % x for x in regions ] + zic_cmd = ['zic', '-d', 'data' ] + zic_cmd.extend(zic_inputs) + subprocess.check_call(zic_cmd) WriteSetupFile() |